ui->addTab "index out of range" !?
-
allNodesWidgets[ui->Graph->currentIndex()]ui->Graph->currentIndex()is almost certainly out of bounds -
What is the initial value of tabCounter? What is the vector size?
@Vinod-Kuntoji
The initial value of TabCounter is 0.
The vector has no specific size, it gets bigger when I add new items... what exactely do you mean? -
@Vinod-Kuntoji
The initial value of TabCounter is 0.
The vector has no specific size, it gets bigger when I add new items... what exactely do you mean?@Niagarer when you add new tab it do not mean that current index will be changed
-
@Niagarer when you add new tab it do not mean that current index will be changed
@Paul-Busovikov
Yes...?
To get sure I wroteqDebug() << ui->Graph->currentIndex();before and after adding a new tab
-
To make it easier:
the lineui->Graph->addTab(new QWidget(this), "hello");does not work. Doesn't matter where I call it.
-
@mrjj
Ok.
This also does not work:GraphWidget *newGraphWidget = new GraphWidget(this); //GraphWidget is a QGraphicsView ui->Graph->addTab(newGraphWidget, "hello"); -
To make it easier:
the lineui->Graph->addTab(new QWidget(this), "hello");does not work. Doesn't matter where I call it.
@Niagarer yes it doesn't
int index = 0; for (int i = 0; i < 10; ++i ) { index = ui->tabWidget->addTab( new QWidget, "title" ); qDebug() << index << " " << ui->tabWidget->currentIndex() ; }0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 -
Hi
I assume you are doing other stuff in your app since it crashes.Just to be sure, your Qt is not sick.
Can you try test project
https://www.dropbox.com/s/tpyxmww5t98i4um/untitled39.zip?dl=0 -
@Niagarer yes it doesn't
int index = 0; for (int i = 0; i < 10; ++i ) { index = ui->tabWidget->addTab( new QWidget, "title" ); qDebug() << index << " " << ui->tabWidget->currentIndex() ; }0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0@Paul-Busovikov
Oh yes, I see, I'm sorry. -
Hi
I assume you are doing other stuff in your app since it crashes.Just to be sure, your Qt is not sick.
Can you try test project
https://www.dropbox.com/s/tpyxmww5t98i4um/untitled39.zip?dl=0 -
Ok, all good then (with your Qt) :)
It should be no different inserting a QGraphicsView subclass -
Ok, all good then (with your Qt) :)
It should be no different inserting a QGraphicsView subclass -
@mrjj
I'm not sure if I understood that correctly...
In the old project GraphWidget is just a normal Widget. Here it is a QGraphicsView. Where is the mattering difference? -
Its not. 100% the same.
class QGraphicsView : public QAbstractScrollArea
class QAbstractScrollArea : public QFrame
class QFrame : public QWidget -
@mrjj
I'm not sure if I understood that correctly...
In the old project GraphWidget is just a normal Widget. Here it is a QGraphicsView. Where is the mattering difference?@Niagarer here I see that you add your Widget to vector after you are trying to get one from
//ui->allNodes_scrollArea->setWidget( allNodesWidgets[ui->Graph->currentIndex()] ); // !? PROBLEM !? allNodesWidgets.append(allNodesWidget);


