Results 1 to 4 of 4

Thread: QMenu

  1. #1
    Join Date
    Jul 2012
    Posts
    123
    Thanks
    4
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QMenu

    Hi,
    I have problem with QMenu :
    When I delete file where i save history and bookmarks it work fine
    WebBrowser2.png
    but after time it look so:
    WebBrowser.png
    Save method:
    Qt Code:
    1. QFile DataFile("Data.ini");
    2. if(!DataFile.open(QIODevice::WriteOnly))
    3. {
    4. return;
    5. }
    6. DataFile.resize(0);
    7. QDataStream out(&DataFile);
    8. out.setVersion(QDataStream::Qt_4_8);
    9. out << allHistoryAction << bookmarks->actions();
    10. qDebug() << "save data";
    11. DataFile.flush();
    12. DataFile.close();
    To copy to clipboard, switch view to plain text mode 
    load method:
    Qt Code:
    1. QFile DataFile("Data.ini");
    2. if(!DataFile.open(QIODevice::ReadOnly))
    3. {
    4. return;
    5. }
    6. QDataStream in(&DataFile);
    7. in.setVersion(QDataStream::Qt_4_8);
    8. QList<QAction*> actions;
    9. in >> allHistoryAction >> actions;
    10. bookmarks->clear();
    11. bookmarks->addActions(actions);
    12. qDebug() << "loading data";
    13. history->clear();
    14. history->addActions(allHistoryAction);
    15. DataFile.close();
    16. foreach (QAction *action, allHistoryAction)
    17. {
    18. connect(action, SIGNAL(triggered()), this, SLOT(HistoryAction()));
    19. }
    20. foreach (QAction *action, actions)
    21. {
    22. connect(action, SIGNAL(triggered()), this, SLOT(HistoryAction()));
    23. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMenu

    I dont understand what is wrong.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Jul 2012
    Posts
    123
    Thanks
    4
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMenu

    look at second picture the menu show at top. But i solved it

  4. #4
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMenu

    oh, right. so how did you solve it?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. QMenu mac
    By migel in forum Newbie
    Replies: 1
    Last Post: 26th September 2011, 19:06
  2. Qmenu
    By deeee in forum Qt Programming
    Replies: 3
    Last Post: 27th May 2010, 01:27
  3. QMenu
    By khcbabu in forum Qt Programming
    Replies: 2
    Last Post: 22nd October 2008, 14:08
  4. QMenu
    By toki83 in forum Qt Programming
    Replies: 2
    Last Post: 22nd March 2008, 11:17
  5. QMenu Help pls
    By munna in forum Newbie
    Replies: 2
    Last Post: 19th March 2006, 15:36

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.