Krita Source Code Documentation
Loading...
Searching...
No Matches
KDcrawIface::RExpanderBox Class Reference

#include <rexpanderbox.h>

+ Inheritance diagram for KDcrawIface::RExpanderBox:

Signals

void signalItemExpanded (int index, bool b)
 
void signalItemToggled (int index, bool b)
 

Public Member Functions

void addItem (QWidget *const w, const QIcon &icon, const QString &txt, const QString &objName, bool expandBydefault)
 
void addItem (QWidget *const w, const QString &txt, const QString &objName, bool expandBydefault)
 
void addStretch ()
 
bool checkBoxIsVisible (int index) const
 
int count () const
 
void createItem (int index, QWidget *const w, const QIcon &icon, const QString &txt, const QString &objName, bool expandBydefault)
 
int indexOf (RLabelExpander *const widget) const
 
void insertItem (int index, QWidget *const w, const QIcon &icon, const QString &txt, const QString &objName, bool expandBydefault)
 
void insertItem (int index, QWidget *const w, const QString &txt, const QString &objName, bool expandBydefault)
 
void insertStretch (int index)
 
bool isChecked (int index) const
 
bool isItemEnabled (int index) const
 
bool isItemExpanded (int index) const
 
QIcon itemIcon (int index) const
 
QString itemText (int index) const
 
QString itemToolTip (int index) const
 
 Private (RExpanderBox *const box)
 
virtual void readSettings (KConfigGroup &group)
 
void removeItem (int index)
 
 RExpanderBox (QWidget *const parent=0)
 
void setCheckBoxVisible (int index, bool b)
 
void setChecked (int index, bool b)
 
void setItemEnabled (int index, bool enabled)
 
void setItemExpanded (int index, bool b)
 
void setItemIcon (int index, const QIcon &icon)
 
void setItemText (int index, const QString &txt)
 
void setItemToolTip (int index, const QString &tip)
 
RLabelExpanderwidget (int index) const
 
virtual void writeSettings (KConfigGroup &group)
 
 ~RExpanderBox () override
 

Public Attributes

RExpanderBoxparent
 
QVBoxLayout * vbox
 
QList< RLabelExpander * > wList
 

Private Slots

void slotItemExpanded (bool b)
 
void slotItemToggled (bool b)
 

Private Attributes

Private *const d
 
- Private Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 

Additional Inherited Members

- Private Member Functions inherited from Private
 Private (KisCanvas2 *c)
 

Detailed Description

Definition at line 510 of file rexpanderbox.cpp.

Constructor & Destructor Documentation

◆ RExpanderBox()

KDcrawIface::RExpanderBox::RExpanderBox ( QWidget *const parent = 0)

Definition at line 558 of file rexpanderbox.cpp.

559 : QScrollArea(parent), d(new Private(this))
560{
561 setFrameStyle(QFrame::NoFrame);
562 setWidgetResizable(true);
563 QWidget* const main = new QWidget(viewport());
564 d->vbox = new QVBoxLayout(main);
565 d->vbox->setContentsMargins(0, 0, 0, 0);
566 d->vbox->setSpacing(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing));
567 setWidget(main);
568
569 setAutoFillBackground(false);
570 viewport()->setAutoFillBackground(false);
571 main->setAutoFillBackground(false);
572}
int main(int argc, char **argv)
Definition main.cpp:26

References d, and main().

◆ ~RExpanderBox()

KDcrawIface::RExpanderBox::~RExpanderBox ( )
override

Definition at line 574 of file rexpanderbox.cpp.

575{
576 d->wList.clear();
577 delete d;
578}

References d.

Member Function Documentation

◆ addItem() [1/2]

void KDcrawIface::RExpanderBox::addItem ( QWidget *const w,
const QIcon & icon,
const QString & txt,
const QString & objName,
bool expandBydefault )

Add RLabelExpander item at end of box layout with these settings : 'w' : the widget hosted by RLabelExpander. 'pix' : pixmap used as icon to item title. 'txt' : text used as item title. 'objName' : item object name used to read/save expanded settings to rc file. 'expandBydefault' : item state by default (expanded or not).

Definition at line 604 of file rexpanderbox.cpp.

606{
607 d->createItem(-1, w, icon, txt, objName, expandBydefault);
608}

References d.

