Results 1 to 4 of 4

Thread: QWidget

Threaded View

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

    Default QWidget

    hi,
    I have a code like this,
    ************************************************** ************************************************** *******
    Qt Code:
    1. pVideo = video;
    2. pViewer = 0;
    3.  
    4. vconfig = g_pManager->FindVideoDeviceConfig(pVideo->GetIntfName(), pVideo->GetNodeName(), true);
    5. pVOptions = new CVideoOptions();
    6. pVOptions->SetXML(vconfig);
    7. pVideo->SetConfiguration(vconfig);
    8. r = pVideo->Open();
    9.  
    10.  
    11.  
    12.  
    13. pWidget = new QWidget(this );
    14. assert(pWidget != NULL);
    15. pWidget->setAutoFillBackground(true);
    16. pWidget->setBackgroundRole(QPalette::Base);
    17. pWidget->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    18. setCentralWidget(pWidget);
    19.  
    20. //CImagePanelRGB is another class
    21. CCamPanel *pViewer;
    22. pViewer = new CImagePanelRGB(pVideo, pWidget);
    23.  
    24. // CBasicPanel is another class
    25. CBasicPanel *pLastSnapshot;
    26. pLastSnapshot = new CBasicPanel("snapshot", "Last snapshot", CCamPanel::RGB, pWidget);
    27.  
    28. if (pViewer) {
    29. QSize viewsize;
    30. QPainter painter;
    31. connect(pViewer, SIGNAL(ChangedVisibleSize(const QSize &)), this, SLOT(DeviceChangedSize(const QSize &)));
    32. viewsize = pVideo->GetSize();
    33. QPixmap blackimg(viewsize);
    34. painter.begin(&blackimg);
    35. painter.fillRect(0, 0, viewsize.width(), viewsize.height(), Qt::black);
    36. painter.setPen(Qt::yellow);
    37. painter.drawText(0, 0, viewsize.width(), viewsize.height(), Qt::AlignCenter, tr("Your last saved snapshot appears here"));
    38. painter.end();
    39.  
    40. if (pLastSnapshot != 0)
    41. {
    42. pLastSnapshot->SetSize(viewsize);
    43. pLastSnapshot->SetImage(0, blackimg.toImage());
    44. pLastSnapshot->hide();
    45. }
    46. pViewer->show();
    47. }
    To copy to clipboard, switch view to plain text mode 

    ************************************************** *******************************************
    the problum is that, this code create two window. I need one, the second one need to create the second one as a widget in the first wondow.
    Please help me to solve this probs.
    Last edited by wysota; 9th October 2007 at 09:31. Reason: missing [code] tags

Similar Threads

  1. Replies: 4
    Last Post: 24th April 2007, 13:18
  2. Replies: 3
    Last Post: 8th March 2007, 14:54
  3. Showing QMainWindow without showing a child QWidget
    By discostu in forum Qt Programming
    Replies: 3
    Last Post: 4th March 2007, 09:03
  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.