mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 20:40:29 +08:00
refs #634, find parent tab widget
This commit is contained in:
@@ -247,6 +247,21 @@ namespace BlackGui
|
|||||||
return Qt::WindowStaysOnTopHint & flags;
|
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)
|
bool CGuiUtility::toggleStayOnTop(QWidget *widget)
|
||||||
{
|
{
|
||||||
if (!widget) { return false; }
|
if (!widget) { return false; }
|
||||||
|
|||||||
@@ -77,6 +77,9 @@ namespace BlackGui
|
|||||||
//! Window on top?
|
//! Window on top?
|
||||||
static bool staysOnTop(QWidget *widget);
|
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:
|
private:
|
||||||
//! Constructor, use static methods only
|
//! Constructor, use static methods only
|
||||||
CGuiUtility() {}
|
CGuiUtility() {}
|
||||||
|
|||||||
Reference in New Issue
Block a user