Set push button checkable to true : QBrush « Qt « C++






Set push button checkable to true

  

#include <QtGui>

int main(int argc, char* argv[])
{
  QApplication app(argc, argv);
  QDialog dlg;
  QPushButton *btn = new QPushButton(QObject::tr("Expand/Collapse"),&dlg);

  btn->setCheckable(true);
  QVBoxLayout *lay = new QVBoxLayout(&dlg);
  lay->addWidget(btn);
  QLabel *ext = new QLabel(QObject::tr("Extension"));
  dlg.setExtension(ext);
  QObject::connect(btn, SIGNAL(toggled(bool)),&dlg, SLOT(showExtension(bool)));

  dlg.exec();
  return app.exec();
}

   
    
  








Related examples in the same category

1.Paint with QBrush
2.Basic drawing
3.Create brush
4.Using Pen and Brush to draw