Results 1 to 4 of 4

Thread: QWidget

  1. #1
    Join Date
    Jul 2007
    Posts
    166
    Thanks
    25
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QWidget

    Hi,
    I have a code in QT4.3 like this,

    Qt Code:

    QWidget *pWidget;
    CCamPanel *pViewer;
    pWidget = new QWidget(this );
    assert(pWidget != NULL);
    pWidget->setAutoFillBackground(true);
    pWidget->setBackgroundRole(QPalette::Base);
    pWidget->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    setCentralWidget(pWidget);
    pViewer = new CImagePanelRGB(pVideo, pWidget);
    pLastSnapshot = new CBasicPanel("snapshot", "Last snapshot", CCamPanel::RGB, pWidget);

    viewsize = pVideo->GetSize();
    QPixmap blackimg(viewsize);
    painter.begin(&blackimg);
    painter.fillRect(0, 0, viewsize.width(), viewsize.height(), Qt::black);
    painter.setPen(Qt::yellow);
    painter.drawText(0, 0, viewsize.width(), viewsize.height(), Qt::AlignCenter, tr("Your last saved snapshot appears here"));
    painter.end();
    if (pLastSnapshot != 0)
    {
    pLastSnapshot->SetSize(viewsize);
    pLastSnapshot->SetImage(0, blackimg.toImage());
    pLastSnapshot->hide();
    }
    pViewer->show();

    and in another file I have a class like this
    BasicPanel.cpp
    ------------------------

    Qt Code:
    CBasicPanel::CBasicPanel(const char *panel_name, const char *desc, int panel_type, QWidget *parent, const char *name)
    : CCamPanel(panel_name, desc, panel_type, TRUE, parent, name)
    {
    }



    My problem is that, when I run this program, it display a window and it hold a white widget. Why did I can't see the other widget?
    Please help me.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QWidget

    Stop starting new threads on the same subject, please!
    J-P Nurmi

  3. #3
    Join Date
    Jul 2007
    Posts
    166
    Thanks
    25
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWidget

    Hi,
    I didn't get answer for first thread. so

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

    Default Re: QWidget

    Please stop multiposting. If you didn't get the answer you wanted, continue in the old thread instead of starting a new one. This thread will be deleted as soon as the discussion starts in the original thread.

Similar Threads

  1. Replies: 4
    Last Post: 24th April 2007, 13:18
  2. Replies: 3
    Last Post: 8th March 2007, 14:54
  3. Transparent QWidget on QGLWidget
    By showhand in forum Qt Programming
    Replies: 2
    Last Post: 27th November 2006, 01:00
  4. Replies: 1
    Last Post: 2nd May 2006, 21:11
  5. QScrollArea problem positioning a QWidget inside
    By Spectator in forum Qt Programming
    Replies: 4
    Last Post: 20th February 2006, 22:59

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.