How to create two non-classical windows in qml?



  • hi. i created a new QtQuick project. now, in main.qml file i made a window, for istance:

    Rectangle{ width: 200; height: 100; ... }

    how do i create another window, separated from the last one? how do i delete the "x" (close), the "_" to minimize and the other one from the window?



  • I am quite a newbie, but I think that Rectangle will draw a Rectangle, not a window. the window is created in your main.c file, if you have one! The main window often (and maybe always) is a QDeclarativeView.
    So to get rid of the system controls (X and _ thing), you can play with the windows style flags, or hints.
    I personnally used this in my main.c file:

    @QDeclarativeView view;
    view.setWindowFlags(Qt::FramelessWindowHint);@

    And with these lines I have no window border and therefore no window system controls.
    Hope this helps a bit,
    Bill



  • nothing, but thank you for interest! ;)



  • Currently there is no support for multiple windows in pure QML. To create multiple windows, you'll have to create multiple top-level QDeclarativeViews (or another widget).



  • [code]#include <QtGui/QApplication>
    #include "qmlapplicationviewer.h"
    #include <QLabel>

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    QmlApplicationViewer viewer;
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    viewer.setMainQmlFile&#40;QLatin1String("qml/file/main.qml"&#41;);
    viewer.showExpanded();
    viewer.setWindowTitle("title");
    viewer.move(600,20);
    QDeclarativeView view;
    view.setWindowFlags(Qt::FramelessWindowHint);
    
    return app.exec();
    

    }
    [/code]
    this one does not start...



  • You didn't call show on the view widget. And even then, you haven't set a QML file for it to load.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.