[UI] As discussed in FSC channel, display "save" message

* save was only shown ("overlay") if a mapping component is available
* make sure an message is also show in component is used in dialog
* change utility functions and display in "table view" without mapping component

https://discordapp.com/channels/539048679160676382/594962359441948682/643529608070692925
This commit is contained in:
Klaus Basan
2019-11-29 01:31:00 +01:00
committed by Mat Sutcliffe
parent 087410039c
commit 3b0001d113
7 changed files with 63 additions and 24 deletions

View File

@@ -591,17 +591,17 @@ namespace BlackGui
return QApplication::topLevelWidgets().contains(widget);
}
bool CGuiUtility::isQMainWindow(QWidget *widget)
bool CGuiUtility::isQMainWindow(const QWidget *widget)
{
if (!widget) { return false; }
QMainWindow *mw = qobject_cast<QMainWindow *>(widget);
const QMainWindow *mw = qobject_cast<const QMainWindow *>(widget);
return mw;
}
bool CGuiUtility::isDialog(QWidget *widget)
bool CGuiUtility::isDialog(const QWidget *widget)
{
if (!widget) { return false; }
QDialog *mw = qobject_cast<QDialog *>(widget);
const QDialog *mw = qobject_cast<const QDialog *>(widget);
return mw;
}
@@ -789,6 +789,20 @@ namespace BlackGui
return nullptr;
}
QDialog *CGuiUtility::findParentDialog(QWidget *widget, int maxLevel)
{
if (CGuiUtility::isDialog(widget)) { return qobject_cast<QDialog *>(widget); }
int level = 0;
while (widget->parent())
{
level++;
if (level > maxLevel) { return nullptr; }
widget = widget->parentWidget();
if (CGuiUtility::isDialog(widget)) { return qobject_cast<QDialog *>(widget); }
}
return nullptr;
}
void CGuiUtility::setElidedText(QLabel *label, const QString &text, Qt::TextElideMode mode)
{
if (!label) { return; }