unable to maximize QfileDialog in stackwidget
-
I try to open a video file with QfileDialog but that dialog pop out with small dimensions in centre of its parent widget.How I can open file dialog maximized as default.
Here is some code:
player::player(QWidget parent) :
QWidget(parent),
ui(new Ui::player)
{
QFont player_font;
ui->setupUi(this);
QDesktopWidget screen;
video_dialog = new QFileDialog(this);
video_dialog->setModal(true);
}
void player::on_toolButton_6_clicked()
{
video_dialog->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding);
QString video_location;
video_location = video_dialog->getOpenFileName(this,tr("Open File"),"/home/apaul/Videos", tr("Video-Files ()"),0);
player1->setMedia(QUrl::fromLocalFile(video_location));
player1->play();
}
if I use :
video_dialog->showMaximized();
then it popped up as maximized but how can I get selected filename from that. -
@guru007
Hello,
QWidget::setWindowState and QDialog::setModal might be of use. -
Hi and welcome to devnet,
getOpenFileNames is a static method that uses the native file dialog. So the parameters you are modifying have not incident when allying getOpenFileNames.
selectedFiles will return what you have selected.
Hope it helps
-
Set the Qt::FramelessWindowHint on your dialog