Results 1 to 6 of 6

Thread: I think I found a bug about QTableWidget. Is this a bug?

  1. #1
    Join Date
    Mar 2009
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default I think I found a bug about QTableWidget. Is this a bug?

    I made a class which inherits QTableWidget and has resizeEvent().

    #include <QDialog>
    #include <QBoxLayout>
    #include <QApplication>
    #include <QBoxLayout>
    #include <QTableWidget>
    #include <QHeaderView>
    #include <QResizeEvent>
    #include <QDebug>

    class TableBase : public QTableWidget
    {
    public:
    TableBase(QWidget *parent = 0) : QTableWidget(10, 10, parent) {}
    protected:
    void resizeEvent(QResizeEvent *event) {/*...*/}
    };

    class A : public QDialog
    {
    public:
    A();
    private:
    TableBase *table;
    QVBoxLayout *layout;
    };

    A::A()
    {
    table = new TableBase(this);
    layout = new QVBoxLayout(this);
    layout->addWidget(table);
    table->setSpan(0,0,5,1);
    }

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    A a;
    a.show();
    return app.exec();
    }

    When I executed the program, some of rows and columns were hidden because of small dialog box. So I resized the window, but I found following problems.
    First, the horizontal header and the vertical header weren't redrawn.
    Second, the program crashed with following assertion failure.
    ASSERT: "i >= 0 && i < size()" in file ../../include/QtCore/../../src/corelib/tools/qbitarray.h, line 118

    When I resized the window slightly and then resized one section, the headers were redrawn. Doing it repeatedly was not cause the program to crash.

    Qt version is 4.5-rc1

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: I think I found a bug about QTableWidget. Is this a bug?

    did you implement void resizeEvent(QResizeEvent *event) {/*...*/}?
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Mar 2009
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: I think I found a bug about QTableWidget. Is this a bug?

    Yes.
    It resizes rows and columns size based on the widget size.
    But the program crash regardless of function's implementation.

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: I think I found a bug about QTableWidget. Is this a bug?

    comment you code and insert this one void resizeEvent(QResizeEvent *event) { QTableWidget::resizeEvent(event); } and tell if crash still appears.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. The following user says thank you to spirit for this useful post:

    John Smith (2nd March 2009)

  6. #5
    Join Date
    Mar 2009
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: I think I found a bug about QTableWidget. Is this a bug?

    Now it works properly.
    Thanks very much.

  7. #6
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: I think I found a bug about QTableWidget. Is this a bug?

    so, this means that a bug in your code.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. Visual Studio 2005 Express
    By Muzz in forum Installation and Deployment
    Replies: 22
    Last Post: 6th November 2008, 06:21
  2. Program crashes with assert error in xcb_lock.c
    By Valheru in forum Qt Programming
    Replies: 3
    Last Post: 18th November 2007, 19:56
  3. KDE 3.5.0 crash while opening project
    By MarkoSan in forum KDE Forum
    Replies: 2
    Last Post: 19th October 2007, 16:21
  4. QTableWidget editing question
    By Trasmeister in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 18:46
  5. Replies: 6
    Last Post: 5th March 2006, 21:05

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.