How to get to a specific item in a QMessageBox? What is their objectName? I have a message box with buttons yes and no. You can set both css through a common QPushButton, but what are they called separately? Now there is such an option, it does not work

void MattyGroupBox::deleteNote() { QMessageBox MattyWTDNMsgBox; MattyWTDNMsgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); QMessageBox::StandardButton wantToDeleteNote; MattyWTDNMsgBox.button(QMessageBox::Yes)->setObjectName(QStringLiteral("yesButton")); MattyWTDNMsgBox.setStyleSheet(QStringLiteral("#yesButton {height: 53px;" "width: 53px;" "background-color: transparent;" "background-image: url(:/MattyNotes/CommonYes.png);" "background-position: center;" "background-repeat: no-repeat;" "color: transparent; " "font-weight: bold;" "font-style: italic; }")); //MattyWTDNMsgBox.button(QMessageBox::No)->setStyleSheet(QStringLiteral()); wantToDeleteNote = MattyWTDNMsgBox.question(this, QString::fromLocal8Bit("Удаление заметки"), QString::fromLocal8Bit("Вы точно хотите удалить" " эту заметку?")); if (wantToDeleteNote == QMessageBox::Yes) { DbManager::deleteNote(ThisGroupBoxNote.getNoteId()); this->hide(); this->~MattyGroupBox(); } } 
  • Try not assigning a button style to a button, namely QMessageBox . - alexis031182 2:55
  • So that's it? WTDNMsgBox.setStyleSheet(QStringLiteral("#yesButton {height: 53px;"})); ? Tried, also does not work - Matty
  • Then or so WTDNMsgBox.setStyleSheet(QStringLiteral("QPushButton#yesButton {height: 53px;}")); or so WTDNMsgBox.setStyleSheet(QStringLiteral("QAbstractButton#yesButton {height: 53px;}")); or even so WTDNMsgBox.button(QMessageBox::Yes)->setStyleSheet(QStringLiteral("height: 53px;")); - alexis031182
  • And note that you have a closing brace not in quotes. - alexis031182
  • I tried all the options (now I checked it again). Does not work. If you remove the identifier in any of them, put QPushButton instead of it, then it works for both buttons. This does not apply to WTDNMsgBox.button(QMessageBox::Yes)->setStyleSheet(QStringLi‌​teral("height: 53px;")); By the way, it doesn’t fit for the reason that I’ll even need to: prescribe hover. Yes, the bracket is only here that got in the wrong place, I just removed a large piece of css for example - Matty

0