PDA

View Full Version : change text size and window size - qmessagebox



smemamian
3rd July 2013, 09:18
hi

i want to change text size and window size of qmessagebox,it is very small :

9261

i want change to :

9262

tnx

sonulohani
3rd July 2013, 13:59
You can change the text size using html. For that :-


msgBox->setText("<font size="5">" + string + </font>);


And for the size of messagebox


msgBox->setFixedSize(width,height);

smemamian
3rd July 2013, 15:02
Thank you for your reply.
1- it is correct :


msgBox->setText("<font size=5>" + string + "</font>");

2- messagebox does not change !


StringClass strclass;
QMessageBox mb(" Win ","<font size=10>" +
strclass.getStringOne() + "</font>" ,QMessageBox::NoIcon,
QMessageBox::Ok | QMessageBox::Default,
QMessageBox::NoButton,
QMessageBox::NoButton);

QPixmap exportSuccess(":/PIC/award.png");
mb.setIconPixmap(exportSuccess);
QPalette palette;
palette.setBrush(QPalette::Background,QBrush(QImag e(":/PIC/award.png")));
mb.setFixedSize(100,100);
mb.exec()

:(

sonulohani
4th July 2013, 07:38
Check with this:-


QMessageBox msg(this);
msg.setIconPixmap(QPixmap(":/error.svg"));
msg.setText("No images loaded");
msg.setInformativeText("There are no images in the list. Please create or load a project");
msg.setStandardButtons(QMessageBox::Ok);
msg.setDefaultButton(QMessageBox::Ok);

QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
QGridLayout* layout = (QGridLayout*)msg.layout();
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
msg.exec();