◆ addItem() [2/2]

void KDcrawIface::RExpanderBox::addItem ( QWidget *const w,
const QString & txt,
const QString & objName,
bool expandBydefault )

Definition at line 610 of file rexpanderbox.cpp.

612{
613 addItem(w, QIcon(), txt, objName, expandBydefault);
614}
void addItem(QWidget *const w, const QIcon &icon, const QString &txt, const QString &objName, bool expandBydefault)

References addItem().

◆ addStretch()

void KDcrawIface::RExpanderBox::addStretch ( )

Definition at line 616 of file rexpanderbox.cpp.

617{
618 d->vbox->addStretch(10);
619}

References d.

◆ checkBoxIsVisible()

bool KDcrawIface::RExpanderBox::checkBoxIsVisible ( int index) const

Definition at line 586 of file rexpanderbox.cpp.

587{
588 if (index > d->wList.count() || index < 0) return false;
589 return d->wList[index]->checkBoxIsVisible();
590}

References d.

◆ count()

int KDcrawIface::RExpanderBox::count ( ) const

Definition at line 691 of file rexpanderbox.cpp.

692{
693 return d->wList.count();
694}

References d.

◆ createItem()

void KDcrawIface::RExpanderBox::createItem ( int index,
QWidget *const w,
const QIcon & icon,
const QString & txt,
const QString & objName,
bool expandBydefault )
inline

Definition at line 520 of file rexpanderbox.cpp.

522 {
523 RLabelExpander* const exp = new RLabelExpander(parent->viewport());
524 exp->setText(txt);
525 exp->setIcon(icon.pixmap(QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize)));
526 exp->setWidget(w);
527 exp->setLineVisible(!wList.isEmpty());
528 exp->setObjectName(objName);
529 exp->setExpandByDefault(expandBydefault);
530
531 if (index >= 0)
532 {
533 vbox->insertWidget(index, exp);
534 wList.insert(index, exp);
535 }
536 else
537 {
538 vbox->addWidget(exp);
539 wList.append(exp);
540 }
541
542 parent->connect(exp, SIGNAL(signalExpanded(bool)),
543 parent, SLOT(slotItemExpanded(bool)));
544
545 parent->connect(exp, SIGNAL(signalToggled(bool)),
546 parent, SLOT(slotItemToggled(bool)));
547 }
QList< RLabelExpander * > wList

References KDcrawIface::RLabelExpander::setExpandByDefault(), KDcrawIface::RLabelExpander::setIcon(), KDcrawIface::RLabelExpander::setLineVisible(), KDcrawIface::RLabelExpander::setText(), and KDcrawIface::RLabelExpander::setWidget().

◆ indexOf()

int KDcrawIface::RExpanderBox::indexOf ( RLabelExpander *const widget) const

Definition at line 726 of file rexpanderbox.cpp.

727{
728 for (int i = 0 ; i < count(); ++i)
729 {
730 RLabelExpander* const exp = d->wList[i];
731
732 if (widget == exp)
733 return i;
734 }
735 return -1;
736}
RLabelExpander * widget(int index) const

References count(), d, and widget().

◆ insertItem() [1/2]

void KDcrawIface::RExpanderBox::insertItem ( int index,
QWidget *const w,
const QIcon & icon,
const QString & txt,
const QString & objName,
bool expandBydefault )

Insert RLabelExpander item at box layout index with these settings : 'w' : the widget hosted by RLabelExpander. 'pix' : pixmap used as icon to item title. 'txt' : text used as item title. 'objName' : item object name used to read/save expanded settings to rc file. 'expandBydefault' : item state by default (expanded or not).

Definition at line 621 of file rexpanderbox.cpp.

623{
624 d->createItem(index, w, icon, txt, objName, expandBydefault);
625}

References d.

◆ insertItem() [2/2]

void KDcrawIface::RExpanderBox::insertItem ( int index,
QWidget *const w,
const QString & txt,
const QString & objName,
bool expandBydefault )

Definition at line 649 of file rexpanderbox.cpp.

651{
652 insertItem(index, w, QIcon(), txt, objName, expandBydefault);
653}
void insertItem(int index, QWidget *const w, const QIcon &icon, const QString &txt, const QString &objName, bool expandBydefault)

References insertItem().

◆ insertStretch()

