QGraphicsView to cover small bottom region not whole region. Possible?
Not all widget( video, tickers) are working on QGraphicsScene & QGraphicsView
Thus, want QGraphicsView to cover only a small bottom label region.
Below is my code.
MainWindow::MainWindow(QWidget *parent) :
QWidget *window= new QWidget;
ml = new WidgetMarqueeLabel(this); ml->setTextFormat(Qt::RichText); ml->setAlignment(Qt::AlignBottom); ml->setText("this is a very long text, todays weathre is very hot"); ml->setFont(QFont("Arial", 20,20)); //label->setText(" "); QGridLayout *layout= new QGridLayout; video(); layout->addWidget(videoWidget,0,0); layout->addWidget(videoWidget1,0,1); layout->addWidget(ml,1,0,1,2); //create a scene QGraphicsScene* scene = new QGraphicsScene(); //create an item to put into the scene QGraphicsRectItem* rect= new QGraphicsRectItem(); rect->setRect(0,0,100,100); //add the item to the scene scene->addItem(rect); //add a view->portion of view is viewable QGraphicsView* view = new QGraphicsView(scene); view->show(); //window->setLayout(layout); //window->show();
QGraphicsView is just a widget, it can be used in layouts and combined with other widgets. So you should be perfectly able to place it only at the bottom of your UI. The problems right now seems to be that you are not placing view object in your layout - so it will not be positioned correctly.
Know how to create QGraphicsView in mainwindow.
Could you please show QGraphicsView placed at the bottom of UI by code?
Just make sure to put it in the right place in the grid. Or use a QVBoxLayout instead of the grid.