Results 1 to 7 of 7

Thread: Q3ListView expand arrows incorrect on Mac in Qt 4.8

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2011
    Posts
    37
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    Default Q3ListView expand arrows incorrect on Mac in Qt 4.8

    The expand/collapse arrows for Q3ListView look wrong on Mac OS X. See attached Windows and Mac screenshots.

    listview_windows.png

    listview_mac.png

    In the Mac screenshot the expand/collapse arrows are partly obscured by the Q3ListViewItems. It looks quite wrong. The problem also exists in Qt 4.7, but not in Qt 4.2 (I haven't tried releases in between).

    Here is the code to replicate the problem:

    Qt Code:
    1. #include <QApplication>
    2. #include <Q3ListView>
    3. int
    4. main( int argc, char* argv[] )
    5. {
    6. QApplication app( argc, argv );
    7.  
    8. Q3ListView w;
    9. w.setRootIsDecorated( true );
    10. w.addColumn( "col1" );
    11. w.show();
    12.  
    13. Q3ListViewItem* item1 = new Q3ListViewItem( &w, "item1" );
    14. Q3ListViewItem* item2 = new Q3ListViewItem( item1, "item2" );
    15. Q3ListViewItem* item3 = new Q3ListViewItem( item2, "item3" );
    16.  
    17. QObject::connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) );
    18.  
    19. return app.exec();
    20. }
    To copy to clipboard, switch view to plain text mode 

    Surely I can't be the only person using Q3ListView on Mac? I have searched, but can't find an answer. Any ideas?

  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: Q3ListView expand arrows incorrect on Mac in Qt 4.8

    Quote Originally Posted by AndyBrice View Post
    Surely I can't be the only person using Q3ListView on Mac?
    OT, but I hope you are! Qt5 is coming soon, Qt4 is out for years and you still deal with Qt3? Is that a new application?


    On my mac it also looks corrupted. You can try to write a custom delegate to adjust the position.

  3. #3
    Join Date
    Sep 2011
    Posts
    37
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    Default Re: Q3ListView expand arrows incorrect on Mac in Qt 4.8

    The application is ~7 years old and it still has some Qt3 classes.

  4. #4
    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: Q3ListView expand arrows incorrect on Mac in Qt 4.8

    Did I wrote delegate... This adjust the arrow of item 2. Not nice, but a quick workaround.
    Qt Code:
    1. #include <QApplication>
    2. #include <Q3ListView>
    3. #include <Qt3Support>
    4.  
    5.  
    6. class A : public Q3ListViewItem {
    7. public:
    8. A(Q3ListView *parent, const QString &label1) : Q3ListViewItem(parent, label1) {}
    9. void paintBranches(QPainter *p, const QColorGroup &cg, int w, int y, int h) {
    10. Q3ListViewItem::paintBranches(p, cg, w-7, y, h);
    11. }
    12. };
    13.  
    14.  
    15. int main( int argc, char* argv[] )
    16. {
    17. QApplication app( argc, argv );
    18.  
    19. Q3ListView w;
    20. w.setRootIsDecorated( true );
    21. w.addColumn( "col1" );
    22. w.show();
    23.  
    24. A* item1 = new A( &w, "item1" );
    25. Q3ListViewItem* item2 = new Q3ListViewItem( item1, "item2" );
    26. Q3ListViewItem* item3 = new Q3ListViewItem( item2, "item3" );
    27.  
    28. QObject::connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) );
    29.  
    30. return app.exec();
    31. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Values of a Q3ListView
    By martisho in forum Qt Programming
    Replies: 0
    Last Post: 13th November 2009, 13:21
  2. How to use Q3Listview in Qt-4.2.1
    By grsandeep85 in forum Qt Programming
    Replies: 3
    Last Post: 17th September 2009, 07:04
  3. Q3ListView
    By grsandeep85 in forum Qt Programming
    Replies: 0
    Last Post: 31st August 2009, 12:40
  4. Q3ListView not being populated.
    By user_mail07 in forum Qt Programming
    Replies: 7
    Last Post: 19th March 2007, 15:54
  5. Q3ListView
    By kemp in forum Qt Programming
    Replies: 6
    Last Post: 9th October 2006, 08:58

Tags for this Thread

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.