void KDcrawIface::RExpanderBox::insertStretch ( int index)

Definition at line 655 of file rexpanderbox.cpp.

656{
657 d->vbox->insertStretch(index, 10);
658}

References d.

◆ isChecked()

bool KDcrawIface::RExpanderBox::isChecked ( int index) const

Definition at line 598 of file rexpanderbox.cpp.

599{
600 if (index > d->wList.count() || index < 0) return false;
601 return d->wList[index]->isChecked();
602}

References d.

◆ isItemEnabled()

bool KDcrawIface::RExpanderBox::isItemEnabled ( int index) const

Definition at line 714 of file rexpanderbox.cpp.

715{
716 if (index > d->wList.count() || index < 0) return false;
717 return d->wList[index]->isEnabled();
718}

References d.

◆ isItemExpanded()

bool KDcrawIface::RExpanderBox::isItemExpanded ( int index) const

Definition at line 749 of file rexpanderbox.cpp.

750{
751 if (index > d->wList.count() || index < 0) return false;
752
753 RLabelExpander* const exp = d->wList[index];
754
755 if (!exp) return false;
756
757 return (exp->isExpanded());
758}

References d, and KDcrawIface::RLabelExpander::isExpanded().

◆ itemIcon()

QIcon KDcrawIface::RExpanderBox::itemIcon ( int index) const

Definition at line 685 of file rexpanderbox.cpp.

686{
687 if (index > d->wList.count() || index < 0) return QIcon();
688 return d->wList[index]->icon();
689}

References d.

◆ itemText()

QString KDcrawIface::RExpanderBox::itemText ( int index) const

Definition at line 673 of file rexpanderbox.cpp.

674{
675 if (index > d->wList.count() || index < 0) return QString();
676 return d->wList[index]->text();
677}

References d.

◆ itemToolTip()

QString KDcrawIface::RExpanderBox::itemToolTip ( int index) const

Definition at line 702 of file rexpanderbox.cpp.

703{
704 if (index > d->wList.count() || index < 0) return QString();
705 return d->wList[index]->toolTip();
706}

References d.

◆ Private()

KDcrawIface::RExpanderBox::Private ( RExpanderBox *const box)
inline

Definition at line 514 of file rexpanderbox.cpp.

515 {
516 parent = box;
517 vbox = 0;
518 }

◆ readSettings()

void KDcrawIface::RExpanderBox::readSettings ( KConfigGroup & group)
virtual

Reimplemented in KDcrawIface::DcrawSettingsWidget.

Definition at line 760 of file rexpanderbox.cpp.

761{
762 for (int i = 0 ; i < count(); ++i)
763 {
764 RLabelExpander* const exp = d->wList[i];
765
766 if (exp)
767 {
768 exp->setExpanded(group.readEntry(QString("%1 Expanded").arg(exp->objectName()),
769 exp->isExpandByDefault()));
770 }
771 }
772}

References count(), d, KDcrawIface::RLabelExpander::isExpandByDefault(), and KDcrawIface::RLabelExpander::setExpanded().

◆ removeItem()

void KDcrawIface::RExpanderBox::removeItem ( int index)

Definition at line 660 of file rexpanderbox.cpp.

661{
662 if (index > d->wList.count() || index < 0) return;
663 d->wList[index]->hide();
664 d->wList.removeAt(index);
665}

References d.

◆ setCheckBoxVisible()

void KDcrawIface::RExpanderBox::setCheckBoxVisible ( int index,
bool b )

Definition at line 580 of file rexpanderbox.cpp.

581{
582 if (index > d->wList.count() || index < 0) return;
583 d->wList[index]->setCheckBoxVisible(b);
584}

References d.

◆ setChecked()

void KDcrawIface::RExpanderBox::setChecked ( int index,
bool b )

Definition at line 592 of file rexpanderbox.cpp.

593{
594 if (index > d->wList.count() || index < 0) return;
595 d->wList[index]->setChecked(b);
596}

References d.

◆ setItemEnabled()

void KDcrawIface::RExpanderBox::setItemEnabled ( int index,
bool enabled )

Definition at line 708 of file rexpanderbox.cpp.

709{
710 if (index > d->wList.count() || index < 0) return;
711 d->wList[index]->setEnabled(enabled);
712}

References d.

◆ setItemExpanded()

