Answer the question
In order to leave comments, you need to log in
How can QFileDialog pop up a file open dialog and get the filename in char?
There is a console application. In which you want to add qt openfiledialog.
Only the name of the file selected in char is of interest, since then opencv image opening functions are used.
All #include done.
QFileDialog::getOpenFileName(this, tr("Open Document"), QDir::currentPath(), tr("Document files (*.doc *.rtf);;All files (*.*)"), 0, QFileDialog::DontUseNativeDialog);
QString filename = QFileDialog::getOpenFileName(
this,
tr("Open Document"),
QDir::currentPath(),
tr("Document files (*.doc *.rtf);;All files (*.*)"));
if (!filename.isNull())
{
qDebug(filename.toAscii());
}
QString *qs = new QString("переведи меня в чары! :)");
char const* ch = qs->toLocal8Bit().constData();
Answer the question
In order to leave comments, you need to log in
this is a hidden parameter of every non-static method that tells what object it is called on. If this object is not a QWidget, or a static function, or not a method at all, then either substitute another QWidget (meaning: the taskbar button is the same as this QWidget), or set it to NULL (create a new taskbar button).
In your case, of course, NULL. Or nullptr if you are working in C++11.
QString *qs = new QString("переведи меня в чары! :)");
char const* ch = qs->toLocal8Bit().constData();
QString qs("переведи меня в чары! :)");
char const* ch = qs.toLocal8Bit().constData();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question