Results 1 to 9 of 9

Thread: load a Window

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    9
    Thanked 29 Times in 29 Posts

    Default Re: load a Window

    Quote Originally Posted by sabeesh View Post
    Hi,
    I have tree in my program. The nodes in the trees are 'Camera 1', 'Camera 2', 'Camera 3', etc. When I double click on the node 'Camera 1' then a window is created named as 'Camera_1', when I double click on nod 'Camera 2' then a nother window is load named as 'Camera_2' like that.....
    My problem is that, When I double click on a node, 'Camera 1' at first time, then a new window is created and load name of that window is 'Camera_1' and when I double click again on that node then, another window is created named as 'Camere_1'. I want to block this. If one window is loaded, then when i double click on the same node, I need to show the old window no need to create a new one, if it is created early. ( check the name in memory)....
    Please help me
    Looks like you just repeated your question again. Seems like my suggestion would work. Is there something specific about it you don't understand?
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  2. #2
    Join Date
    Jul 2007
    Posts
    166
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    25
    Thanked 1 Time in 1 Post

    Default Re: load a Window

    Hi,
    Can you explain how can i check, if the associated window-pointer is NULL?

  3. #3
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    9
    Thanked 29 Times in 29 Posts

    Default Re: load a Window

    Qt Code:
    1. if (pointer == NULL) {
    2. ...
    3. }
    To copy to clipboard, switch view to plain text mode 
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

  4. #4
    Join Date
    Jul 2007
    Posts
    166
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    25
    Thanked 1 Time in 1 Post

    Default Re: load a Window

    Hi,
    This is my function, When I double click on a node at that time this function is work,

    void CreateCamWindow( QString Name, QString Title ){

    CamPanel *Panel = new CamPanel;
    Panel->setObjectName(Name);
    Panel->setGeometry(QRect(161, 14, 250, 200));
    Panel->setWindowTitle(Title);
    Panel->show();
    }

    Here How can I check it? In the variable Name the value come as 'Camera_1'. Then, how can I check the window is loaded?

  5. #5
    Join Date
    Mar 2006
    Location
    The Netherlands
    Posts
    300
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    9
    Thanked 29 Times in 29 Posts

    Default Re: load a Window

    Ok, so you say the names are unique. You could do it this way:

    Qt Code:
    1. void CreateCamWindow( QString Name, QString Title ) {
    2. static QMap<QString, CamPanel*> panels;
    3.  
    4. if (!panels.contains(Name)) {
    5. panels.insert(Name, new CamPanel);
    6. }
    7. panels[Name]->setObjectName(Name);
    8. panels[Name]->setGeometry(QRect(161, 14, 250, 200));
    9. panels[Name]->setWindowTitle(Title);
    10. panels[Name]->show();
    11. }
    To copy to clipboard, switch view to plain text mode 

    But that's only because I have only seen that one function. There are more elegant ways to do the same.
    "The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry

Similar Threads

  1. Replies: 4
    Last Post: 4th June 2007, 12:07
  2. Regarding drawing on Transparent Window
    By Shalabh in forum Qt Programming
    Replies: 3
    Last Post: 31st May 2007, 10:32
  3. Independant window in an application
    By titoo in forum Qt Programming
    Replies: 4
    Last Post: 28th February 2007, 11:07
  4. move parent window to the front.
    By hvengel in forum Qt Programming
    Replies: 4
    Last Post: 2nd February 2007, 08:41
  5. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 10:21

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
  •  
Qt is a trademark of The Qt Company.