검색결과 리스트
qmessagebox에 해당되는 글 1건
- 2016.11.11 QMessageBox 크기를 키워서 쓰는 법.
QMessageBox messageBox;
QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
messageBox.setText( msg );
messageBox.setStandardButtons(QMessageBox::Yes);
messageBox.addButton(QMessageBox::No);
messageBox.setDefaultButton(QMessageBox::No);
QGridLayout* layout = (QGridLayout*)messageBox.layout();
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
if( messageBox.exec() == QMessageBox::Yes)
{
//yes
}
else
{
//no
}
-----------------------------------
버튼의 문구를 바꾸고 팝업 style을 주고 싶다면.
messageBox.setStyleSheet(
" QLabel {"
" min-width: 300em;"
"font: bold 24px; "
"}"
"QPushButton {"
"font: bold 24px; "
"}"
);
//messageBox.setDefaultButton(QMessageBox::No);
QAbstractButton *myYesButton = messageBox.addButton(tr("BUTTON_DELETE"), QMessageBox::YesRole);
QAbstractButton *myNoButton = messageBox.addButton(tr("BUTTON_CANCEL"), QMessageBox::NoRole);
QGridLayout* layout = (QGridLayout*)messageBox.layout();
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
messageBox.exec();
//if( messageBox.exec() == QMessageBox::Yes)
if(messageBox.clickedButton() == myYesButton)
RECENT COMMENT