Results 1 to 4 of 4

Thread: setup ui doesnt work or any of my mistake??

  1. #1
    Join Date
    Mar 2011
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1
    Thanked 3 Times in 1 Post

    Default setup ui doesnt work or any of my mistake??

    hi , i have a program , in which i made a menu ,called tools and connected the action to a slot which doesnt work .......


    here is my project please chk this out.............settings.uimainwindow.cppgui.cppgui.hsettings.cpp

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanks
    62
    Thanked 260 Times in 246 Posts

    Default Re: setup ui doesnt work or any of my mistake??

    Is void MainWindow::execShowSettings() declared as a slot in the MainWindow class declaration?
    //i assume that execShowSettings() is the slot that doesn't get called...

    Also that you posted code that is not relevant for your problem (like settings.uiand some other Gui class), wouldn't be easier for all of us if you post only the code that is not working and tell us more information about how is not working? (like it give error at compile or at run-time, or the function/slot is not called, Creator display warnings, etc)

  3. #3
    Join Date
    Mar 2011
    Posts
    24
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1
    Thanked 3 Times in 1 Post

    Default Re: setup ui doesnt work or any of my mistake??

    ok I have a private slot called execShowSettings().

    i connected a action to the execShowSettings().

    the execShowSettings() goes like this.

    SettingsDialog dialog;
    dialog.show();


    the SettingsDialog class is defined in settings.h like this.


    Qt Code:
    1. #ifndef SETTINGS_H
    2. #define SETTINGS_H
    3.  
    4. #include <QtCore>
    5. #include <QtGui>
    6. #include "ui_settings.h"
    7.  
    8. #include "defs.h"
    9. #include "gui.h"
    10.  
    11. class SettingsDialog : public Gui::Dialog , private Ui::Niranjan
    12. {
    13. Q_OBJECT
    14.  
    15.  
    16. Gui::EngineButton *settingsButton;
    17.  
    18.  
    19.  
    20. public:
    21. SettingsDialog(QWidget *parent = 0);
    22. virtual ~SettingsDialog() {}
    23.  
    24.  
    25. };
    26.  
    27.  
    28. #endif // SETTINGS_H
    To copy to clipboard, switch view to plain text mode 

    the settings.cpp goes like this.....
    Qt Code:
    1. #include "settings.h"
    2.  
    3.  
    4. SettingsDialog::SettingsDialog(QWidget *parent) : Gui::Dialog(Gui::Dialog::CenterOfScreen,parent)
    5. {
    6. setupUi(this);
    7. setWindowTitle(qApp->applicationName() + " " + qApp->applicationVersion() +
    8. " - " + tr("Settings") + "[*]");
    9.  
    10.  
    11. settingsButton = new Gui::EngineButton(tr("Settings"),sbToolbar);
    12. settingsButton->setChecked(true);
    13.  
    14.  
    15. sbToolbar->setExclusive(true);
    16. sbToolbar->insertButton(0,settingsButton,0);
    17. connect(sbToolbar,SIGNAL(buttonClicked(int)),swMain,SLOT(setCurrentIndex(int)));
    18.  
    19.  
    20. swMain->setCurrentIndex(0);
    21. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanks
    62
    Thanked 260 Times in 246 Posts

    Default Re: setup ui doesnt work or any of my mistake??

    And are there any errors? If yes are they at compile, or at run-time.
    Qt Creator display any warnings about the signal/slot in Application output?
    How exactly is not working?

    LE: the problem is that you don't show the Settings dialog, here:
    Qt Code:
    1. void MainWindow::execShowSettings()
    2. {
    3.  
    4. SettingsDialog dialog; //you just create the object...
    5.  
    6. //you need to call exec() for a modal dialog
    7. dialog.exec();
    8.  
    9. //or show() for non-modal, but for non-modal you need to create the object on the heap (using pointer and new)
    10. }
    To copy to clipboard, switch view to plain text mode 
    See this FAQ
    Last edited by Zlatomir; 27th March 2011 at 15:35.

Similar Threads

  1. Qwt Tex Text Doesnt work for me
    By gbmtoday in forum Qwt
    Replies: 1
    Last Post: 21st November 2010, 20:48
  2. connect doesnt work
    By john_god in forum Newbie
    Replies: 4
    Last Post: 23rd November 2008, 10:36
  3. ldapsearch doesnt work.
    By shamik in forum General Discussion
    Replies: 0
    Last Post: 3rd April 2008, 08:25
  4. QFtp...doesnt seems to work ....!!!
    By salmanmanekia in forum Qt Programming
    Replies: 10
    Last Post: 25th February 2008, 09:30
  5. How come this doesnt work?
    By ShaChris23 in forum Newbie
    Replies: 8
    Last Post: 16th June 2007, 05:43

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.