コード例 #1
0
ファイル: twl_modal.cpp プロジェクト: Konctantin/scite-ru
void TModalDlg::do_buttons(Layout& lo)
{ 
        lo << Margin;   // *add 1.0.0 space before the buttons
		if (m_type & ML_LEFT_ALIGN) lo << LeftAlign; 
		if (m_type & ML_OK)         lo << OKButton((EH)&TModalDlg::on_ok);
		if (m_type & ML_CANCEL)     lo << CancelButton((EH)&TModalDlg::on_cancel);
		lo << Center;
}
コード例 #2
0
ファイル: DtSetModList.C プロジェクト: osen/cdesktopenv
DtSetModList::DtSetModList(AnyUI *parent,
		           char *name,
                           BaseUI *workarea,
			   ButtonCallback filterCB)
	: Dialog(parent, name)
{
   mainw = (DtMainW *) parent;
   _has_been_posted = false;
   _info = new LabelObj(this, MESSAGE(SelectPrintersToBeShowL));
   _container = new Container(this, "FilterList", SCROLLED_VERTICAL_ROW_COLUMN,
			      MULTIPLE_SELECT);
   _container->IconView(SMALL_ICON);
   _filterCB = filterCB;
   _workarea = (Container *) workarea;
   Container *form = new Container(this, "Form", FORM);

   _info->AttachRight();
   _info->AttachLeft();
   _info->AttachTop();
   form->AttachBottom();
   form->AttachRight();
   form->AttachLeft();
   _container->AttachBottom(form, 5);
   _container->AttachRight();
   _container->AttachLeft();
   _container->AttachTop(_info);
   select_all = new Button(form, MESSAGE(SelectAllL), PUSH_BUTTON, SelectAllCB,
			   _container);
   unselect_all = new Button(form, MESSAGE(DeselectAllL), PUSH_BUTTON,
			     UnSelectAllCB, _container);

   int i;
   IconObj **objs = (IconObj **) workarea->Children();
   for (i = 0; i < workarea->NumChildren(); i++)
    {
      if (objs[i]->UIClass() == ICON)
       {
         IconObj *icon = new IconObj(_container, (char *)objs[i]->Name(),
				     objs[i]->IconFile());
	 icon->ApplicationData = objs[i];
       }
    }

   ok = new Button(this, MESSAGE(OKL), PUSH_BUTTON, OkCB, this);
   apply = new Button(this, MESSAGE(ApplyL), PUSH_BUTTON, ApplyCB, this);
   cancel = new Button(this, MESSAGE(CancelL), PUSH_BUTTON, CancelCB, this);
   help = new Button(this, MESSAGE(HelpL), PUSH_BUTTON, HelpCB, this);
   DefaultButton(ok);
   CancelButton(cancel);
   Reset();
}
コード例 #3
0
void ResizePhoto::Start()
{
    rsWidth=0;
    rsHeight=0;
    w=0;
    h=0;
    tw=0;
    th=0;
    rekar=false;
    resz=false;
    wc=true;
    hc=true;

    //Photo Size
    {
        QPixmap PSize(PhotoWindow::PhotoAddress()[PhotoWindow::Ps()]);

        wc=false;
        hc=false;
        ui->Width->setValue(PSize.width());
        ui->Height->setValue(PSize.height());
        wc=true;
        hc=true;

        w=ui->Width->value();
        h=ui->Height->value();
        wvt=ui->Width->value();
        hvt=ui->Height->value();

        OK.connect(&OK, SIGNAL(clicked()), this, SLOT(OKButton()));
        Cancel.connect(&Cancel, SIGNAL(clicked()), this, SLOT(CancelButton()));
        OK.setText(tr("OK"));
        Cancel.setText(tr("Cancel"));
        OK.setDefault(true);

        ui->ResizeButtonBox->addButton(&OK, QDialogButtonBox::AcceptRole);
        ui->ResizeButtonBox->addButton(&Cancel, QDialogButtonBox::RejectRole);
    }
}
コード例 #4
0
ファイル: liveinfo.cpp プロジェクト: frankyue/phm
Liveinfo::Liveinfo(int getroom,QWidget *parent) : QDialog(parent), Leavebool(true),Liveinbool(true)
{
	RoomNum = getroom;
	QSqlQueryModel roomtable;// = new QSqlQueryModel;
    roomtable.setQuery("select * from Room;");
   	QSqlQueryModel recordtable;// = new QSqlQueryModel;
    recordtable.setQuery("select * from Record,Guest;");
    int Check_live = 0;
   
    QString Snum;
    QString Sname;
    QString SID;
    QString Scontact;
    QString Stime;
    QString Etime;

	for (int i = 0; i < roomtable.rowCount(); ++i) 
	{
    	QSqlRecord roomrecord = roomtable.record(i);
    	int Rnum = roomrecord.value("Num").toInt();
    		if( Rnum == getroom )
    		{	
    			Check_live = roomrecord.value("Live").toInt();
    			Snum = roomrecord.value("Num").toString();
    			Sprice = roomrecord.value("Price").toString();
				
				if(Check_live == 1)
				{
    				for (int j = 0; j < recordtable.rowCount(); ++j)
    				{
    					QSqlRecord Recordrecord = recordtable.record(j);
    					Rnum = Recordrecord.value("Num").toInt();
    					if( Rnum == getroom )
    					{
    						Sname = Recordrecord.value("Name").toString();
    						Sdays = Recordrecord.value("Days").toString();
    						Sdeposit = Recordrecord.value("Deposit").toString();
    						SID = Recordrecord.value("ID").toString();
    						Scontact = Recordrecord.value("Contact").toString();
    						Stime = Recordrecord.value("Stime").toString();
    						Etime = Recordrecord.value("Etime").toString();
    					}
   					}
  				}
    			break;
   			}
     }//Got the roon num and chek if the room have lived
    
    QGridLayout* mainlayout = new QGridLayout;
	QGridLayout* buttonlayout = new QGridLayout;

	QLabel* Name = new QLabel("Name");
    QLabel* Contact = new QLabel("Contact");
    QLabel* ID = new QLabel("ID");
    QLabel* Days = new QLabel("Days");
    QLabel* Despoit = new QLabel("Despoit");
    QLabel* RoomNum = new QLabel("Room Num");
    QLabel* Price = new QLabel("Price");
    QLabel* Livein = new QLabel("Live in day");
    QLabel* LeaveDay = new QLabel("Leave day");
        
    NameEdit = new QLineEdit;
    ContactEdit = new QLineEdit;
    IDEdit = new QLineEdit;
    DaysEdit = new QLineEdit;
    DespoitEdit = new QLineEdit;
    RoomNumEdit = new QLineEdit;
/*
    PriceEdit = new QLineEdit;
    LiveinEdit = new QLineEdit;
    LeaveEdit = new QLineEdit;
*/
    QLineEdit* PriceEdit = new QLineEdit;
    QLineEdit* LiveinEdit = new QLineEdit;
    QLineEdit* LeaveEdit = new QLineEdit;
    
    QPushButton* Modify = new QPushButton("Modify");
	QPushButton* Check_out = new QPushButton("Check Out");
	QPushButton* Submit = new QPushButton("Submit");
	QPushButton* Cancel = new QPushButton("Cancel");
		
	PriceEdit->setText(Sprice);
	RoomNumEdit->setText(Snum);
	QDate a = QDate::currentDate();
	Estime = a.toString("yyyy-MM-dd");
	
	
	if(Check_live == 1)    //show the Record infomation 
   	{
		leave();
		
		NameEdit->setText(Sname);
		ContactEdit->setText(Scontact);
    	IDEdit->setText(SID);
    	DaysEdit->setText(Sdays);
    	DespoitEdit->setText(Sdeposit);
    	LiveinEdit->setText(Stime);
    	LeaveEdit->setText(Etime);
    
	}
	else
	{
		livein();
		LiveinEdit->setText(Estime);
	}
	
	LeaveDay->setEnabled(Liveinbool);
	LeaveEdit->setEnabled(Liveinbool);
	Modify->setEnabled(false);
	Check_out->setEnabled(Liveinbool);
	Submit->setEnabled(Leavebool);
	
	connect(Submit, SIGNAL(clicked()), this, SLOT(SubmitButton()));
	connect(Modify, SIGNAL(clicked()), this, SLOT(ModifyButton()));
	connect(Check_out, SIGNAL(clicked()), this, SLOT(CheckoutButton()));
	connect(Cancel, SIGNAL(clicked()), this, SLOT(CancelButton()));	
	
	mainlayout->addWidget(Name,0,0,1,1);
    mainlayout->addWidget(Contact,0,2,1,1);
    mainlayout->addWidget(ID,1,0,1,1);
    mainlayout->addWidget(Days,2,0,1,1);
    mainlayout->addWidget(Despoit,2,2,1,1);
    mainlayout->addWidget(RoomNum,3,0,1,1);
    mainlayout->addWidget(Price,3,2,1,1);
    mainlayout->addWidget(Livein,4,0,1,1);
    
	mainlayout->addWidget(NameEdit,0,1,1,1);
	mainlayout->addWidget(ContactEdit,0,3,1,1);
	mainlayout->addWidget(IDEdit,1,1,1,3);
	mainlayout->addWidget(DaysEdit,2,1,1,1);
	mainlayout->addWidget(DespoitEdit,2,3,1,1);
	mainlayout->addWidget(RoomNumEdit,3,1,1,1);
	mainlayout->addWidget(PriceEdit,3,3,1,1);
	mainlayout->addWidget(LiveinEdit,4,1,1,1);
	mainlayout->addWidget(LeaveDay,4,2,1,1);	
	mainlayout->addWidget(LeaveEdit,4,3,1,1);
	
	buttonlayout->addWidget(Submit,0,0,1,1);
	buttonlayout->addWidget(Modify,0,1,1,1);
	buttonlayout->addWidget(Check_out,0,2,1,1);
	buttonlayout->addWidget(Cancel,0,3,1,1);

	QVBoxLayout *Layout = new QVBoxLayout;
	Layout->addLayout(mainlayout);
	Layout->addLayout(buttonlayout);
	setLayout(Layout);
//	setWindow(200,300,400,500);
	setWindowTitle("Record");
	
}