Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can't assign QScreen to QML Window

Can't assign QScreen to QML Window

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 885 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.
  • W Offline
    W Offline
    wost
    wrote on last edited by
    #1

    Doing some work with Qt now, but I'm stuck trying to figure out how to apply a screen to a QML Window element.

    I'm doing this in the QML file

    screen: app.getMonitor(this.screen);
    

    and this corresponding function in CPP:

    QScreen *getMonitor(QScreen* screen)
    {
    	QList<QScreen*> screens = screen->virtualSiblings();
    	for(auto screen : screens) {
    		qDebug() << "hi";
    		qDebug() << screen->name();
    	}
    	return screens[1];
    }
    

    (The foreach loop is just for debugging purposes).
    This doesn't work though. The program keeps saying:

    Error: Unknown method return type: QScreen*
    

    Have I misunderstood something. What else can I try?

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

      #include <QScreen>

      P.S.
      Range base for loops with non-const Qt containes are not totally efficient, there is the chance you make them detach.

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      0
      • W Offline
        W Offline
        wost
        wrote on last edited by
        #3

        I have done that in the CPP file, but the problems seems to originate from the QML file.

        1 Reply Last reply
        0
        • W Offline
          W Offline
          wost
          wrote on last edited by
          #4

          I figured it out!

          I used a function that set the screen for the window with a void function!

          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