Results 1 to 10 of 10

Thread: QML Desktop Components weird Menu ...

  1. #1
    Join Date
    Dec 2011
    Posts
    21
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QML Desktop Components weird Menu ...

    Qt Code:
    1. import QtQuick 1.1
    2. import QtDesktop 0.1
    3.  
    4. Window {
    5. width: 600
    6. height: 400
    7.  
    8. MenuBar{
    9. Menu {
    10. text: "It does"
    11.  
    12. MenuItem {
    13. text:"not appear!!"
    14. }
    15. }
    16. }
    17.  
    18. Window{
    19. id: window1
    20. width: 600
    21. height: 400
    22. MenuBar{
    23. Menu {
    24. text: "But it"
    25.  
    26. MenuItem {
    27. text:"does!!"
    28. }
    29. }
    30. }
    31. ToolBar {
    32. ToolButton {
    33. text: "Play"
    34. anchors.verticalCenter: parent.verticalCenter
    35. onClicked: window1.visible = !window1.visible
    36. }
    37. }
    38. }
    39.  
    40. ToolBar {
    41. id: toolbar
    42. anchors.right: parent.right
    43. anchors.left: parent.left
    44.  
    45. ToolButton {
    46. id: toolPlay
    47. text: "Play"
    48. anchors.left: toolDownload.right
    49. anchors.verticalCenter: parent.verticalCenter
    50. onClicked: window1.visible = !window1.visible
    51. }
    52. }
    53. }
    To copy to clipboard, switch view to plain text mode 

    Anyone knows why menu in main windows does not appear, but menu in child window magically appears?
    I'm totally confused with this behavior.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QML Desktop Components weird Menu ...

    Does it appear if you completely remove the child window?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Dec 2011
    Posts
    21
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QML Desktop Components weird Menu ...

    No, it doesn't.
    I don't want to use child window, but only there menubar appears ....

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QML Desktop Components weird Menu ...

    Which platform are you using?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Dec 2011
    Posts
    21
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QML Desktop Components weird Menu ...

    Linux X11, qt 4.8.4

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QML Desktop Components weird Menu ...

    Set the "visible" property of the window object to "true".
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Dec 2011
    Posts
    21
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QML Desktop Components weird Menu ...

    Qt Code:
    1. Window {
    2. width: 600
    3. height: 400
    4. visible: true
    5.  
    6. MenuBar{
    7. Menu {
    8. text: "File"
    9.  
    10. MenuItem {
    11. text:"file"
    12. }
    13. }
    14. }
    15.  
    16. Window{
    17. id: window1
    18. width: 600
    19. height: 400
    20. MenuBar{
    To copy to clipboard, switch view to plain text mode 

    Then child window appears immediately, but still menu appears in the middle of nowhere.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QML Desktop Components weird Menu ...

    This code works just fine:

    javascript Code:
    1. import QtQuick 1.1
    2. import QtDesktop 0.1
    3.  
    4. Window {
    5. width: 600
    6. height: 400
    7. visible: true
    8.  
    9. MenuBar{
    10. Menu {
    11. text: "It does"
    12.  
    13. MenuItem {
    14. text:"not appear!!"
    15. }
    16. }
    17. }
    18. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Dec 2011
    Posts
    21
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QML Desktop Components weird Menu ...

    But then two windows appears.

    Maybe it's something wrong with my c++ launcher.
    Qt Code:
    1. #include <QApplication>
    2. #include "qmlapplicationviewer.h"
    3.  
    4. Q_DECL_EXPORT int main(int argc, char *argv[])
    5. {
    6. QScopedPointer<QApplication> app(createApplication(argc, argv));
    7.  
    8. QmlApplicationViewer viewer;
    9. viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    10. viewer.setMainQmlFile(QLatin1String("test.qml"));
    11. viewer.showExpanded();
    12.  
    13. return app->exec();
    14. }
    To copy to clipboard, switch view to plain text mode 

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QML Desktop Components weird Menu ...

    One window is your viewer, another is the window created by "Window". If you don't want the viewer then use QDeclarativeEngine or don't show the viewer.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. The following user says thank you to wysota for this useful post:

    travick (23rd January 2013)

Similar Threads

  1. Using QML Components for the Desktop with PySide
    By hansotronic in forum Qt Quick
    Replies: 2
    Last Post: 30th October 2012, 00:49
  2. Replies: 3
    Last Post: 13th July 2012, 09:39
  3. QtCreator and Desktop Components
    By Splashy in forum Qt Quick
    Replies: 6
    Last Post: 24th March 2012, 00:43
  4. Replies: 2
    Last Post: 16th March 2012, 14:22
  5. Replies: 0
    Last Post: 26th February 2012, 16:48

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.