Home · Modules · Classes · Namespaces · Functions

QxtWindowSystem Class Reference
[QxtGui module]

The QxtWindowSystem class provides means for accessing native windows. More...

    #include <QxtWindowSystem>

Static Public Members


Detailed Description

The QxtWindowSystem class provides means for accessing native windows.

Note: The underlying window system might or might not allow one to alter states of windows belonging to other processes.

Warning: QxtWindowSystem is portable in principle, but be careful while using it since you are probably about to do something non-portable.

Advanced example usage:

    class NativeWindow : public QWidget {
        public:
            NativeWindow(WId wid) {
                QWidget::create(wid, false, false); // window, initializeWindow, destroyOldWindow
            }
            ~NativeWindow() {
                QWidget::destroy(false, false); // destroyWindow, destroySubWindows
            }
    };
    WindowList windows = QxtWindowSystem::windows();
    QStringList titles = QxtWindowSystem::windowTitles();
    bool ok = false;
    QString title = QInputDialog::getItem(0, "Choose Window", "Choose a window to be hid:", titles, 0, false, &ok);
    if (ok)
    {
        int index = titles.indexOf(title);
        if (index != -1)
        {
            NativeWindow window(windows.at(index));
            window.hide();
        }
    }

Note: Currently supported platforms are X11 and Windows.


Member Function Documentation

WId QxtWindowSystem::activeWindow ()   [static]

Returns the native window system identifier of the active window if any.

See also QApplication::activeWindow().

WId QxtWindowSystem::findWindow ( const QString & title )   [static]

Returns the native window system identifier of the window if any with given title.

Example usage:

    WId wid = QxtWindowSystem::findWindow("Mail - Kontact");
    QPixmap screenshot = QPixmap::grabWindow(wid);

See also QWidget::find().

uint QxtWindowSystem::idleTime ()   [static]

Returns the system "idle time" ie. the time since last user input in milliseconds.

WId QxtWindowSystem::windowAt ( const QPoint & pos )   [static]

Returns the native window system identifier of the window if any at pos.

See also QApplication::widgetAt().

QRect QxtWindowSystem::windowGeometry ( WId window )   [static]

Returns the geometry of the native window.

See also QWidget::frameGeometry().

QString QxtWindowSystem::windowTitle ( WId window )   [static]

Returns the title of the native window.

See also QWidget::windowTitle() and windowTitles().

QStringList QxtWindowSystem::windowTitles ()   [static]

Returns a list of native window titles.

See also QWidget::windowTitle(), windowTitle(), and windows().

WindowList QxtWindowSystem::windows ()   [static]

Returns the list of native window system identifiers.

See also QApplication::topLevelWidgets() and windowTitles().


Copyright © 2007-2010 Qxt Foundation
Qxt 0.6.1