void mouseMoveEvent(QMouseEvent *event) { if(!m_Active) return; if(event->y() < height() / 2 && m_State != 1) { m_State = 1; applyStyleSheet(); } if(event->y() > height() / 2 && m_State != 2) { m_State = 2; applyStyleSheet(); } }
Context::ToolbarView::ToolbarView( Plasma::Containment* containment, QGraphicsScene* scene, QWidget* parent ) : QGraphicsView( scene, parent ) , m_height( 36 ) , m_cont( containment ) { setObjectName( "ContextToolbarView" ); setFixedHeight( m_height ); setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ); setAutoFillBackground( true ); setContentsMargins( 0, 0, 0, 0 ); setFrameStyle( QFrame::NoFrame ); applyStyleSheet(); connect( The::paletteHandler(), SIGNAL(newPalette(QPalette)), SLOT(applyStyleSheet()) ); //Padding required to prevent view scrolling, probably caused by the 1px ridge setSceneRect( TOOLBAR_X_OFFSET, 0, size().width()-TOOLBAR_SCENE_PADDING, size().height()-TOOLBAR_SCENE_PADDING ); setInteractive( true ); setAcceptDrops( true ); setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); // now we create the toolbar m_toolbar = new AppletToolbar(0); scene->addItem(m_toolbar.data()); m_toolbar.data()->setContainment( qobject_cast<Context::Containment *>(containment) ); m_toolbar.data()->setZValue( m_toolbar.data()->zValue() + 1000 ); m_toolbar.data()->setPos( TOOLBAR_X_OFFSET, 0 ); connect( m_toolbar.data(), SIGNAL(configModeToggled()), SLOT(toggleConfigMode()) ); connect( m_toolbar.data(), SIGNAL(hideAppletExplorer()), SIGNAL(hideAppletExplorer()) ); connect( m_toolbar.data(), SIGNAL(showAppletExplorer()), SIGNAL(showAppletExplorer()) ); Context::Containment* cont = dynamic_cast< Context::Containment* >( containment ); if( cont ) { connect( cont, SIGNAL(appletAdded(Plasma::Applet*,int)), m_toolbar.data(), SLOT(appletAdded(Plasma::Applet*,int)) ); connect( m_toolbar.data(), SIGNAL(appletAddedToToolbar(Plasma::Applet*,int)), this, SLOT(appletAdded(Plasma::Applet*,int)) ); connect( cont, SIGNAL(appletRemoved(Plasma::Applet*)), this, SLOT(appletRemoved(Plasma::Applet*)) ); connect( m_toolbar.data(), SIGNAL(showApplet(Plasma::Applet*)), cont, SLOT(showApplet(Plasma::Applet*)) ); connect( m_toolbar.data(), SIGNAL(moveApplet(Plasma::Applet*,int,int)), cont, SLOT(moveApplet(Plasma::Applet*,int,int)) ); } }
void DashboardStatusWidget::setLevel(const ProjectStatusLevel Level) { if (Level == PRJ_OK) { ui->TitleLabel->setText(tr("Ready for simulation")); ui->NoMessageLabel->setVisible(true); m_BorderColor = "#55B332"; } else if (Level == PRJ_WARNING) { ui->TitleLabel->setText(tr("Ready for simulation, with warnings")); ui->NoMessageLabel->setVisible(false); m_BorderColor = "#E3A740"; } else if (Level == PRJ_ERROR) { ui->TitleLabel->setText(tr("Simulation cannot be run")); ui->NoMessageLabel->setVisible(false); m_BorderColor = "#B31717"; } else { ui->TitleLabel->setText(tr("Simulation is disabled")); ui->NoMessageLabel->setVisible(false); m_BorderColor = "#757575"; } applyStyleSheet(); }
// --- StyleSheetPropertyEditorDialog StyleSheetPropertyEditorDialog::StyleSheetPropertyEditorDialog(QWidget *parent, QDesignerFormWindowInterface *fw, QWidget *widget): StyleSheetEditorDialog(fw->core(), parent), m_fw(fw), m_widget(widget) { Q_ASSERT(m_fw != 0); QPushButton *apply = buttonBox()->addButton(QDialogButtonBox::Apply); QObject::connect(apply, SIGNAL(clicked()), this, SLOT(applyStyleSheet())); QObject::connect(buttonBox(), SIGNAL(accepted()), this, SLOT(applyStyleSheet())); QDesignerPropertySheetExtension *sheet = qt_extension<QDesignerPropertySheetExtension*>(m_fw->core()->extensionManager(), m_widget); Q_ASSERT(sheet != 0); setText(sheet->property(sheet->indexOf(QLatin1String(styleSheetProperty))).toString()); }
void Badge::setActive(const bool &active) { m_active = active; switch (m_badgeType) { case Badge::LabelDefault: case Badge::LabelSuccess: case Badge::LabelWarning: case Badge::LabelImportant: case Badge::LabelInfo: case Badge::LabelInverse: m_badgeType = active ? Badge::LabelWarning : Badge::LabelDefault; break; case Badge::BadgeDefault: case Badge::BadgeSuccess: case Badge::BadgeWarning: case Badge::BadgeImportant: case Badge::BadgeInfo: case Badge::BadgeInverse: m_badgeType = active ? Badge::BadgeInfo : Badge::BadgeDefault; break; } applyStyleSheet(); }
void Badge::setClosable(const bool &closable) { m_closable = closable; applyStyleSheet(); }
void Badge::setBadgeType(Badge::BadgeType type) { m_badgeType = type; applyStyleSheet(); }
void Badge::setFontBold(const bool &bold) { m_fontBold = bold; applyStyleSheet(); }
void Badge::setShowActiveMark(const bool &showActiveMark) { m_showActiveMark = showActiveMark; applyStyleSheet(); }
void leaveEvent(QEvent *) { if(!m_Active) return; m_State = 0; applyStyleSheet(); }