void KDcrawIface::RExpanderBox::setItemExpanded ( int index,
bool b )

Definition at line 738 of file rexpanderbox.cpp.

739{
740 if (index > d->wList.count() || index < 0) return;
741
742 RLabelExpander* const exp = d->wList[index];
743
744 if (!exp) return;
745
746 exp->setExpanded(b);
747}

References d, and KDcrawIface::RLabelExpander::setExpanded().

◆ setItemIcon()

void KDcrawIface::RExpanderBox::setItemIcon ( int index,
const QIcon & icon )

Definition at line 679 of file rexpanderbox.cpp.

680{
681 if (index > d->wList.count() || index < 0) return;
682 d->wList[index]->setIcon(icon.pixmap(style()->pixelMetric(QStyle::PM_SmallIconSize)));
683}

References d.

◆ setItemText()

void KDcrawIface::RExpanderBox::setItemText ( int index,
const QString & txt )

Definition at line 667 of file rexpanderbox.cpp.

668{
669 if (index > d->wList.count() || index < 0) return;
670 d->wList[index]->setText(txt);
671}

References d.

◆ setItemToolTip()

void KDcrawIface::RExpanderBox::setItemToolTip ( int index,
const QString & tip )

Definition at line 696 of file rexpanderbox.cpp.

697{
698 if (index > d->wList.count() || index < 0) return;
699 d->wList[index]->setToolTip(tip);
700}

References d.

◆ signalItemExpanded

void KDcrawIface::RExpanderBox::signalItemExpanded ( int index,
bool b )
signal

◆ signalItemToggled

void KDcrawIface::RExpanderBox::signalItemToggled ( int index,
bool b )
signal

◆ slotItemExpanded

void KDcrawIface::RExpanderBox::slotItemExpanded ( bool b)
privateslot

Definition at line 627 of file rexpanderbox.cpp.

628{
629 RLabelExpander* const exp = dynamic_cast<RLabelExpander*>(sender());
630
631 if (exp)
632 {
633 int index = indexOf(exp);
634 Q_EMIT signalItemExpanded(index, b);
635 }
636}
int indexOf(RLabelExpander *const widget) const
void signalItemExpanded(int index, bool b)

References indexOf(), and signalItemExpanded().

◆ slotItemToggled

void KDcrawIface::RExpanderBox::slotItemToggled ( bool b)
privateslot

Definition at line 638 of file rexpanderbox.cpp.

639{
640 RLabelExpander* const exp = dynamic_cast<RLabelExpander*>(sender());
641
642 if (exp)
643 {
644 int index = indexOf(exp);
645 Q_EMIT signalItemToggled(index, b);
646 }
647}
void signalItemToggled(int index, bool b)

References indexOf(), and signalItemToggled().

◆ widget()

RLabelExpander * KDcrawIface::RExpanderBox::widget ( int index) const

Definition at line 720 of file rexpanderbox.cpp.

721{
722 if (index > d->wList.count() || index < 0) return 0;
723 return d->wList[index];
724}

References d.

◆ writeSettings()

void KDcrawIface::RExpanderBox::writeSettings ( KConfigGroup & group)
virtual

Reimplemented in KDcrawIface::DcrawSettingsWidget.

Definition at line 774 of file rexpanderbox.cpp.

775{
776 for (int i = 0 ; i < count(); ++i)
777 {
778 RLabelExpander* const exp = d->wList[i];
779
780 if (exp)
781 {
782 group.writeEntry(QString("%1 Expanded").arg(exp->objectName()),
783 exp->isExpanded());
784 }
785 }
786}

References count(), d, and KDcrawIface::RLabelExpander::isExpanded().

Member Data Documentation

◆ d

Private* const KDcrawIface::RExpanderBox::d
private

Definition at line 270 of file rexpanderbox.h.

◆ parent

RExpanderBox* KDcrawIface::RExpanderBox::parent

Definition at line 555 of file rexpanderbox.cpp.

◆ vbox

QVBoxLayout* KDcrawIface::RExpanderBox::vbox

Definition at line 553 of file rexpanderbox.cpp.

◆ wList

QList<RLabelExpander*> KDcrawIface::RExpanderBox::wList

Definition at line 551 of file rexpanderbox.cpp.


The documentation for this class was generated from the following files: