void QgsCollapsibleGroupBox::init() { // variables mCollapsed = false; mSaveState = true; mInitFlat = false; mScrollOnExpand = true; mShown = false; mParentScrollArea = 0; // init icons if ( mCollapseIcon.isNull() ) { mCollapseIcon = QgsApplication::getThemeIcon( "/mIconCollapse.png" ); mExpandIcon = QgsApplication::getThemeIcon( "/mIconExpand.png" ); } // collapse button mCollapseButton = new QToolButton( this ); mCollapseButton->setObjectName( "collapseButton" ); mCollapseButton->setAutoRaise( true ); mCollapseButton->setFixedSize( 16, 16 ); // TODO set size (as well as margins) depending on theme, in updateStyle() mCollapseButton->setIconSize( QSize( 12, 12 ) ); mCollapseButton->setIcon( mCollapseIcon ); connect( mCollapseButton, SIGNAL( clicked() ), this, SLOT( toggleCollapsed() ) ); connect( this, SIGNAL( toggled( bool ) ), this, SLOT( checkToggled( bool ) ) ); }
void QgsCollapsibleGroupBox::init() { // variables mCollapsed = false; mSaveCollapsedState = true; // NOTE: only turn on mSaveCheckedState for groupboxes NOT used // in multiple places or used as options for different parent objects mSaveCheckedState = false; mSettingGroup = ""; // if not set, use window object name mInitFlat = false; mScrollOnExpand = true; mShown = false; mParentScrollArea = 0; // init icons if ( mCollapseIcon.isNull() ) { mCollapseIcon = QgsApplication::getThemeIcon( "/mIconCollapse.png" ); mExpandIcon = QgsApplication::getThemeIcon( "/mIconExpand.png" ); } // collapse button mCollapseButton = new QToolButton( this ); mCollapseButton->setObjectName( "collapseButton" ); mCollapseButton->setAutoRaise( true ); mCollapseButton->setFixedSize( 16, 16 ); // TODO set size (as well as margins) depending on theme, in updateStyle() mCollapseButton->setIconSize( QSize( 12, 12 ) ); mCollapseButton->setIcon( mCollapseIcon ); connect( mCollapseButton, SIGNAL( clicked() ), this, SLOT( toggleCollapsed() ) ); connect( this, SIGNAL( toggled( bool ) ), this, SLOT( checkToggled( bool ) ) ); }
void QgsCollapsibleGroupBox::mouseReleaseEvent( QMouseEvent *event ) { // catch mouse release over title when non checkable, to collapse/expand if ( !isCheckable() && event->button() == Qt::LeftButton ) { if ( titleRect().contains( event->pos() ) ) { toggleCollapsed(); return; } } // default behaviour - pass to QGroupBox QGroupBox::mouseReleaseEvent( event ); }
KoDockWidgetTitleBar::KoDockWidgetTitleBar(QDockWidget* dockWidget) : QWidget(dockWidget), d(new Private(this)) { QDockWidget *q = dockWidget; d->floatIcon = kisIcon("docker_float"); d->floatButton = new KoDockWidgetTitleBarButton(this); d->floatButton->setIcon(d->floatIcon); connect(d->floatButton, SIGNAL(clicked()), SLOT(toggleFloating())); d->floatButton->setVisible(true); d->floatButton->setToolTip(i18nc("@info:tooltip", "Float Docker")); d->floatButton->setStyleSheet("border: 0"); d->removeIcon = kisIcon("docker_close"); d->closeButton = new KoDockWidgetTitleBarButton(this); d->closeButton->setIcon(d->removeIcon); connect(d->closeButton, SIGNAL(clicked()), q, SLOT(close())); d->closeButton->setVisible(true); d->closeButton->setToolTip(i18nc("@info:tooltip", "Close Docker")); d->closeButton->setStyleSheet("border: 0"); // border makes the header busy looking (appears on some OSs) d->openIcon = kisIcon("docker_collapse_a"); d->closeIcon = kisIcon("docker_collapse_b"); d->collapseButton = new KoDockWidgetTitleBarButton(this); d->collapseButton->setIcon(d->openIcon); connect(d->collapseButton, SIGNAL(clicked()), SLOT(toggleCollapsed())); d->collapseButton->setVisible(true); d->collapsable = true; d->collapseButton->setToolTip(i18nc("@info:tooltip", "Collapse Docker")); d->collapseButton->setStyleSheet("border: 0"); d->lockIcon = kisIcon("docker_lock_a"); d->lockButton = new KoDockWidgetTitleBarButton(this); d->lockButton->setCheckable(true); d->lockButton->setIcon(d->lockIcon); connect(d->lockButton, SIGNAL(toggled(bool)), SLOT(setLocked(bool))); d->lockButton->setVisible(true); d->lockable = true; d->lockButton->setToolTip(i18nc("@info:tooltip", "Lock Docker")); d->lockButton->setStyleSheet("border: 0"); connect(dockWidget, SIGNAL(featuresChanged(QDockWidget::DockWidgetFeatures)), SLOT(featuresChanged(QDockWidget::DockWidgetFeatures))); connect(dockWidget, SIGNAL(topLevelChanged(bool)), SLOT(topLevelChanged(bool))); d->featuresChanged(0); }
KoDockWidgetTitleBar::KoDockWidgetTitleBar(QDockWidget* dockWidget) : QWidget(dockWidget), d(new Private(this)) { QDockWidget *q = dockWidget; d->floatButton = new KoDockWidgetTitleBarButton(this); d->floatButton->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarNormalButton, 0, q)); connect(d->floatButton, SIGNAL(clicked()), SLOT(toggleFloating())); d->floatButton->setVisible(true); d->closeButton = new KoDockWidgetTitleBarButton(this); d->closeButton->setIcon(q->style()->standardIcon(QStyle::SP_TitleBarCloseButton, 0, q)); connect(d->closeButton, SIGNAL(clicked()), q, SLOT(close())); d->closeButton->setVisible(true); d->collapseButton = new KoDockWidgetTitleBarButton(this); d->collapseButton->setIcon(d->openIcon); connect(d->collapseButton, SIGNAL(clicked()), SLOT(toggleCollapsed())); d->collapseButton->setVisible(true); connect(dockWidget, SIGNAL(featuresChanged(QDockWidget::DockWidgetFeatures)), SLOT(featuresChanged(QDockWidget::DockWidgetFeatures))); d->featuresChanged(0); }