htzfun
htzfun

Reputation: 1448

QMessageBox and tabOrdering

Is there any way to setTabOrder in QMessageBox without subclassing it or writing my own? In cases when you already got big project - this might be useful.

Upvotes: 0

Views: 50

Answers (1)

Alexander V
Alexander V

Reputation: 8698

Is there any way to setTabOrder in QMessageBox without subclassing it or writing my own? In cases when you already got big project - this might be useful.

There is a way to use setTabOrder in QMessageBox. All you need is QWidget* pointers to 'from' and 'to' tabs.

class MyApp
{
   // ...
   void tabOrdering();
   QMessagebox* m_pMsgBox; 
}

void MyApp::tabOrdering()
{
     auto* pSaveBn = m_pMsgBox->addButton(QMessagebox::Save);
     m_pMsgBox->setTabOrder(m_pMsgBox->defaultButton(), pSaveBn);
}

You may also consider using QObject::findChild method for finding tab widget stops.

Upvotes: 1

Related Questions