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

#include <rexpanderbox.h>

+ Inheritance diagram for KDcrawIface::RLabelExpander:

Signals

void signalExpanded (bool)
 
void signalToggled (bool)
 

Public Member Functions

bool checkBoxIsVisible () const
 
QIcon icon () const
 
bool isChecked () const
 
bool isExpandByDefault () const
 
bool isExpanded () const
 
bool lineIsVisible () const
 
 Private ()
 
 RLabelExpander (QWidget *const parent=0)
 
void setCheckBoxVisible (bool b)
 
void setChecked (bool b)
 
void setExpandByDefault (bool b)
 
void setExpanded (bool b)
 
void setIcon (const QIcon &icon)
 
void setLineVisible (bool b)
 
void setText (const QString &txt)
 
void setWidget (QWidget *const widget)
 
QString text () const
 
QWidget * widget () const
 
 ~RLabelExpander () override
 

Public Attributes

RArrowClickLabelarrow
 
QCheckBox * checkBox
 
RClickLabelclickLabel
 
QWidget * containerWidget
 
bool expandByDefault
 
QGridLayout * grid
 
QWidget * hbox
 
RLineWidgetline
 
QLabel * pixmapLabel
 

Private Slots

void slotToggleContainer ()
 

Private Member Functions

bool eventFilter (QObject *obj, QEvent *ev) override
 
- Private Member Functions inherited from Private
 Private (KisCanvas2 *c)
 

Private Attributes

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

Detailed Description

Definition at line 302 of file rexpanderbox.cpp.

Constructor & Destructor Documentation

◆ RLabelExpander()

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

Definition at line 334 of file rexpanderbox.cpp.

