Results 1 to 12 of 12

Thread: Problems with QPainter

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    694
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    59
    Thanked 1 Time in 1 Post

    Default Re: Problems with QPainter

    Quote Originally Posted by wysota View Post
    Great. Try to fit it into those 30 lines. You don't even have to paint anything as you are getting errors before any painting is done - just initialize the painter.
    Dear wysota. I solved the problem that gave the error. Is the line:
    Qt Code:
    1. resize(wave->getSamples(), 200);
    To copy to clipboard, switch view to plain text mode 
    This did that the waveWidget was expanded ( in the x direction ) more that the mainWindow because the number of audio samples I have is ~10E6.
    So I tried to attach the waveWidget to a QScrollArea without success so:

    Qt Code:
    1. CentralWidget::CentralWidget( QWidget* parent /* = 0 */ )
    2. : QWidget(parent),
    3. mp_vBox( 0 ),
    4. mp_wave( 0 )
    5. {
    6. /* vertical layout */
    7. mp_vBox = new QVBoxLayout( this );
    8. /* scroll area */
    9. scrollArea = new QScrollArea();
    10. /* waveform visualizer */
    11. mp_wave = new WaveWidget( this );
    12. scrollArea->setWidget( mp_wave );
    13. mp_vBox->addWidget( scrollArea );
    14. setLayout( mp_vBox );
    15. }
    To copy to clipboard, switch view to plain text mode 
    This did that now I can't see the waveWidget.
    Where my code is wrong?

    Best Regards
    Franco Amato

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Problems with QPainter

    Call QScrollArea::setWidgetResizable() with true as the parameter and see if it helps. In general you should reimplement sizeHint() for your wave widget.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. how to get QPainter object for QLabel
    By bpatel in forum Newbie
    Replies: 7
    Last Post: 28th May 2010, 10:30
  2. QPrinter problems
    By Teuniz in forum Qt Programming
    Replies: 1
    Last Post: 3rd November 2007, 08:51
  3. Weird color problems related to QTextEdit and QPainter
    By Erlendhg in forum Qt Programming
    Replies: 5
    Last Post: 18th June 2007, 21:57
  4. QPainter and QImage
    By beerkg in forum Newbie
    Replies: 3
    Last Post: 7th September 2006, 14:48
  5. Replies: 7
    Last Post: 20th March 2006, 20:03

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.