Results 1 to 16 of 16

Thread: how can i customize a QMainWindow

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: how can i customize a QMainWindow

    this is getting to specific.
    We need to see ALL the relevant code.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  2. #2
    Join Date
    Jun 2007
    Posts
    8
    Thanks
    1

    Default Re: how can i customize a QMainWindow

    Quote Originally Posted by high_flyer View Post
    this is getting to specific.
    We need to see ALL the relevant code.
    this->setMouseTracking(true);
    Q3DockWindow * myDockWidget=new Q3DockWindow(this);
    QLabel * myTitle = new QLabel(myDockWidget);
    myTitle->setText("hello this is my Title bar");
    myDockWidget->setWidget(myTitle);
    this->addDockWindow(myDockWidget,Qt:ockTop);
    this->moveDockWindow(myDockWidget,Qt:ockTop);

    QTabWidget * myTb = new QTabWidget(this);

    myPixMap.loadFromData(contact_png,sizeof(contact_p ng),"PNG");
    QIcon myContactIcon(myPixMap);
    myTb->addTab(cvlist,myContactIcon,NULL);

    myPixMap.loadFromData(treasure_png,sizeof(treasure _png),"PNG");
    QIcon myTreasureIcon(myPixMap);

    QAxWidget * object = new QAxWidget("8856F961-340A-11D0-A96B-00C04FD705A2");

    object->dynamicCall("Navigate(const QString&)",treasureWebSite);
    myTb->addTab(object,myTreasureIcon,NULL);

    myPixMap.loadFromData(friend_png,sizeof(friend_png ),"PNG");
    QIcon myFriendIcon(myPixMap);
    QAxWidget * object1 = new QAxWidget("8856F961-340A-11D0-A96B-00C04FD705A2");
    object1->dynamicCall("Navigate(const QString&)",friendWebSite);
    myTb->addTab(object1,myFriendIcon,NULL);
    myTb->setIconSize(QSize(18,20));

    myTb->setTabPosition ( QTabWidget::West);
    myUserInfoButton.setIcon(PsiIconset::instance()->statusPtr(STATUS_OFFLINE)->pixmap());
    myUserInfoButton.setText(" ");
    d->vb_main->addWidget(&myUserInfoButton);
    d->vb_main->addWidget(myTb);


    this is the relevant code, please check up, if some thing wrong with the code!

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: how can i customize a QMainWindow

    and the mouseMoveEvent()?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  4. #4
    Join Date
    Jun 2007
    Posts
    8
    Thanks
    1

    Default Re: how can i customize a QMainWindow

    Quote Originally Posted by high_flyer View Post
    and the mouseMoveEvent()?
    void MainWin::mouseMoveEvent ( QMouseEvent * event ){

    if(this->hasMouseTracking()){
    QMessageBox myMB1;
    myMB1.setText("hasMouseTracking");
    myMB1.exec();
    }else{
    QMessageBox myMB1;
    myMB1.setText("has no hasMouseTracking");
    myMB1.exec();

    }
    return;
    }

    this is mouseMoveEvent function!

  5. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: how can i customize a QMainWindow

    and what is the behaviour? are you getting no message box at all?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  6. #6
    Join Date
    Jun 2007
    Posts
    8
    Thanks
    1

    Default Re: how can i customize a QMainWindow

    Quote Originally Posted by high_flyer View Post
    and what is the behaviour? are you getting no message box at all?
    i move my mouse over the window, no messagebox display, then i move my mouse over the winodw and pressed a mouse key, a messagebox displayed, it say:"hasMouseTracking".

  7. #7
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: how can i customize a QMainWindow

    hmm... strange.
    I can't explain that behaviour from what I see...

    EDIT:
    Wait, this is a main window right?
    So it might be that you have to set the mouse tracking on each element of the main widnow...
    What do you have on your main window when you run this?
    Last edited by high_flyer; 22nd June 2007 at 11:55.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  8. The following user says thank you to high_flyer for this useful post:

    wygggyxtf (23rd June 2007)

  9. #8
    Join Date
    Jun 2007
    Posts
    8
    Thanks
    1

    Default Re: how can i customize a QMainWindow

    Quote Originally Posted by high_flyer View Post
    hmm... strange.
    I can't explain that behaviour from what I see...

    EDIT:
    Wait, this is a main window right?
    So it might be that you have to set the mouse tracking on each element of the main widnow...
    What do you have on your main window when you run this?
    I have resove the trouble, above the code i have put up, there is a paragraph:
    QWidget *center = new QWidget (this, "Central widget");
    setCentralWidget ( center );

    d->vb_main = new QVBoxLayout(center);
    cvlist = new ContactView(center);

    now i add a sentence:
    center->setMouseTracking(true);

    that's OK!

    please put up your code that you customize QMainWindow to me! thanks!

  10. #9
    Join Date
    May 2007
    Posts
    32
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how can i customize a QMainWindow

    Try create message box
    QMessageBox *myMB1 = new QMessageBox(...);
    myMB1->show(); (exec())

    or change something on your widget to see work mousemove or not!
    example
    QLabel *label;
    in your constructor
    label = new QLabel ("ddd");
    label->setGeometry(...);

    and in mouseevent
    label->setCaption("Work");

Similar Threads

  1. QMainWindow modal from non-qt window?
    By hickscorp in forum Qt Programming
    Replies: 3
    Last Post: 21st November 2008, 09:10
  2. QMainWindow resize problem
    By edb in forum Qt Programming
    Replies: 5
    Last Post: 12th January 2007, 10:31
  3. QMainWindow not receiving QResizeEvent
    By brcain in forum Qt Programming
    Replies: 1
    Last Post: 28th September 2006, 06:11
  4. Dynamically Loading a QMainWindow?
    By natron in forum Newbie
    Replies: 10
    Last Post: 21st July 2006, 01:15
  5. Replies: 18
    Last Post: 22nd February 2006, 20:51

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.