Home > Mobile >  Turn to QT open the folder
Turn to QT open the folder

Time:09-20

Found a problem, don't know how to solve, ask tall person to give directions, I code like this:

Mainwindow. H
 # # ifndef MAINWINDOW_H 
# define MAINWINDOW_H

#include
#include

QT_BEGIN_NAMESPACE
The namespace Ui {class MainWindow. }
QT_END_NAMESPACE

The class MainWindow: public QMainWindow
{
Q_OBJECT

Public:
MainWindow (QWidget * parent=nullptr);
~ MainWindow ();

Private:
Ui: : MainWindow * Ui;
QPushButton * BTN;

Private slots:
Void openfile ();
};
# endif//MAINWINDOW_H


The main. CPP
 # include "mainwindow. H" 

#include

Int main (int arg c, char * argv [])
{
QApplication a(argc, argv);
The MainWindow w;
w.show();
Return a.e xec ();
}


Mainwindow. CPP
 # include "mainwindow. H" 
# include "ui_mainwindow. H"
#include

MainWindow: : MainWindow (QWidget * parent)
: QMainWindow (parent)
, the UI (new UI: : MainWindow)
{
The UI - & gt; SetupUi (this);

BTN=new QPushButton;
BTN - & gt; SetText (" open ");
The connect (BTN, & amp; QPushButton: : clicked, this, & amp; MainWindow: : openfile);

SetCentralWidget (BTN);

}

MainWindow: : ~ MainWindow ()
{
Delete the UI;
}

Void MainWindow: : openfile ()
{
QString fileName=QFileDialog: : getOpenFileName (this, tr (" Open File "), "/home", the tr (" Images (*. PNG *. XPM *. JPG) "));

}


I will put a button, and then click a file open dialog box, after the open file path, although there is no error, but when click on the button, qt output will display the following information:
 
ShellStreams: AttachShellStreams: the Initialized
Trying to load localized resources for LANGID 2052 with Primary LANGID 4 code zh_CN name Chinese (Simplified) Resource DLL the loaded at the path C: \ Program Files \ (x86) Common Files \ \ Internet Services \ ShellStreams Apple resources \ zh_CN lproj \ ShellStreamsLocalized dllNot running under explorer. Will not set the thread locale
11516 b1203b0 ENTER: ShellStreamsFolder: : ShellStreamsFolder
Pidl=1 f50e04fd020ea3a6910a2d8802b30309d140 - & gt; 2 e80853fd6f0ec379740b3d61b4a891711800 - & gt;

11516 b1203b0 ENTER: ShellStreamsFolder: : CreateViewObject
11516 b120530 ENTER: ShellStreamsFolder: : ShellStreamsFolder
Pidl=1 f50e04fd020ea3a6910a2d8802b30309d140 - & gt; 2 e80853fd6f0ec379740b3d61b4a891711800 - & gt;
11516 b120530 ENTER: ShellStreamsFolder: : CreateViewObject
11516 b120530 ENTER: ShellStreamsFolder: : ShellStreamsFolder
Pidl=1 f50e04fd020ea3a6910a2d8802b30309d140 - & gt; 2 e80853fd6f0ec379740b3d61b4a891711800 - & gt;
11516 b120530 ENTER: ShellStreamsFolder: : CreateViewObject
11516 b1203b0 ENTER: ShellStreamsFolder: : ShellStreamsFolder
Pidl=1 f50e04fd020ea3a6910a2d8802b30309d140 - & gt; 2 e80853fd6f0ec379740b3d61b4a891711800 - & gt;
11516 b1203b0 ENTER: ShellStreamsFolder: : CreateViewObject
11516 b1203b0 ENTER: ShellStreamsFolder: : ShellStreamsFolder
Pidl=1 f50e04fd020ea3a6910a2d8802b30309d140 - & gt; 2 e80853fd6f0ec379740b3d61b4a891711800 - & gt;
11516 b1203b0 ENTER: ShellStreamsFolder: : CreateViewObject
11516 b120a10 ENTER: ShellStreamsFolder: : ShellStreamsFolder
Pidl=1 f50e04fd020ea3a6910a2d8802b30309d140 - & gt; 2 e80853fd6f0ec379740b3d61b4a891711800 - & gt;
11516 b120a10 ENTER: ShellStreamsFolder: : CreateViewObject
11516 b120a10 ENTER: ShellStreamsFolder: : ShellStreamsFolder
Pidl=1 f50e04fd020ea3a6910a2d8802b30309d140 - & gt; 2 e80853fd6f0ec379740b3d61b4a891711800 - & gt;
11516 b120a10 ENTER: ShellStreamsFolder: : CreateViewObject
11516 b120a10 ENTER: ShellStreamsFolder: : ShellStreamsFolder
Pidl=1 f50e04fd020ea3a6910a2d8802b30309d140 - & gt; 2 e80853fd6f0ec379740b3d61b4a891711800 - & gt;
11516 b120a10 ENTER: ShellStreamsFolder: : CreateViewObject
11516 b120ef0 ENTER: ShellStreamsFolder: : ShellStreamsFolder
Pidl=1 f50e04fd020ea3a6910a2d8802b30309d140 - & gt; 2 e80853fd6f0ec379740b3d61b4a891711800 - & gt;
11516 b120ef0 ENTER: ShellStreamsFolder: : CreateViewObject
11516 b120dd0 ENTER: ShellStreamsFolder: : ShellStreamsFolder
Pidl=1 f50e04fd020ea3a6910a2d8802b30309d140 - & gt; 2 e80853fd6f0ec379740b3d61b4a891711800 - & gt;
11516 b120dd0 ENTER: ShellStreamsFolder: : CreateViewObject
11516 b120c50 ENTER: ShellStreamsFolder: : ShellStreamsFolder
Pidl=1 f50e04fd020ea3a6910a2d8802b30309d140 - & gt; 2 e80853fd6f0ec379740b3d61b4a891711800 - & gt;
11516 b120c50 ENTER: ShellStreamsFolder: : CreateViewObject
11516 b120d70 ENTER: ShellStreamsFolder: : ShellStreamsFolder
Pidl=1 f50e04fd020ea3a6910a2d8802b30309d140 - & gt; 2 e80853fd6f0ec379740b3d61b4a891711800 - & gt;
11516 b120d70 ENTER: ShellStreamsFolder: : CreateViewObject
11516 b120d10 ENTER: ShellStreamsFolder: : ShellStreamsFolder
Pidl=1 f50e04fd020ea3a6910a2d8802b30309d140 - & gt; 2 e80853fd6f0ec379740b3d61b4a891711800 - & gt;
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • Qt
  • Related