Results 1 to 2 of 2

Thread: probl;em in using QTabWidget

  1. #1
    Join Date
    Jun 2009
    Posts
    1
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default probl;em in using QTabWidget

    hi ,
    I am using a QTabWidget to display 4 dialogs in 4 tab items. For that i have implementes my Dialogs using QHBoxLayout and QVBoxLayout. I tried with out using layout. but then the dialogs were not displayed. Since i am using Layout, i cannot use setGeometry() API to the items contained in the dialogs. But now there is another problem. When the dialogs are displayed , items are going out of the screen. The size of the screen i am using is 320H/240H. The items are going out horizontally in the right side of the screen.
    Qt Code:
    1. ProxysettingWindow()
    2. resize(240,320);
    3. m_httpProxy = new QLabel("HttpProxy", this);
    4. m_proxyEdit = new QLineEdit(settings.value("HttpHost").toString(), this) ;
    5. m_httpPort = new QLabel("Httpport", this);
    6. m_portEdit = new QLineEdit(settings.value("Httpport").toString(), this) ;
    7. m_userName = new QLabel("UserName", this);
    8. m_nameEdit = new QLineEdit(settings.value("UserName").toString(), this) ;
    9. m_userpassword = new QLabel("Pasword", this);
    10. m_passWordEdit = new QLineEdit(settings.value("Password").toString(), this) ;
    11.  
    12.  
    13. QVBoxLayout *mainLayout = new QVBoxLayout();
    14. QHBoxLayout *proxyLayout = new QHBoxLayout;
    15. QHBoxLayout *portLayout = new QHBoxLayout;
    16. QHBoxLayout *userNameLayout = new QHBoxLayout;
    17. QHBoxLayout *passLayout = new QHBoxLayout;
    18. proxyLayout->addWidget(m_httpProxy);
    19. proxyLayout->addWidget(m_proxyEdit);
    20. portLayout->addWidget(m_httpPort);
    21. portLayout->addWidget(m_portEdit);
    22. userNameLayout->addWidget(m_userName);
    23. userNameLayout->addWidget(m_nameEdit);
    24. passLayout->addWidget(m_userpassword);
    25. passLayout->addWidget(m_passWordEdit);
    26. mainLayout->addLayout(proxyLayout);
    27. mainLayout->addLayout(portLayout);
    28. mainLayout->addLayout(userNameLayout);
    29. mainLayout->addLayout(passLayout);
    30. mainLayout->addLayout(buttonLayout);
    31. setLayout(mainLayout);
    32. }
    To copy to clipboard, switch view to plain text mode 
    this is the code i have written in the const of the dialog

    Qt Code:
    1. m_tabbar = new QTabWidget(this);
    2. m_proxyWindow = new ProxysettingWindow(this);
    3. m_tabbar->addTab(m_proxyWindow, "proxy");
    To copy to clipboard, switch view to plain text mode 
    this is how i created the Tabwidget

    If anyone had faced such kind of problem, please provide some pointers.

    Regards
    Kulajit das
    Last edited by jpn; 9th June 2009 at 19:37. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: probl;em in using QTabWidget

    Well don't use resize(240,320) this is may be too narrow. better use adjustSize()/showMaximized() to get the best geometry for the widget. may be your font is to big?

    ((EDIT: I see your screen is only 240x320...))

    Further it is normally not necessary to have private member variables for a Label etc, since you don't want to change the text at any point...


    ... and code tags have [ ] and not < >!

    EDIT2: If you can't scale your font size etc down, you can use QSrollArea to be able to scroll.
    Last edited by Lykurg; 9th June 2009 at 15:43.

Similar Threads

  1. QTabWidget problem
    By alan lenton in forum Qt Programming
    Replies: 5
    Last Post: 25th July 2016, 16:16
  2. QTabWidget clicking problems after addTab()
    By DonSam in forum Qt Programming
    Replies: 0
    Last Post: 14th October 2008, 08:28
  3. StyleSheet Problem with QTabWidget
    By December in forum Qt Programming
    Replies: 1
    Last Post: 8th August 2007, 22:16
  4. QTabWidget Parenting Problem
    By mclark in forum Newbie
    Replies: 4
    Last Post: 18th January 2007, 15:20
  5. QTabWidget - problem with resizing
    By moowy in forum Qt Programming
    Replies: 5
    Last Post: 14th September 2006, 14:06

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.