コード例 #1
0
 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();
   }
 }
コード例 #2
0
ファイル: ToolbarView.cpp プロジェクト: cancamilo/amarok
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)) );
   }

}
コード例 #3
0
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();
}
コード例 #4
0
// --- 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());
}
コード例 #5
0
ファイル: Badge.cpp プロジェクト: madsailor/MediaElch
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();
}
コード例 #6
0
ファイル: Badge.cpp プロジェクト: madsailor/MediaElch
void Badge::setClosable(const bool &closable)
{
    m_closable = closable;
    applyStyleSheet();
}
コード例 #7
0
ファイル: Badge.cpp プロジェクト: madsailor/MediaElch
void Badge::setBadgeType(Badge::BadgeType type)
{
    m_badgeType = type;
    applyStyleSheet();
}
コード例 #8
0
ファイル: Badge.cpp プロジェクト: madsailor/MediaElch
void Badge::setFontBold(const bool &bold)
{
    m_fontBold = bold;
    applyStyleSheet();
}
コード例 #9
0
ファイル: Badge.cpp プロジェクト: madsailor/MediaElch
void Badge::setShowActiveMark(const bool &showActiveMark)
{
    m_showActiveMark = showActiveMark;
    applyStyleSheet();
}
コード例 #10
0
 void leaveEvent(QEvent *)
 {
   if(!m_Active) return;
   m_State = 0;
   applyStyleSheet();
 }