Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Custom QQuickWindow

Custom QQuickWindow

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 991 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Astraya
    wrote on last edited by Astraya
    #1

    Hello,

    I'm new in QML. I try to create a custom version of QQuickWindow.
    I'm started by creating the C++ class simply like this:

    class MainWindow : public QQuickWindow
    {
    	Q_OBJECT
    };
    

    Then in the main I,m registering the type and creating the component:

    qmlRegisterType<MainWindow>("hud.gui",1,0,"MainWindow");
    QQmlApplicationEngine engine;
    engine.load(QUrl("qrc:/qml/Application"));
    

    Here is the Application.qml:

    import QtQuick.Window 2.2
    import hud.gui 1.0
    
    MainWindow {
    	x: 100
    	y: 100
    	width: 100
    	height: 100
    	visible: true
    	visibility: Window.FullScreen
    }
    

    I have an error message about visibility property :

    "MainWindow.visibility" is not available in hud.gui 1.0.
    

    I saw that visiblity have a revision number. What i don't understand is why other property works, but this one don't? My first answer is the revision number but how can I can make it work with my own class?

    Thank a lot

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Astraya
      wrote on last edited by
      #2

      Ok, I found a solutions in documentation. I just need to register base class version to use for my uri.

      qmlRegisterRevision<QWindow, 1>("hud.gui", 1, 0);
      

      I should register the revision of the property "visibility" to be able to use it in my own QML element.

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved