File: displaydialog.cpp

package info (click to toggle)
qucs 0.0.15-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 31,208 kB
  • ctags: 25,891
  • sloc: cpp: 202,101; sh: 6,422; ansic: 5,779; xml: 4,213; perl: 3,251; yacc: 2,850; lex: 2,088; makefile: 1,416
file content (88 lines) | stat: -rw-r--r-- 2,875 bytes parent folder | download | duplicates (2)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/***************************************************************************
                               displaydialog.cpp
                              -------------------
    begin                : Sat May 28 2005
    copyright            : (C) 2005 by Michael Margraf
    email                : michael.margraf@alumni.tu-berlin.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include "displaydialog.h"

#include <qlayout.h>
#include <qhbox.h>
#include <qpushbutton.h>
#include <qtextedit.h>
#include <qvgroupbox.h>


DisplayDialog::DisplayDialog(QWidget *parent, bool helper)
                     : QDialog(parent, 0, false, Qt::WDestructiveClose)
{
  vLayout = new QVBoxLayout(this);
  vLayout->setMargin(3);

  if(helper) {
    Text = new QTextEdit(this);
    Text->setTextFormat(Qt::PlainText);
    Text->setReadOnly(true);
    Text->setMinimumSize(200, 100);
    vLayout->addWidget(Text);
  }
  else {
    QVGroupBox *Analog = new QVGroupBox (tr("Analogue"), this);
    Text = new QTextEdit(Analog);
    Text->setTextFormat(Qt::PlainText);
    Text->setReadOnly(true);
    Text->setMinimumSize(200, 80);
    vLayout->addWidget(Analog);

    QVGroupBox *VHDL = new QVGroupBox (tr("VHDL"), this);
    VHDLText = new QTextEdit(VHDL);
    VHDLText->setTextFormat(Qt::PlainText);
    VHDLText->setReadOnly(true);
    VHDLText->setMinimumSize(200, 80);
    vLayout->addWidget(VHDL);

    QVGroupBox *Verilog = new QVGroupBox (tr("Verilog"), this);
    VerilogText = new QTextEdit(Verilog);
    VerilogText->setTextFormat(Qt::PlainText);
    VerilogText->setReadOnly(true);
    VerilogText->setMinimumSize(200, 80);
    vLayout->addWidget(Verilog);
  }

  QHBox *h = new QHBox(this);
  vLayout->addWidget(h);

  h->setStretchFactor(new QWidget(h),5); // stretchable placeholder

  QPushButton *ButtonClose = new QPushButton(tr("Close"), h);
  connect(ButtonClose, SIGNAL(clicked()), SLOT(slotClose()));
  ButtonClose->setFocus();

  h->setStretchFactor(new QWidget(h),5); // stretchable placeholder
}

DisplayDialog::~DisplayDialog()
{
  delete vLayout;
}

// ************************************************************
void DisplayDialog::slotClose()
{
  accept();
}