mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refs #634, find parent tab widget
This commit is contained in:
@@ -247,6 +247,21 @@ namespace BlackGui
|
||||
return Qt::WindowStaysOnTopHint & flags;
|
||||
}
|
||||
|
||||
QTabWidget *CGuiUtility::parentTabWidget(QWidget *widget, int maxLevels)
|
||||
{
|
||||
int level = 0;
|
||||
do
|
||||
{
|
||||
widget = widget->parentWidget();
|
||||
if (!widget) { return nullptr; }
|
||||
QTabWidget *tw = qobject_cast<QTabWidget *>(widget);
|
||||
if (tw) { return tw; }
|
||||
level++;
|
||||
}
|
||||
while (level < maxLevels);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CGuiUtility::toggleStayOnTop(QWidget *widget)
|
||||
{
|
||||
if (!widget) { return false; }
|
||||
|
||||
@@ -77,6 +77,9 @@ namespace BlackGui
|
||||
//! Window on top?
|
||||
static bool staysOnTop(QWidget *widget);
|
||||
|
||||
//! From a given widget try to find parent tab widget (where widget is embedded)
|
||||
static QTabWidget *parentTabWidget(QWidget *widget, int maxLevels = 5);
|
||||
|
||||
private:
|
||||
//! Constructor, use static methods only
|
||||
CGuiUtility() {}
|
||||
|
||||
Reference in New Issue
Block a user