work save
This commit is contained in:
parent
e1631c211a
commit
76dcd8b41f
|
@ -25,6 +25,7 @@
|
|||
|
||||
CodeCompletionListView::CodeCompletionListView(QWidget *parent) : QListView(parent)
|
||||
{
|
||||
setUniformItemSizes(true);
|
||||
setItemDelegate(&mDelegate);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
#include "newclassdialog.h"
|
||||
#include "ui_newclassdialog.h"
|
||||
#include "../iconsmanager.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
NewClassDialog::NewClassDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::NewClassDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
updateIcons();
|
||||
}
|
||||
|
||||
NewClassDialog::~NewClassDialog()
|
||||
{
|
||||
}
|
||||
|
||||
QString NewClassDialog::className() const
|
||||
{
|
||||
return ui->txtClassName->text();
|
||||
}
|
||||
|
||||
QString NewClassDialog::baseClass() const
|
||||
{
|
||||
return ui->cbBaseClass->currentText();
|
||||
}
|
||||
|
||||
QString NewClassDialog::headerName() const
|
||||
{
|
||||
return ui->txtHeaderName->text();
|
||||
}
|
||||
|
||||
QString NewClassDialog::sourceName() const
|
||||
{
|
||||
return ui->txtSourceName->text();
|
||||
}
|
||||
|
||||
QString NewClassDialog::path() const
|
||||
{
|
||||
return ui->txtPath->text();
|
||||
}
|
||||
|
||||
void NewClassDialog::setPath(const QString &location)
|
||||
{
|
||||
ui->txtPath->setText(location);
|
||||
}
|
||||
|
||||
void NewClassDialog::on_btnCancel_clicked()
|
||||
{
|
||||
this->reject();
|
||||
}
|
||||
|
||||
void NewClassDialog::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
this->reject();
|
||||
}
|
||||
|
||||
|
||||
void NewClassDialog::on_btnCreate_clicked()
|
||||
{
|
||||
this->accept();
|
||||
}
|
||||
|
||||
void NewClassDialog::updateIcons()
|
||||
{
|
||||
pIconsManager->setIcon(ui->btnBrowsePath, IconsManager::ACTION_FILE_OPEN_FOLDER);
|
||||
}
|
||||
|
||||
|
||||
void NewClassDialog::on_btnBrowsePath_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getExistingDirectory(
|
||||
this,
|
||||
tr("Location"),
|
||||
ui->txtPath->text());
|
||||
ui->txtPath->setText(fileName);
|
||||
}
|
||||
|
||||
|
||||
void NewClassDialog::on_txtClassName_textChanged(const QString &/* arg1 */)
|
||||
{
|
||||
ui->txtHeaderName->setText(ui->txtClassName->text().toLower()+".h");
|
||||
ui->txtSourceName->setText(ui->txtClassName->text().toLower()+".cpp");
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef NEWCLASSDIALOG_H
|
||||
#define NEWCLASSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class NewClassDialog;
|
||||
}
|
||||
|
||||
class NewClassDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NewClassDialog(QWidget *parent = nullptr);
|
||||
~NewClassDialog();
|
||||
|
||||
QString className() const;
|
||||
QString baseClass() const;
|
||||
QString headerName() const;
|
||||
QString sourceName() const;
|
||||
QString path() const;
|
||||
void setPath(const QString& location);
|
||||
|
||||
private slots:
|
||||
void on_btnCancel_clicked();
|
||||
|
||||
void on_btnCreate_clicked();
|
||||
|
||||
void on_btnBrowsePath_clicked();
|
||||
|
||||
void on_txtClassName_textChanged(const QString &arg1);
|
||||
|
||||
private:
|
||||
Ui::NewClassDialog *ui;
|
||||
|
||||
private:
|
||||
void updateIcons();
|
||||
|
||||
// QWidget interface
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
};
|
||||
|
||||
#endif // NEWCLASSDIALOG_H
|
|
@ -0,0 +1,142 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NewClassDialog</class>
|
||||
<widget class="QDialog" name="NewClassDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>642</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="7" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Header Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QLineEdit" name="txtClassName"/>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QLineEdit" name="txtPath"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Class Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="cbBaseClass"/>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="4">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnCreate">
|
||||
<property name="text">
|
||||
<string>Create</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnCancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Base Class:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QToolButton" name="btnBrowsePath">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/images/newlook24/053-open.png</normaloff>:/icons/images/newlook24/053-open.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="2">
|
||||
<widget class="QLineEdit" name="txtHeaderName"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Source Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" colspan="2">
|
||||
<widget class="QLineEdit" name="txtSourceName"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue