mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-04 00:45:46 +08:00
Ref T554, find parent dialog
This commit is contained in:
committed by
Mat Sutcliffe
parent
11785c434d
commit
db0df3b00e
@@ -634,4 +634,15 @@ namespace BlackGui
|
|||||||
|
|
||||||
return QStringLiteral("<img src=\"%1\" height=%2>").arg(p, QString::number(height));
|
return QStringLiteral("<img src=\"%1\" height=%2>").arg(p, QString::number(height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDialog *CGuiUtility::findParentDialog(QWidget *widget)
|
||||||
|
{
|
||||||
|
if (CGuiUtility::isDialog(widget)) { return qobject_cast<QDialog *>(widget); }
|
||||||
|
while (widget->parent())
|
||||||
|
{
|
||||||
|
widget = widget->parentWidget();
|
||||||
|
if (CGuiUtility::isDialog(widget)) { return qobject_cast<QDialog *>(widget); }
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class QLayout;
|
|||||||
class QMimeData;
|
class QMimeData;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QTabWidget;
|
class QTabWidget;
|
||||||
|
class QDialog;
|
||||||
class QGraphicsOpacityEffect;
|
class QGraphicsOpacityEffect;
|
||||||
class QAbstractItemModel;
|
class QAbstractItemModel;
|
||||||
|
|
||||||
@@ -233,6 +234,9 @@ namespace BlackGui
|
|||||||
//! CIcon as simple HTML image code segment
|
//! CIcon as simple HTML image code segment
|
||||||
static QString asSimpleHtmlImageHeight(const BlackMisc::CIcon &icon, int height = -1);
|
static QString asSimpleHtmlImageHeight(const BlackMisc::CIcon &icon, int height = -1);
|
||||||
|
|
||||||
|
//! Find parent dialog if there is any, otherwise null
|
||||||
|
static QDialog *findParentDialog(QWidget *widget);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! No constructor, use static functions only
|
//! No constructor, use static functions only
|
||||||
CGuiUtility() {}
|
CGuiUtility() {}
|
||||||
|
|||||||
Reference in New Issue
Block a user