/**************************************************************************** ** ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info.com) ** ** This file is part of a Qt Solutions component. ** ** Commercial Usage ** Licensees holding valid Qt Solutions licenses may use this file in ** accordance with the Qt Solutions Commercial License Agreement provided ** with the Software or, alternatively, in accordance with the terms ** contained in a written agreement between you and Nokia. ** ** If you are unsure which license is appropriate for your use, please ** contact the sales department at qt-sales.com. ** ****************************************************************************/ #include #include "mainwindow.h" MainWindow::MainWindow() { SuspendLayout(); clock = new AnalogClock(); clockHost = gcnew QtWidgetHost(clock); clockHost->Anchor = AnchorStyles::None; clockHost->Dock = DockStyle::Fill; timePicker = gcnew DateTimePicker(); timePicker->Anchor = AnchorStyles::Right; timePicker->ShowUpDown = true; timePicker->Format = DateTimePickerFormat::Time; timePicker->Size = Drawing::Size(100, 20); button = gcnew Button(); button->Anchor = AnchorStyles::Left; button->Text = L"Set time"; button->Click += gcnew System::EventHandler(this, &MainWindow::button_Click); QLineEdit* lineEdit = new QLineEdit(); QtWidgetHost^ lineEditHost = gcnew QtWidgetHost(lineEdit); TableLayoutPanel ^layout = gcnew TableLayoutPanel(); layout->SuspendLayout(); layout->Dock = DockStyle::Fill; layout->ColumnCount = 2; layout->ColumnStyles->Add((gcnew ColumnStyle(SizeType::Percent, 50))); layout->ColumnStyles->Add((gcnew ColumnStyle(SizeType::Percent, 50))); layout->RowCount = 2; layout->RowStyles->Add((gcnew RowStyle(SizeType::Percent, 100))); layout->RowStyles->Add((gcnew RowStyle())); layout->Controls->Add(clockHost, 0, 0); layout->SetColumnSpan(clockHost, 2); layout->Controls->Add(timePicker, 0, 1); layout->Controls->Add(button, 1, 1); layout->Controls->Add(lineEditHost, 1, 2); Controls->Add(layout); layout->ResumeLayout(false); ResumeLayout(false); } MainWindow::~MainWindow() { } System::Void MainWindow::button_Click(System::Object ^, System::EventArgs ^) { clock->setTime(QtWinFormsUtils::toQTime(timePicker->Value)); }