File: smilesdialog.cpp

package info (click to toggle)
xdrawchem 1.0-0.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,820 kB
  • ctags: 2,389
  • sloc: cpp: 17,801; makefile: 263; ansic: 168
file content (50 lines) | stat: -rw-r--r-- 1,373 bytes parent folder | download
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
#include <qwidget.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qdialog.h>
#include <qcolor.h>
#include <qfont.h>
#include <qnamespace.h>

#include "application.h"
#include "chemdata.h"
#include "render2d.h"
#include "smilesdialog.h"

void ApplicationWindow::FromSMILES(void) {
  SmilesDialog i(this, QString("smiles_dialog"));
  if ( !i.exec() ) return;
  QString sm = i.getSMILES();
  c->fromSMILES(sm);
  r->Inserted();
  r->repaint();
}

SmilesDialog::SmilesDialog(QWidget *parent, QString name) : 
	QDialog(parent, name, TRUE)
{
  QPushButton *ok, *cancel;
  QLabel *t1;
  setBackgroundColor(lightGray);
  setCaption( tr("Enter SMILES string") );
  t1 = new QLabel("Enter SMILES string:", this);
  t1->setGeometry(10,10,180,30);
  t1->setBackgroundColor(lightGray);
  tf_smiles = new QLineEdit(this);
  tf_smiles->setGeometry(10,50,200,30);
  connect(tf_smiles, SIGNAL(returnPressed()), this, SLOT(accept()) );
  ok = new QPushButton( tr("OK"), this);
  ok->setGeometry(10,90,100,30);
  ok->setPalette(QPalette(lightGray));
  connect(ok, SIGNAL(clicked()), SLOT(accept()) );
  cancel = new QPushButton( tr("Cancel"), this);
  cancel->setGeometry(120,90,100,30);
  cancel->setPalette(QPalette(lightGray));
  connect(cancel, SIGNAL(clicked()), SLOT(reject()) );
}

QString SmilesDialog::getSMILES(void)
{
  return tf_smiles->text();
}