335 : QWidget(parent), d(new Private)
336{
337 d->grid = new QGridLayout(this);
338 d->line = new RLineWidget(Qt::Horizontal, this);
339 d->hbox = new QWidget(this);
340 d->arrow = new RArrowClickLabel(d->hbox);
341 d->checkBox = new QCheckBox(d->hbox);
342 d->pixmapLabel = new QLabel(d->hbox);
343 d->clickLabel = new RClickLabel(d->hbox);
344
345 QHBoxLayout* const hlay = new QHBoxLayout(d->hbox);
346 hlay->addWidget(d->arrow);
347 hlay->addWidget(d->checkBox);
348 hlay->addWidget(d->pixmapLabel);
349 hlay->addWidget(d->clickLabel, 10);
350 hlay->setContentsMargins(0, 0, 0, 0);
351
352 const int styleSpacing = QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
353 hlay->setSpacing(styleSpacing);
354
355 d->pixmapLabel->installEventFilter(this);
356 d->pixmapLabel->setCursor(Qt::PointingHandCursor);
357
358 d->hbox->setCursor(Qt::PointingHandCursor);
359 setCheckBoxVisible(false);
360
361 d->grid->addWidget(d->line, 0, 0, 1, 3);
362 d->grid->addWidget(d->hbox, 1, 0, 1, 3);
363 d->grid->setColumnStretch(2, 10);
364 d->grid->setContentsMargins(styleSpacing, styleSpacing, styleSpacing, styleSpacing);
365 d->grid->setSpacing(styleSpacing);
366
369
370 connect(d->clickLabel, &RClickLabel::activated,
372
373 connect(d->checkBox, &QCheckBox::toggled,
375}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void activated()
Emitted when activated, by mouse or key press.

References KDcrawIface::RClickLabel::activated(), connect(), d, KDcrawIface::RArrowClickLabel::leftClicked(), setCheckBoxVisible(), signalToggled(), and slotToggleContainer().

◆ ~RLabelExpander()

KDcrawIface::RLabelExpander::~RLabelExpander ( )
override

Definition at line 377 of file rexpanderbox.cpp.

378{
379 delete d;
380}

References d.

Member Function Documentation

◆ checkBoxIsVisible()

bool KDcrawIface::RLabelExpander::checkBoxIsVisible ( ) const

Definition at line 387 of file rexpanderbox.cpp.

388{
389 return d->checkBox->isVisible();
390}

References d.

◆ eventFilter()

bool KDcrawIface::RLabelExpander::eventFilter ( QObject * obj,
QEvent * ev )
overrideprivate

Definition at line 487 of file rexpanderbox.cpp.

488{
489 if ( obj == d->pixmapLabel)
490 {
491 if ( ev->type() == QEvent::MouseButtonRelease)
492 {
494 return false;
495 }
496 else
497 {
498 return false;
499 }
500 }
501 else
502 {
503 // pass the event on to the parent class
504 return QWidget::eventFilter(obj, ev);
505 }
506}

References d, and slotToggleContainer().

◆ icon()

QIcon KDcrawIface::RLabelExpander::icon ( ) const

Definition at line 427 of file rexpanderbox.cpp.

428{
429#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
430 return QIcon(*d->pixmapLabel->pixmap());
431#else
432 return QIcon(d->pixmapLabel->pixmap());
433#endif
434}

References d.

◆ isChecked()

bool KDcrawIface::RLabelExpander::isChecked ( ) const

Definition at line 397 of file rexpanderbox.cpp.

398{
399 return d->checkBox->isChecked();
400}

References d.

◆ isExpandByDefault()

bool KDcrawIface::RLabelExpander::isExpandByDefault ( ) const

Definition at line 456 of file rexpanderbox.cpp.

457{
458 return d->expandByDefault;
459}

References d.

◆ isExpanded()

bool KDcrawIface::RLabelExpander::isExpanded ( ) const

Definition at line 476 of file rexpanderbox.cpp.

477{
478 return (d->arrow->arrowType() == Qt::DownArrow);
479}

References d.

◆ lineIsVisible()

bool KDcrawIface::RLabelExpander::lineIsVisible ( ) const

Definition at line 407 of file rexpanderbox.cpp.

408{
409 return d->line->isVisible();
410}

References d.

◆ Private()

KDcrawIface::RLabelExpander::Private ( )
inline

Definition at line 307 of file rexpanderbox.cpp.

308 {
309 clickLabel = 0;
310 containerWidget = 0;
311 pixmapLabel = 0;
312 grid = 0;
313 arrow = 0;
314 line = 0;
315 hbox = 0;
316 checkBox = 0;
317 expandByDefault = true;
318 }

◆ setCheckBoxVisible()

void KDcrawIface::RLabelExpander::setCheckBoxVisible ( bool b)

Definition at line 382 of file rexpanderbox.cpp.

383{
384 d->checkBox->setVisible(b);
385}

References d.

◆ setChecked()

void KDcrawIface::RLabelExpander::setChecked ( bool b)

Definition at line 392 of file rexpanderbox.cpp.

393{
394 d->checkBox->setChecked(b);
395}

References d.

◆ setExpandByDefault()

void KDcrawIface::RLabelExpander::setExpandByDefault ( bool b)

Definition at line 451 of file rexpanderbox.cpp.

452{
453 d->expandByDefault = b;
454}

References d.

◆ setExpanded()

void KDcrawIface::RLabelExpander::setExpanded ( bool b)

Definition at line 461 of file rexpanderbox.cpp.

462{
463 if (d->containerWidget)
464 {
465 d->containerWidget->setVisible(b);
466
467 if (b)
468 d->arrow->setArrowType(Qt::DownArrow);
469 else
470 d->arrow->setArrowType(Qt::RightArrow);
471 }
472
473 Q_EMIT signalExpanded(b);
474}

References d, and signalExpanded().

◆ setIcon()

void KDcrawIface::RLabelExpander::setIcon ( const QIcon & icon)

Definition at line 422 of file rexpanderbox.cpp.

423{
424 d->pixmapLabel->setPixmap(icon.pixmap(style()->pixelMetric(QStyle::PM_SmallIconSize)));
425}

References d, and icon().

◆ setLineVisible()

void KDcrawIface::RLabelExpander::setLineVisible ( bool b)

Definition at line 402 of file rexpanderbox.cpp.

403{
404 d->line->setVisible(b);
405}

References d.

◆ setText()

void KDcrawIface::RLabelExpander::setText ( const QString & txt)

Definition at line 412 of file rexpanderbox.cpp.

413{
414 d->clickLabel->setText(QString("<qt><b>%1</b></qt>").arg(txt));
415}

References d.

◆ setWidget()

void KDcrawIface::RLabelExpander::setWidget ( QWidget *const widget)

Definition at line 436 of file rexpanderbox.cpp.

437{
438 if (widget)
439 {
440 d->containerWidget = widget;
441 d->containerWidget->setParent(this);
442 d->grid->addWidget(d->containerWidget, 2, 0, 1, 3);
443 }
444}

References d, and widget().

◆ signalExpanded

void KDcrawIface::RLabelExpander::signalExpanded ( bool )
signal

◆ signalToggled

void KDcrawIface::RLabelExpander::signalToggled ( bool )
signal

◆ slotToggleContainer

void KDcrawIface::RLabelExpander::slotToggleContainer ( )
privateslot

Definition at line 481 of file rexpanderbox.cpp.

482{
483 if (d->containerWidget)
484 setExpanded(!d->containerWidget->isVisible());
485}

References d, and setExpanded().

◆ text()

QString KDcrawIface::RLabelExpander::text ( ) const

Definition at line 417 of file rexpanderbox.cpp.

418{
419 return d->clickLabel->text();
420}

References d.

◆ widget()

QWidget * KDcrawIface::RLabelExpander::widget ( ) const

Definition at line 446 of file rexpanderbox.cpp.

447{
448 return d->containerWidget;
449}

References d.

Member Data Documentation

◆ arrow

RArrowClickLabel* KDcrawIface::RLabelExpander::arrow

Definition at line 330 of file rexpanderbox.cpp.

◆ checkBox

QCheckBox* KDcrawIface::RLabelExpander::checkBox

Definition at line 322 of file rexpanderbox.cpp.

◆ clickLabel

RClickLabel* KDcrawIface::RLabelExpander::clickLabel

Definition at line 331 of file rexpanderbox.cpp.

◆ containerWidget

QWidget* KDcrawIface::RLabelExpander::containerWidget

Definition at line 324 of file rexpanderbox.cpp.

◆ d

Private* const KDcrawIface::RLabelExpander::d
private

Definition at line 185 of file rexpanderbox.h.

◆ expandByDefault

bool KDcrawIface::RLabelExpander::expandByDefault

Definition at line 320 of file rexpanderbox.cpp.

◆ grid

QGridLayout* KDcrawIface::RLabelExpander::grid

Definition at line 325 of file rexpanderbox.cpp.

◆ hbox

QWidget* KDcrawIface::RLabelExpander::hbox

Definition at line 328 of file rexpanderbox.cpp.

◆ line

RLineWidget* KDcrawIface::RLabelExpander::line

Definition at line 327 of file rexpanderbox.cpp.

◆ pixmapLabel

QLabel* KDcrawIface::RLabelExpander::pixmapLabel

Definition at line 323 of file rexpanderbox.cpp.


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