cppcheck-verify: added 'open' menu
This commit is contained in:
parent
42d0ad8262
commit
2387ed49f3
|
@ -28,6 +28,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
static void arrayIndex(const Tokenizer &tokenizer, std::set<unsigned int> &errorlines);
|
static void arrayIndex(const Tokenizer &tokenizer, std::set<unsigned int> &errorlines);
|
||||||
|
|
||||||
static unsigned char readChar(std::istream &istr)
|
static unsigned char readChar(std::istream &istr)
|
||||||
|
@ -49,8 +51,22 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent), ui(new Ui::MainWindow)
|
: QMainWindow(parent), ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(open()));
|
||||||
|
}
|
||||||
|
|
||||||
const std::string fileName("../lib/tokenize.cpp");
|
MainWindow::~MainWindow()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::open()
|
||||||
|
{
|
||||||
|
const std::string fileName = QFileDialog::getOpenFileName(this,
|
||||||
|
tr("Open File"),
|
||||||
|
"",
|
||||||
|
"cpp files (*.cpp)").toStdString();
|
||||||
|
if (fileName.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
setWindowTitle(fileName.c_str());
|
setWindowTitle(fileName.c_str());
|
||||||
|
|
||||||
|
@ -99,11 +115,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
}
|
}
|
||||||
ui->plainTextEdit->setPlainText(QString::fromStdString(report.str()));
|
ui->plainTextEdit->setPlainText(QString::fromStdString(report.str()));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,9 @@ public:
|
||||||
MainWindow(QWidget *parent = 0);
|
MainWindow(QWidget *parent = 0);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void open();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,6 +33,13 @@
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QMenu" name="menuFile">
|
||||||
|
<property name="title">
|
||||||
|
<string>File</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionOpen"/>
|
||||||
|
</widget>
|
||||||
|
<addaction name="menuFile"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="mainToolBar">
|
<widget class="QToolBar" name="mainToolBar">
|
||||||
<attribute name="toolBarArea">
|
<attribute name="toolBarArea">
|
||||||
|
@ -43,6 +50,11 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
|
<action name="actionOpen">
|
||||||
|
<property name="text">
|
||||||
|
<string>Open..</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
Loading…
Reference in New Issue