Solved directoryOf function QT4 -> QT5
-
I came across the following code snippet written with QT4:
void HelpBrowser::showPage(const QString &page) { auto path = directoryOf("doc").absolutePath(); auto browser = new HelpBrowser(path, page); browser->resize(500, 400); browser->show(); }
However in Qt5 i cant find the function
directoryOf()
. Does it still exist? -
@sandro4912 said in directoryOf function QT4 -> QT5:
directoryOf
In which class was it in Qt4? I'm not aware that such a function exists in Qt4 at all.
-
Hi,
What is HelpBrowser ?
-
@sandro4912 said in directoryOf function QT4 -> QT5:
HelpBrowser
directoryOfIt's from here http://www.informit.com/articles/article.aspx?p=1405554&seqNum=4
C++ GUI Programming with Qt4: Providing Online Help:)
And to the OP: all the code is written by the author in the book, it doesn't come with Qt.
-
HelpBrowser::directoryOf() is a custom function written by someone but not Qt. So you will likely not find it in any Qt class but in the HelpBrowser implementation which you will find in the book I guess.
-
Yeah i got it now. I overread it in the mentioned book. If youre currious. The function does this:
QDir MainWindow::directoryOf(const QString &subdir) { QDir dir(QApplication::applicationDirPath()); #if defined(Q_OS_WIN) if (dir.dirName().toLower() == "debug" || dir.dirName().toLower == "release") dir.cdUp(); #elif defined(Q_OS_MAC) if (dir.dirName() == "MacOS") { dir.cdUp(); dir.cdUp(); dir.cdUp(); } #endif dir.cd(subdir); return dir; }
-
Hi @sandro4912,
so you can mark this topic as SOLVED now. Thanks!
-
Yeah i already marked it. I Gues ś questions like this happen after coding to many hours...