I try to define such textedit:
Lister.h:
static QTextEdit* textview;
In Lister.cpp:
//Lister::textview = new QTextEdit(); -- in this case I got yellow background. So error.
If textview=new QTextEdit() - just if non-static.
So I try to make qtextedit non-pointer:
static QTextEdit textview --Lister.h
And define its properties in such kind
Lister::textview.setLineWrapMode(QTextEdit::NoWrap );
But I cannot add textedit to layout as other ones are added as ponters:
layout->addWidget(label3);
layout->addWidget(Lister::textview); -- got not matching functions error
//candidates are: void QBoxLayout::addWidget(QWidget*, int, Qt::Alignment).
layout->addWidget(label3);
layout->addWidget(Lister::textview); -- got not matching functions error
//candidates are: void QBoxLayout::addWidget(QWidget*, int, Qt::Alignment).
To copy to clipboard, switch view to plain text mode
I want to use static textedit in static-slot function so it could be applicable in threadwarapper function, as non-static results in error-carsh as I have written early.
Despite the solution could be using non-static function with non-static texedit as well, putting it in static-warpper function of Lister class, then putting it in Thread::run, then calling Thread::start, and putting it in slot of threadwrapper function -- but it should be 4-tier hierarchy, but creation the object at first level could also lead to crash as in case of 3-tier option.
If you dont understand about Qdialog so I can refer to some code:
void Lister::walki() {
QString path0
=filedlg
->getOpenFileName
();
//If I put these 2 lines in this method and then put this method in thread it lead to crash as without it would work fine if put to thread as without thread -- gui freeze.. QDirIterator* it = new QDirIterator(path0, QDirIterator::Subdirectories);
void Lister::walki() {
QFileDialog* filedlg;
QString path0=filedlg->getOpenFileName();//If I put these 2 lines in this method and then put this method in thread it lead to crash as without it would work fine if put to thread as without thread -- gui freeze..
QDirIterator* it = new QDirIterator(path0, QDirIterator::Subdirectories);
To copy to clipboard, switch view to plain text mode
Bookmarks