Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Add my Custom Widgets in Qt app through VS 2008
QtWS25 Last Chance

Add my Custom Widgets in Qt app through VS 2008

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sayan Bera
    wrote on last edited by
    #1

    created a Qt app project in VS. I opened the .ui file in Qt Designer. I added "QMeter":http://qt-apps.org/content/show.php?content=72850#c420743 widget (drag n drop). added the necessary .h,.cpp, .lib, .dll files and build->successful, but while i run the output window is not showing up. Even if i add the widget in the layout through code...like
    @
    test.h

    class TestMeter : public QWidget
    {
    Q_OBJECT

    public:
    TestMeter(QWidget *parent = 0);
    ~TestMeter();
    QVBoxLayout *layout;
    QMeter *meter;

    private:
    Ui::TestMeter ui;
    };
    test.cpp

    TestMeter::TestMeter(QWidget *parent)
    : QWidget(parent)
    {
    ui.setupUi(this);
    layout = new QVBoxLayout(this);
    meter = new QMeter(this); //<----programs crashes from here
    layout->addWidget(meter, 0 ,Qt::AlignRight);
    }
    @

    this problem is only with my installed widgets,Arthur Widgets[Demo] and Display Widgets[Examples]. This process is working fine with QDial, QDateTime, QLabel, QSpinBox etc...

    Edit: Please use @ tags around code sections to enable code formatting; Andre

    Regards
    Sayan

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      I don't know why it crashes, but I spottet another erorr: Your widget TestMeter already has a layout from ui.setupUi(). You would add another toplevel layout in line 25. Do not do that!

      Regarding the crash, it's hard to say what's the cause. What does the stack trace in the debugger say?

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Sayan Bera
        wrote on last edited by
        #3

        Thanks for our reply. yeah, that's a fundamental mistake. But i figured out the another reason for the problem.
        I build these widgets in release mode(in the .pro file), but i was building my app in debug mode.
        So when changed it in debug mode its working fine(ie by creating an object of the Widget ), but in debug mode it can't be installed in Qt Designer!!!

        Regards
        Sayan

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved