本文整理汇总了C++中Q3BoxLayout::addSpacing方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3BoxLayout::addSpacing方法的具体用法?C++ Q3BoxLayout::addSpacing怎么用?C++ Q3BoxLayout::addSpacing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3BoxLayout
的用法示例。
在下文中一共展示了Q3BoxLayout::addSpacing方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDialog
SelectionList::SelectionList
(
QWidget* parent,
const char* name
) : QDialog ( parent, name )
{
setCaption( "Select an Item" );
titleLabel = new QLabel(this, "Title Label");
titleLabel->setText("Please select an option.");
titleLabel->setAlignment(Qt::AlignTop|Qt::AlignHCenter);
list = new Q3ListView(this, "Selection List");
list->setAllColumnsShowFocus(true);
extraLabel = new QLabel(this, "Extra Label");
extraLabel->setText("");
extraLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
extraList = new QComboBox(false, this, "Extra List");
acceptButton = new QPushButton(this, "Accept Button");
acceptButton->setText("&Accept");
connect(acceptButton, SIGNAL(clicked()), SLOT(accept()));
cancelButton = new QPushButton(this, "Cancel Button");
cancelButton->setText("&Cancel");
connect(cancelButton, SIGNAL(clicked()), SLOT(reject()));
// Create the layout for this box. _Very_ simple. Top down box
// with a button box at the bottom.
Q3BoxLayout *ml = new Q3BoxLayout(this, Q3BoxLayout::TopToBottom, 3, 3);
ml->addWidget(titleLabel, 0);
ml->addWidget(list, 1);
Q3BoxLayout *bl = new Q3BoxLayout(Q3BoxLayout::LeftToRight, 3);
bl->addWidget(extraLabel, 0);
bl->addWidget(extraList, 1);
bl->addSpacing(10);
bl->addWidget(acceptButton, 0);
bl->addWidget(cancelButton, 0);
ml->addLayout(bl, 0);
extraLabel->hide();
extraList->hide();
}
示例2: TAAWidget
LogVoiceMail::LogVoiceMail
(
QWidget* parent,
const char* name
) : TAAWidget(parent)
{
setCaption( "Voice Mail Logging" );
// Create the widgets
QLabel *dateLabel = new QLabel(this);
dateLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
dateLabel->setText("D&ate/Time:");
msgDateTime = new Q3DateTimeEdit(QDateTime::currentDateTime(), this, "MsgDateTime");
dateLabel->setBuddy(msgDateTime);
QLabel *messageLabel = new QLabel(this);
messageLabel->setAlignment(Qt::AlignRight|Qt::AlignTop);
messageLabel->setText("M&essage:");
message = new Q3MultiLineEdit(this);
message->setWordWrap(Q3MultiLineEdit::WidgetWidth);
messageLabel->setBuddy(message);
saveButton = new QPushButton(this);
saveButton->setText("&Save");
connect(saveButton, SIGNAL(clicked()), this, SLOT(saveMessage()));
closeButton = new QPushButton(this);
closeButton->setText("&Close");
connect(closeButton, SIGNAL(clicked()), this, SLOT(closeClicked()));
statusLabel = new QLabel(this);
statusLabel->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
statusLabel->setFrameStyle(Q3Frame::Panel|Q3Frame::Sunken);
statusLabel->setMinimumSize(0, 20);
// Now, create our layouts
// Date/time area.
Q3GridLayout *dtl = new Q3GridLayout(2, 4, 3);
dtl->setColStretch(0, 0);
dtl->setColStretch(1, 1);
dtl->setColStretch(2, 0);
dtl->setColStretch(3, 1);
dtl->setRowStretch(0, 0);
dtl->setRowStretch(1, 1);
dtl->addWidget(dateLabel, 0, 0);
dtl->addMultiCellWidget(msgDateTime, 0, 0, 1, 3);
dtl->addWidget(messageLabel, 1, 0);
dtl->addMultiCellWidget(message, 1, 1, 1, 3);
// The action button layout.
Q3BoxLayout *abl = new Q3BoxLayout(Q3BoxLayout::LeftToRight, 5);
abl->addStretch(1);
abl->addWidget(saveButton, 0);
abl->addWidget(closeButton, 0);
abl->addSpacing(5);
// The main layout.
Q3BoxLayout *ml = new Q3BoxLayout(this, Q3BoxLayout::TopToBottom, 0, 0);
ml->addSpacing(3);
ml->addLayout(dtl, 1);
ml->addSpacing(3);
ml->addLayout(abl, 0);
ml->addSpacing(3);
ml->addWidget(statusLabel, 0);
// Done.
msgDateTime->setFocus();
resize(350, 180);
}
示例3: ViewWidget
FreqView::FreqView(int viewID_, QWidget *parent)
: ViewWidget(viewID_, parent)
{
View *view = gdata->view;
//setCaption("Frequency View");
Q3BoxLayout *mainLayout = new Q3VBoxLayout(this);
mainLayout->setResizeMode(QLayout::SetNoConstraint);
//QBoxLayout *topLayout = new QVBoxLayout(mainLayout);
//QBoxLayout *rightLayout = new QVBoxLayout(mainLayout);
//QBoxLayout *bottomLayout = new QHBoxLayout(mainLayout);
QSplitter *splitter = new QSplitter(Qt::Vertical, this);
QWidget *topWidget = new QWidget(splitter);
//topSplitter->setOpaqueResize(true);
Q3BoxLayout *topLayout = new Q3HBoxLayout(topWidget);
Q3BoxLayout *topLeftLayout = new Q3VBoxLayout(topLayout);
timeAxis = new TimeAxis(topWidget, gdata->leftTime(), gdata->rightTime(), true);
timeAxis->setWhatsThis("The time in seconds");
topLeftLayout->addWidget(timeAxis);
/*
Q3Grid *freqFrame = new Q3Grid(1, topWidget);
freqFrame->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
//freqDrawWidget = new FreqDrawWidget(freqFrame);
//freqDrawWidget->setFocusPolicy(Qt::NoFocus);
freqWidgetGL = new FreqWidgetGL(freqFrame);
freqWidgetGL->setFocusPolicy(Qt::NoFocus);
topLeftLayout->addWidget(freqFrame);
*/
QFrame *freqFrame = new QFrame;
freqFrame->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
QVBoxLayout *freqFrameLayout = new QVBoxLayout;
freqWidgetGL = new FreqWidgetGL(NULL);
freqWidgetGL->setWhatsThis("The line represents the musical pitch of the sound. A higher pitch moves up, with note names shown at the left, with octave numbers. "
"The black vertical line shows the current time. This line's position can be moved. "
"Pitch-lines are drawn connected only because they change a small amount over a small time step. "
"Note: This may cause semi-tone note changes appear to be joined. Clicking the background and dragging moves the view. "
"Clicking a pitch-line selects it. Mouse-Wheel scrolls. Shift-Mouse-Wheel zooms");
//freqWidgetGL = new FreqDrawWidget(NULL);
freqFrameLayout->addWidget(freqWidgetGL);
freqFrameLayout->setMargin(0);
freqFrameLayout->setSpacing(0);
freqFrame->setLayout(freqFrameLayout);
topLeftLayout->addWidget(freqFrame);
//Q3BoxLayout *topRightLayout = new Q3VBoxLayout(topLayout);
QVBoxLayout *topRightLayout = new QVBoxLayout();
freqWheelY = new QwtWheel(topWidget);
freqWheelY->setOrientation(Qt::Vertical);
freqWheelY->setWheelWidth(14);
freqWheelY->setRange(1.6, 5.0, 0.001, 1);
//freqWheelY->setValue(3.2);
//view->setZoomFactorY(3.2);
freqWheelY->setValue(view->logZoomY());
QToolTip::add(freqWheelY, "Zoom pitch contour view vertically");
topRightLayout->addSpacing(20);
topRightLayout->addWidget(freqWheelY, 0);
//Create the vertical scrollbar
//vScrollBar = new MyScrollBar(0, toInt((view->topNote()-view->viewHeight())*view->stepY()), 20, toInt(view->viewHeight()*view->stepY()), toInt(view->viewBottom()*view->stepY()), Qt::Vertical, this);
//vScrollBar = new MyScrollBar(0, gdata->topNote()-view->viewHeight(), 20, view->viewHeight(), view->viewBottom(), 20, Qt::Vertical, this);
freqScrollBar = new MyScrollBar(0, gdata->topPitch()-view->viewHeight(), 0.5, view->viewHeight(), 0, 20, Qt::Vertical, topWidget);
freqScrollBar->setValue(gdata->topPitch()-view->viewHeight()-view->viewBottom());
topRightLayout->addWidget(freqScrollBar, 4);
topLayout->addLayout(topRightLayout);
/*
QPushButton *buttonPlusY = new QPushButton("+", topSplitter);
buttonPlusY->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
buttonPlusY->setFixedSize(15, 15);
QToolTip::add(buttonPlusY, "Zoom in vertically");
QPushButton *buttonMinusY = new QPushButton("-", topSplitter);
buttonMinusY->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
buttonMinusY->setFixedSize(15, 15);
QToolTip::add(buttonMinusY, "Zoom out vertically");
*/
//------------bottom half------------------
QWidget *bottomWidget = new QWidget(splitter);
Q3BoxLayout *bottomLayout = new Q3VBoxLayout(bottomWidget);
Q3BoxLayout *bottomTopLayout = new Q3HBoxLayout(bottomLayout);
/*
Q3Grid *amplitudeFrame = new Q3Grid(1, bottomWidget);
amplitudeFrame->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
amplitudeWidget = new AmplitudeWidget(amplitudeFrame);
bottomTopLayout->addWidget(amplitudeFrame);
*/
QFrame *amplitudeFrame = new QFrame;
amplitudeFrame->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
QVBoxLayout *amplitudeFrameLayout = new QVBoxLayout;
//.........这里部分代码省略.........
示例4: TAAWidget
CustomerSearch::CustomerSearch(QWidget *parent, const char *name, Qt::WFlags f)
: TAAWidget(parent, f)
{
// A simple (in appearance) widget that will allow the user to
// search for, and select, a customer.
//
// The layout will look like so:
//
// Query: [ Search Box ] [Search] [Clear]
// +---------+----------+-----------------------+
// + Cust ID | Login ID | Account Name |
// + | | |
// +---------+----------+-----------------------+
//
// When the user types something in the search box and presses enter
// or clicks the search button, the widget will do a search on the
// customer database against the search text and fill in the list.
// When the user clicks or scrolls onto an entry, itemHighlighted()
// will be emitted with the customer ID. When the user double clicks
// or presses enter on an entry itemSelected() will be emitted with
// the customer ID.
searchText = new QLineEdit(this, "SearchText");
searchText->setMaxLength(80);
connect(searchText, SIGNAL(returnPressed()), this, SLOT(startSearch()));
QLabel *queryLabel = new QLabel(this, "Query Label");
queryLabel->setText("&Query:");
queryLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
queryLabel->setBuddy(searchText);
searchButton = new QPushButton(this, "SearchButton");
searchButton->setText("Search");
connect(searchButton, SIGNAL(clicked()), this, SLOT(startSearch()));
QPushButton *clearButton = new QPushButton(this, "Clear Button");
clearButton->setText("C&lear");
connect(clearButton, SIGNAL(clicked()), this, SLOT(clearSearch()));
custList = new Q3ListView(this, "SearchResults");
custList->setMargin(2);
custList->setAllColumnsShowFocus(true);
custList->setRootIsDecorated(true);
custList->addColumn("Account Name");
custList->addColumn("LoginID");
custList->addColumn("Cust ID");
connect(custList, SIGNAL(currentChanged(Q3ListViewItem *)), this, SLOT(itemHighlighted(Q3ListViewItem *)));
connect(custList, SIGNAL(doubleClicked(Q3ListViewItem *)), this, SLOT(itemSelected(Q3ListViewItem *)));
connect(custList, SIGNAL(returnPressed(Q3ListViewItem *)), this, SLOT(itemSelected(Q3ListViewItem *)));
Q3BoxLayout *ml = new Q3BoxLayout(this, Q3BoxLayout::TopToBottom, 0, 0);
Q3BoxLayout *sl = new Q3BoxLayout(Q3BoxLayout::LeftToRight, 0);
sl->addSpacing(3);
sl->addWidget(queryLabel, 0);
sl->addSpacing(3);
sl->addWidget(searchText, 1);
sl->addSpacing(3);
sl->addWidget(searchButton, 0);
sl->addWidget(clearButton, 0);
ml->addLayout(sl, 0);
ml->addSpacing(3);
ml->addWidget(custList, 1);
}
示例5: ViewWidget
HTrackView::HTrackView( int viewID_, QWidget *parent )
: ViewWidget( viewID_, parent)
{
//setCaption("HTrack view");
Q3GridLayout *mainLayout = new Q3GridLayout(this, 2, 2);
mainLayout->setResizeMode(QLayout::SetNoConstraint);
//QBoxLayout *topLayout = new QVBoxLayout(mainLayout);
//QBoxLayout *rightLayout = new QVBoxLayout(mainLayout);
Q3BoxLayout *rightLayout = new Q3VBoxLayout();
Q3BoxLayout *bottomLayout = new Q3HBoxLayout();
Q3Grid *frame = new Q3Grid(1, this);
frame->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken);
//frame->setLineWidth(2);
//frame->setMidLineWidth(2);
QWidget *aWidget = new QWidget(frame);
hTrackWidget = new HTrackWidget(aWidget);
hTrackWidget->setWhatsThis("Shows a 3D keyboard with the current note coloured. "
"Vertical columns (or tracks), each representing a harmonic (or component frequency), protrude from the back, and move further away over time. "
"The height of each track is related to how much energy is at that frequency. "
"Tracks alternate in colour for better visibility. It can be seen how the hamonics in a note fit into the musical scale.");
//hTrackWidget->show();
peakThresholdSlider = new QSlider(0, 100, 10, 5, Qt::Vertical, this);
QToolTip::add(peakThresholdSlider, "Thresholding of harmonics");
rotateXWheel = new QwtWheel(this);
rotateXWheel->setWheelWidth(20);
rotateXWheel->setRange(-180, 180, 0.1, 1);
QToolTip::add(rotateXWheel, "Rotate piano horizonally");
rotateYWheel = new QwtWheel(this);
rotateYWheel->setOrientation(Qt::Vertical);
rotateYWheel->setWheelWidth(20);
rotateYWheel->setRange(-90, 0, 0.1, 1);
QToolTip::add(rotateYWheel, "Rotate piano vertically");
distanceWheel = new QwtWheel(this);
distanceWheel->setOrientation(Qt::Vertical);
//distanceWheel->setWheelWidth(20);
distanceWheel->setRange(100, 5000, 10, 20);
distanceWheel->setTotalAngle(20*360);
QToolTip::add(distanceWheel, "Move towards/away from piano");
QPushButton *homeButton = new QPushButton("Reset", this, "homebutton");
QToolTip::add(homeButton, "Return to the original view");
QSizeGrip *sizeGrip = new QSizeGrip(this);
//sizeGrip->setFixedSize(15, 15);
mainLayout->addWidget(frame, 0, 0);
mainLayout->addLayout(bottomLayout, 1, 0);
mainLayout->addLayout(rightLayout, 0, 1);
rightLayout->addStretch(2);
rightLayout->addWidget(peakThresholdSlider);
rightLayout->addStretch(4);
rightLayout->addWidget(rotateYWheel);
rightLayout->addSpacing(14);
rightLayout->addWidget(distanceWheel);
bottomLayout->addStretch(0);
bottomLayout->addWidget(homeButton);
bottomLayout->addSpacing(14);
bottomLayout->addWidget(rotateXWheel);
//bottomLayout->addSpacing(20);
mainLayout->addWidget(sizeGrip, 1, 1);
//make the widget get updated when the view changes
connect(gdata->view, SIGNAL(onSlowUpdate(double)), hTrackWidget, SLOT(update()));
connect(peakThresholdSlider, SIGNAL(valueChanged(int)), this, SLOT(setPeakThreshold(int)));
connect(rotateYWheel, SIGNAL(valueChanged(double)), hTrackWidget, SLOT(setViewAngleVertical(double)));
connect(rotateYWheel, SIGNAL(valueChanged(double)), hTrackWidget, SLOT(update()));
connect(hTrackWidget, SIGNAL(viewAngleVerticalChanged(double)), rotateYWheel, SLOT(setValue(double)));
connect(distanceWheel, SIGNAL(valueChanged(double)), hTrackWidget, SLOT(setDistanceAway(double)));
connect(distanceWheel, SIGNAL(valueChanged(double)), hTrackWidget, SLOT(update()));
connect(hTrackWidget, SIGNAL(distanceAwayChanged(double)), distanceWheel, SLOT(setValue(double)));
connect(rotateXWheel, SIGNAL(valueChanged(double)), hTrackWidget, SLOT(setViewAngleHorizontal(double)));
connect(rotateXWheel, SIGNAL(valueChanged(double)), hTrackWidget, SLOT(update()));
connect(hTrackWidget, SIGNAL(viewAngleHorizontalChanged(double)), rotateXWheel, SLOT(setValue(double)));
connect(homeButton, SIGNAL(clicked()), hTrackWidget, SLOT(home()));
}
示例6: TAAWidget
CallWizard::CallWizard
(
QWidget* parent,
const char* name
) : TAAWidget(parent)
{
setCaption("Call Logger");
titleBar = new QStatusBar(this);
titleBar->setSizeGripEnabled(false);
titleBar->message("Call Logger");
QLabel *hline1 = new QLabel(this);
hline1->setFrameStyle(Q3Frame::HLine|Q3Frame::Sunken);
hline1->setMaximumHeight(3);
hangupButton = new QPushButton(this, "Hangup Button");
hangupButton->setText("Han&g Up");
connect(hangupButton, SIGNAL(clicked()), this, SLOT(stopTimer()));
transferButton = new QPushButton(this, "Transfer Button");
transferButton->setText("&Transfer");
transferButton->hide();
proceedButton = new QPushButton(this, "Proceed Button");
proceedButton->setText("&Proceed");
QLabel *hline2 = new QLabel(this);
hline2->setFrameStyle(Q3Frame::HLine|Q3Frame::Sunken);
hline2->setMaximumHeight(3);
status = new QStatusBar(this);
status->message("Status bar here.");
mainArea = new Q3WidgetStack(this);
typeSel = new CallTypeSelector(mainArea, "CallTypeSelector");
mainArea->addWidget(typeSel, 0);
mainArea->raiseWidget(0);
// Now, do the layout for the widget.
Q3BoxLayout *ml = new Q3BoxLayout(this, Q3BoxLayout::TopToBottom, 0, 3);
ml->addWidget(titleBar, 0);
ml->addWidget(hline1, 0);
ml->addWidget(mainArea, 1);
Q3BoxLayout *butlay = new Q3BoxLayout(Q3BoxLayout::LeftToRight, 3);
butlay->addStretch(1);
butlay->addWidget(hangupButton, 0);
butlay->addWidget(transferButton, 0);
butlay->addWidget(proceedButton, 0);
butlay->addSpacing(3);
ml->addLayout(butlay, 0);
ml->addWidget(hline2, 0);
ml->addWidget(status, 0);
callStart = QDateTime::currentDateTime();
callEnd = QDateTime::currentDateTime();
clockLCD = new QLCDNumber(status, "Clock Timer");
clockLCD->setMode(QLCDNumber::DEC);
clockLCD->setSegmentStyle(QLCDNumber::Flat);
clockLCD->setNumDigits(7);
clockLCD->display("0:00:00");
status->addWidget(clockLCD, 0, true);
clockTimer = new QTimer(this);
connect(clockTimer, SIGNAL(timeout()), this, SLOT(updateClock()));
clockTimer->start(1000);
timerRunning = 1;
// Make it the same width as an 80 column wide RXVT terminal window.
resize(499, 385);
}
示例7: TAAWidget
//.........这里部分代码省略.........
voidChargeButton = new QPushButton(this);
voidChargeButton->setText("&Void");
connect(voidChargeButton, SIGNAL(clicked()), this, SLOT(voidCustCharge()));
voidChargeButton->setEnabled(false);
delChargeButton = new QPushButton(this);
delChargeButton->setText("&Delete");
connect(delChargeButton, SIGNAL(clicked()), this, SLOT(delCustCharge()));
editChargeButton = new QPushButton(this);
editChargeButton->setText("&Edit");
connect(editChargeButton, SIGNAL(clicked()), this, SLOT(editCustCharge()));
editChargeButton->setEnabled(false);
newChargeButton = new QPushButton(this);
newChargeButton->setText("&New");
connect(newChargeButton, SIGNAL(clicked()), this, SLOT(newCustCharge()));
QPushButton *closeButton = new QPushButton(this);
closeButton->setText("&Close");
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
// Now, create our layouts
Q3BoxLayout *ml = new Q3BoxLayout(this, Q3BoxLayout::TopToBottom, 3, 3);
// The text label layouts
Q3GridLayout *tl = new Q3GridLayout(2, 4, 3);
tl->setColStretch(0, 0);
tl->setColStretch(1, 1);
tl->setColStretch(2, 0);
tl->setColStretch(3, 1);
tl->setRowStretch(0, 0);
tl->setRowStretch(1, 0);
tl->addWidget(custNameLabel, 0, 0);
tl->addWidget(customerName, 0, 1);
tl->addWidget(customerBalanceLabel, 0, 2);
tl->addWidget(currentBalanceArea, 0, 3);
tl->addWidget(customerIDLabel, 1, 0);
tl->addWidget(custIDLabel, 1, 1);
tl->addWidget(customerStatusLabel, 1, 2);
tl->addWidget(customerStatus, 1, 3);
ml->addLayout(tl, 0);
ml->addWidget(list, 1);
// Now, our button area
Q3BoxLayout *bl = new Q3BoxLayout(Q3BoxLayout::LeftToRight, 3);
bl->addStretch(1);
bl->addWidget(printButton, 0);
bl->addWidget(voidChargeButton, 0);
bl->addWidget(delChargeButton, 0);
bl->addWidget(editChargeButton, 0);
bl->addWidget(newChargeButton, 0);
bl->addSpacing(10);
bl->addWidget(closeButton, 0);
ml->addLayout(bl, 0);
CustomersDB CDB;
char tmpStr[1024];
CDB.get(myCustID);
customerName->setText(CDB.getStr("FullName"));
custIDLabel->setText(CDB.getStr("CustomerID"));
sprintf(tmpStr, "$%.2f", CDB.getFloat("CurrentBalance"));
currentBalanceArea->setText(tmpStr);
if (CDB.getInt("Active")) {
strcpy(tmpStr, "Active");
} else {
strcpy(tmpStr, "Inactive");
}
customerStatus->setText(tmpStr);
sprintf(tmpStr, "Register for %s (%ld)", (const char *) CDB.getStr("FullName"), myCustID);
setCaption(tmpStr);
if (!isManager()) {
newChargeButton->hide();
editChargeButton->hide();
delChargeButton->hide();
voidChargeButton->hide();
}
//list->setSorting(7, TRUE); // Sort by the internal transaction ID to
// make sure that our total works.
// The numeric columns should be aligned to the right.
list->setAllColumnsShowFocus(TRUE);
refreshRegister(1);
}