Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

Issue with QVector

$
0
0
I am coming at this from 2 different angles but having no success with either. What I am trying to do is have a vector of ‘ParsableTextEdit’ which is my own type that is derived from QTextEdit. I am implementing a tab system using QTabWidget. So I have a pointer called ‘currentTab’, this is used to point to elements in the vector to make it the current one. The first approach was using pointers like so: QVector<ParsableTextEdit *> vec; and appending like so: vec.append(new ParsableTextEdit); Then when I want to make any of them the current one, I do this: currentTab = vec[index]; This causes no errors and makes sense to me but I know that currentTab is not referencing the right ParsableTextEdit when I switch away from the first one because I have connected the textChanged() signal to a slot like so: connect(currentTab,SIGNAL(textChanged()),this,SLOT(SetModified())); and it doesn’t get fired when I switch to another index in the vector. All this really does is adds an asterisk to the tab name so I know it has been modified. It works for the first element in the vector but no others. The other approach I took was making the vector elements plain objects like this: QVector<ParsableTextEdit> vec; Then I would do this when I am adding a new one: Parsable temp = ParsableTextEdit(); vec.append(temp); currentTab = &vec[vec.count -1]; This then gives me errors like: QTextEdit::QTextEdit(const QTextEdit&) is private        Q_DISABLE_COPY(QTextEdit) I have no idea what that means :/ If anyone knows what is causing this, I would really appreciate the help. Please ask if more information is needed. Thanks

Viewing all articles
Browse latest Browse all 13965