Changeset View
Changeset View
Standalone View
Standalone View
libs/ui/KisNodeDelegate.cpp
Context not available. | |||||
73 | , d(new Private) | 73 | , d(new Private) | ||
---|---|---|---|---|---|
74 | { | 74 | { | ||
75 | d->view = view; | 75 | d->view = view; | ||
76 | | ||||
76 | QApplication::instance()->installEventFilter(this); | 77 | QApplication::instance()->installEventFilter(this); | ||
77 | connect(KisConfigNotifier::instance(), SIGNAL(configChanged()), SLOT(slotConfigChanged())); | 78 | connect(KisConfigNotifier::instance(), SIGNAL(configChanged()), SLOT(slotConfigChanged())); | ||
78 | slotConfigChanged(); | 79 | slotConfigChanged(); | ||
Context not available. | |||||
534 | const int y = option.rect.top() + (scm.rowHeight() - scm.border() - scm.visibilitySize()) / 2; | 535 | const int y = option.rect.top() + (scm.rowHeight() - scm.border() - scm.visibilitySize()) / 2; | ||
535 | 536 | | |||
536 | QIcon icon = prop->state.toBool() ? prop->onIcon : prop->offIcon; | 537 | QIcon icon = prop->state.toBool() ? prop->onIcon : prop->offIcon; | ||
537 | p->setOpacity(1.0); | 538 | | ||
539 | // if we are not showing the layer, make the icon slightly transparent like other inactive icons | ||||
540 | const qreal oldOpacity = p->opacity(); | ||||
541 | if (prop->state.toBool() == true) { | ||||
542 | p->setOpacity(1.0); | ||||
543 | } | ||||
544 | else { | ||||
545 | p->setOpacity(0.35); | ||||
546 | } | ||||
547 | | ||||
538 | p->drawPixmap(x, y, icon.pixmap(scm.visibilitySize(), QIcon::Normal)); | 548 | p->drawPixmap(x, y, icon.pixmap(scm.visibilitySize(), QIcon::Normal)); | ||
549 | p->setOpacity(oldOpacity); | ||||
539 | 550 | | |||
540 | //// For debugging purposes only | 551 | //// For debugging purposes only | ||
541 | // p->save(); | 552 | // p->save(); | ||
Context not available. | |||||
638 | } | 649 | } | ||
639 | } | 650 | } | ||
640 | 651 | | |||
652 | | ||||
641 | bool KisNodeDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) | 653 | bool KisNodeDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) | ||
642 | { | 654 | { | ||
643 | KisNodeViewColorScheme scm; | 655 | KisNodeViewColorScheme scm; | ||
Context not available. | |||||
855 | return option; | 867 | return option; | ||
856 | } | 868 | } | ||
857 | 869 | | |||
858 | QRect KisNodeDelegate::progressBarRect(const QStyleOptionViewItem &option, const QModelIndex &index) const | | |||
859 | { | | |||
860 | return iconsRect(option, index); | | |||
861 | } | | |||
862 | | ||||
863 | void KisNodeDelegate::drawProgressBar(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const | 870 | void KisNodeDelegate::drawProgressBar(QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const | ||
864 | { | 871 | { | ||
865 | QVariant value = index.data(KisNodeModel::ProgressRole); | 872 | QVariant value = index.data(KisNodeModel::ProgressRole); | ||
866 | if (!value.isNull() && (value.toInt() >= 0 && value.toInt() <= 100)) { | 873 | if (!value.isNull() && (value.toInt() >= 0 && value.toInt() <= 100)) { | ||
867 | const QRect r = progressBarRect(option, index); | 874 | | ||
875 | /// The progress bar will display under the layer name area. The bars have accurate data, so we | ||||
876 | /// probably don't need to also show the actualy number for % complete | ||||
877 | | ||||
878 | KisNodeViewColorScheme scm; | ||||
879 | const int width = textRect(option, index).width() + scm.iconSize()*2; | ||||
880 | const int height = 5; | ||||
881 | const QPoint base = option.rect.bottomLeft() - QPoint(0, height ); | ||||
882 | const QRect r = QRect(base.x(), base.y(), width, height); | ||||
883 | | ||||
868 | p->save(); | 884 | p->save(); | ||
869 | { | 885 | { | ||
870 | p->setClipRect(r); | 886 | p->setClipRect(r); | ||
Context not available. | |||||
874 | opt.minimum = 0; | 890 | opt.minimum = 0; | ||
875 | opt.maximum = 100; | 891 | opt.maximum = 100; | ||
876 | opt.progress = value.toInt(); | 892 | opt.progress = value.toInt(); | ||
877 | opt.textVisible = true; | 893 | opt.textVisible = false; | ||
878 | opt.textAlignment = Qt::AlignHCenter; | 894 | opt.textAlignment = Qt::AlignHCenter; | ||
879 | opt.text = i18n("%1 %", opt.progress); | 895 | opt.text = i18n("%1 %", opt.progress); | ||
880 | opt.rect = r; | 896 | opt.rect = r; | ||
Context not available. | |||||
893 | d->checkersColor1 = cfg.checkersColor1(); | 909 | d->checkersColor1 = cfg.checkersColor1(); | ||
894 | d->checkersColor2 = cfg.checkersColor2(); | 910 | d->checkersColor2 = cfg.checkersColor2(); | ||
895 | } | 911 | } | ||
912 | | ||||
913 | void KisNodeDelegate::slotUpdateIcon() | ||||
914 | { | ||||
915 | KisLayerPropertiesIcons::instance()->updateIcons(); | ||||
916 | } | ||||
Context not available. |