[go: up one dir, main page]

Menu

[4cf102]: / commandline.cpp  Maximize  Restore  History

Download this file

55 lines (50 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "commandline.h"
#include "settings.h"
#include <QPushButton>
#include <QLabel>
#include <QLineEdit>
#include <QHBoxLayout>
/**
* \brief Constructor for the \c CommandLine class
*
* The constructor uses a \c QHBoxLayout to place a QLabel and a \c QLineEdit
* in the \c QFrame which is the container for the widgets. The label is
* placed to the left of the line edit widget. The line edit input field
* starts empty.
*/
CommandLine::CommandLine(QWidget *parent)
: QFrame(parent)
{
setFrameStyle(QFrame::Panel | QFrame::Plain);
setLineWidth(0);
QHBoxLayout *layout = new QHBoxLayout;
layout->setSpacing(10);
layout->setContentsMargins(5, 5, 5, 5);
QLabel *label = new QLabel(tr("Command line"));
layout->addWidget(label);
lineEdit = new QLineEdit();
lineEdit->setText(ebe["command_line"].toString());
lineEdit->setToolTip(tr("Enter extra parameters for the command line\n"
"for your program when it runs. The command\n"
"line parameters are the parameters to main\n"
"in C and C++(argc and argv). The first is\n"
"always the name of the program."));
connect ( lineEdit, SIGNAL(textChanged(const QString&)),
this, SLOT(changed(const QString&)) );
layout->addWidget(lineEdit);
setLayout(layout);
setVisible(ebe["command/visible"].toBool());
}
/**
* \brief This is a function to get the text in the line edit
*
* \return QString holding the text from the \c QLineEdit
*/
QString CommandLine::text()
{
return lineEdit->text();
}
void CommandLine::changed(const QString &text)
{
ebe["command_line"] = text;
}