コード例 #1
0
QgsMessageLogViewer::QgsMessageLogViewer( QStatusBar *statusBar, QWidget *parent, Qt::WFlags fl )
    : QDialog( parent, fl )
    , mButton( 0 )
    , mCount( 0 )
{
  setupUi( this );

  connect( QgsMessageLog::instance(), SIGNAL( messageReceived( QString, QString, QgsMessageLog::MessageLevel ) ),
           this, SLOT( logMessage( QString, QString, QgsMessageLog::MessageLevel ) ) );

  if ( statusBar )
  {
    mButton = new QToolButton( parent );
    mButton->setObjectName( "mMessageLogViewerButton" );
    mButton->setMaximumWidth( 20 );
    mButton->setMaximumHeight( 20 );
    mButton->setIcon( icon( "/mIconWarn.png" ) );
#ifndef ANDROID
    mButton->setToolTip( tr( "No messages." ) );
#endif
    mButton->setCheckable( true );
    mButton->hide();
    connect( mButton, SIGNAL( toggled( bool ) ), this, SLOT( buttonToggled( bool ) ) );
    connect( mButton, SIGNAL( destroyed() ), this, SLOT( buttonDestroyed() ) );
    statusBar->addPermanentWidget( mButton, 0 );
  }

  connect( tabWidget, SIGNAL( tabCloseRequested( int ) ), this, SLOT( closeTab( int ) ) );
}
コード例 #2
0
ファイル: q3buttongroup.cpp プロジェクト: RS102839/qt
int Q3ButtonGroup::insert_helper(QAbstractButton *button, int id)
{
    if (isExclusive() || !qobject_cast<QRadioButton*>(button))
        group.addButton(button);

    static int seq_no = -2;
    if (id < -1)
        id = seq_no--;
    else if (id == -1)
        id = buttonIds.count();
    buttonIds.insert(id, button);
    connect(button, SIGNAL(pressed()) , SLOT(buttonPressed()));
    connect(button, SIGNAL(released()), SLOT(buttonReleased()));
    connect(button, SIGNAL(clicked()) , SLOT(buttonClicked()));
    connect(button, SIGNAL(destroyed()) , SLOT(buttonDestroyed()));
    return id;
}