void
FormProperties::setButtons( Buttons b )
{
	if( b.testFlag( MinimizeButton ) )
		d->m_ui.m_minimize->setChecked( true );
	else
		d->m_ui.m_minimize->setChecked( false );

	if( b.testFlag( MaximizeButton ) )
		d->m_ui.m_maximize->setChecked( true );
	else
		d->m_ui.m_maximize->setChecked( false );

	if( b.testFlag( CloseButton ) )
		d->m_ui.m_close->setChecked( true );
	else
		d->m_ui.m_close->setChecked( false );
}
示例#2
0
文件: dialog.cpp 项目: IMAN4K/QtPro
void MessageDialog::addButtons(const Buttons &f) {
	_actionLayout.setSpacing(8);
	_actionLayout.setContentsMargins(0, 8, 0, 8);
	_actionLayout.addStretch();
	if (f.testFlag(Button::NoButton)) return;
	if (align() == Align::Ltr) {
		if (f.testFlag(Button::Cancel)) {
			_cancel = new FlatButton("CANCEL", this);
			_actionLayout.addWidget(_cancel);
			QObject::connect(_cancel, SIGNAL(clicked()), this, SLOT(onClick()));
		}
		if (f.testFlag(Button::OK)) {
			_ok = new FlatButton("OK", this);
			_actionLayout.addWidget(_ok);
			QObject::connect(_ok, SIGNAL(clicked()), this, SLOT(onClick()));
		}
		if (f.testFlag(Button::No)) {
			_no = new FlatButton("No", this);
			_actionLayout.addWidget(_no);
			QObject::connect(_no, SIGNAL(clicked()), this, SLOT(onClick()));
		}
		if (f.testFlag(Button::Yes)) {
			_yes = new FlatButton("YES", this);
			_actionLayout.addWidget(_yes);
			QObject::connect(_yes, SIGNAL(clicked()), this, SLOT(onClick()));
		}
		if (f.testFlag(Button::Close)) {
			_close = new FlatButton("CLOSE", this);
			_actionLayout.addWidget(_close);
			QObject::connect(_close, SIGNAL(clicked()), this, SLOT(onClick()));
		}

		if (f.testFlag(Button::Dicard)) {
			_dicard = new FlatButton("DISCARD", this);
			_actionLayout.addWidget(_dicard);
			QObject::connect(_dicard, SIGNAL(clicked()), this, SLOT(onClick()));
		}
	}
}