本文整理汇总了C++中QTabWidget::setMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabWidget::setMinimumSize方法的具体用法?C++ QTabWidget::setMinimumSize怎么用?C++ QTabWidget::setMinimumSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTabWidget
的用法示例。
在下文中一共展示了QTabWidget::setMinimumSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: constructWindow
void mixer_main::constructWindow()
{
Controller *contP = &controller;
QDesktopWidget *desktop = new QDesktopWidget();
QRect screen = desktop->availableGeometry(this);
this->setFixedSize(screen.width(),screen.height()-50);
//Tab Object
QTabWidget *tabs = new QTabWidget(this);
tabs->setMinimumSize(screen.width(), screen.height()-50);
tabs->setStyleSheet("QTabBar::tab { background: white; border: 2px solid black; } QTabBar::tab:selected { background: qlineargradient(x1: 0, y1: 1, x2: 0, y2: 0,"
"stop: 0 #FF0000, stop: 0.8 #FFFFFF); }");
//Widgets used as frames for Scroll Areas
QWidget *main1 = new QWidget();
QWidget *main2 = new QWidget();
QWidget *main3 = new QWidget();
QWidget *main4 = new QWidget();
//Mixer Objects
mix1 = new Mixer(0, 26, contP);
mix2 = new Mixer(1, 28, contP);
mix3 = new Mixer(2, 30, contP);
mix4 = new Mixer(3, 32, contP);
//Scroll Area Objects
QFingerScrollArea *mix1slide = new QFingerScrollArea(main1);
QFingerScrollArea *mix2slide = new QFingerScrollArea(main2);
QFingerScrollArea *mix3slide = new QFingerScrollArea(main3);
QFingerScrollArea *mix4slide = new QFingerScrollArea(main4);
//Setting Scroll Area targets and size
mix1slide->setWidget(mix1);
mix2slide->setWidget(mix2);
mix3slide->setWidget(mix3);
mix4slide->setWidget(mix4);
mix1slide->setMinimumSize(screen.width()-30, screen.height()-30);
mix2slide->setMinimumSize(screen.width()-30, screen.height()-30);
mix3slide->setMinimumSize(screen.width()-30, screen.height()-30);
mix4slide->setMinimumSize(screen.width()-30, screen.height()-30);
//Show Scroll Areas
mix1slide->show();
mix2slide->show();
mix3slide->show();
mix4slide->show();
//Add Frames to tab object
tabs->addTab(main1, "Mix 1");
tabs->addTab(main2, "Mix 2");
tabs->addTab(main3, "Mix 3");
tabs->addTab(main4, "Mix 4");
connect(tabs,SIGNAL(currentChanged(int)),this,SLOT(saveAndLoadArray(int)));
}
示例2: dynamicNormalizerGuiMain
static int dynamicNormalizerGuiMain(int argc, char* argv[])
{
uint32_t versionMajor, versionMinor, versionPatch;
MDynamicAudioNormalizer::getVersionInfo(versionMajor, versionMinor, versionPatch);
//initialize application
QApplication app(argc, argv);
app.setWindowIcon(QIcon(":/res/chart_curve.png"));
app.setStyle(new QPlastiqueStyle());
//create basic tab widget
QTabWidget window;
window.setWindowTitle(QString("Dynamic Audio Normalizer - Log Viewer [%1]").arg(QString().sprintf("v%u.%02u-%u", versionMajor, versionMinor, versionPatch)));
window.setMinimumSize(640, 480);
window.show();
//get arguments
const QStringList args = app.arguments();
//choose input file
const QString logFileName = (args.size() < 2) ? QFileDialog::getOpenFileName(&window, "Open Log File", QString(), QString("Log File (*.log)")) : args.at(1);
if(logFileName.isEmpty())
{
return EXIT_FAILURE;
}
//check for existence
if(!(QFileInfo(logFileName).exists() && QFileInfo(logFileName).isFile()))
{
QMessageBox::critical(&window, QString().sprintf("Dynamic Audio Normalizer"), QString("Error: The specified log file could not be found!"));
return EXIT_FAILURE;
}
//open the input file
QFile logFile(logFileName);
if(!logFile.open(QIODevice::ReadOnly | QIODevice::Text))
{
QMessageBox::critical(&window, QString().sprintf("Dynamic Audio Normalizer"), QString("Error: The selected log file could not opened for reading!"));
return EXIT_FAILURE;
}
//wrap into text stream
QTextStream textStream(&logFile);
textStream.setCodec("UTF-8");
double minValue = DBL_MAX;
double maxValue = 0.0;
unsigned int channels = 0;
//parse header
if(!parseHeader(textStream, channels))
{
QMessageBox::critical(&window, QString("Dynamic Audio Normalizer"), QString("Error: Failed to parse the header of the log file!\nProbably the file is of an unsupported type."));
return EXIT_FAILURE;
}
//allocate buffers
LogFileData *data = new LogFileData[channels];
QCustomPlot *plot = new QCustomPlot[channels];
//load data
parseData(textStream, channels, data, minValue, maxValue);
logFile.close();
//check data
if((data[0].original.size() < 1) || (data[0].minimal.size() < 1) || (data[0].smoothed.size() < 1))
{
QMessageBox::critical(&window, QString("Dynamic Audio Normalizer"), QString("Error: Failed to load data. Log file countains no valid data!"));
delete [] data;
delete [] plot;
return EXIT_FAILURE;
}
//determine length of data
unsigned int length = UINT_MAX;
for(unsigned int c = 0; c < channels; c++)
{
length = qMin(length, (unsigned int) data[c].original.count());
length = qMin(length, (unsigned int) data[c].minimal .count());
length = qMin(length, (unsigned int) data[c].smoothed.count());
}
//create x-axis steps
QVector<double> steps(length);
for(unsigned int i = 0; i < length; i++)
{
steps[i] = double(i);
}
//now create the plots
for(unsigned int c = 0; c < channels; c++)
{
//init the legend
plot[c].legend->setVisible(true);
plot[c].legend->setFont(QFont("Helvetica", 9));
//create graph and assign data to it:
createGraph(&plot[c], steps, data[c].original, Qt::blue, Qt::SolidLine, 1);
createGraph(&plot[c], steps, data[c].minimal, Qt::green, Qt::SolidLine, 1);
createGraph(&plot[c], steps, data[c].smoothed, Qt::red, Qt::DashLine, 2);
//.........这里部分代码省略.........
示例3: QWidget
PolygonView::PolygonView(PinEditDoc * doc, QWidget * parent, const char * name, Qt::WFlags f)
: QWidget(parent, name, f) {
assert(doc != NULL);
p_Doc = doc;
p_Shape = NULL;
p_Polygon = NULL;
m_bSelectionChanged = true;
p_Doc->registerUpdateable(this, "polygon");
p_Doc->registerRebuildable(this, "polygon");
// the polygon list view
p_PolygonListView = new Q3ListView(this);
connect(p_PolygonListView, SIGNAL(selectionChanged()), this, SLOT(slotChanged()));
p_PolygonListView->setSelectionMode(Q3ListView::Extended);
p_PolygonListView->addColumn(QString("polygons"));
p_PolygonListView->setMinimumSize(200, 240);
// the vertex list view
p_VertexListView = new Q3ListView(this);
connect(p_VertexListView, SIGNAL(selectionChanged()), this, SLOT(slotVertexChanged()));
p_VertexListView->setSelectionMode(Q3ListView::Single);
p_VertexListView->addColumn(QString("vertices for polygon"));
p_VertexListView->setMinimumSize(200, 80);
// tabs and widgets
QTabWidget * tabWidget = new QTabWidget(this);
//tabWidget->setFixedSize(200, 80);
tabWidget->setMinimumSize(200, 80);
// main layout
Q3BoxLayout * vlayout = new Q3VBoxLayout(this);
vlayout->addWidget(p_PolygonListView);
vlayout->addWidget(p_VertexListView);
vlayout->addWidget(tabWidget);
vlayout->setStretchFactor(p_PolygonListView, 3);
vlayout->setStretchFactor(p_PolygonListView, 2);
vlayout->setStretchFactor(tabWidget, 0);
// the vertex order widget
{
QWidget * widget = new QWidget(this);
tabWidget->addTab(widget, "order");
p_ButtonUp = new QPushButton("up", widget);
connect(p_ButtonUp, SIGNAL(clicked()), this, SLOT(slotVertexUp()));
p_ButtonDown = new QPushButton("down", widget);
connect(p_ButtonDown, SIGNAL(clicked()), this, SLOT(slotVertexDown()));
Q3BoxLayout * layout = new Q3HBoxLayout(widget);
layout->addWidget(p_ButtonUp);
layout->addWidget(p_ButtonDown);
}
// the position widget
{
QWidget * widget = new QWidget(this);
tabWidget->addTab(widget, "position");
p_EditX = new QLineEdit(widget);
p_EditY = new QLineEdit(widget);
p_EditZ = new QLineEdit(widget);
connect(p_EditX, SIGNAL(returnPressed()), this, SLOT(slotApplyVertex()));
connect(p_EditY, SIGNAL(returnPressed()), this, SLOT(slotApplyVertex()));
connect(p_EditZ, SIGNAL(returnPressed()), this, SLOT(slotApplyVertex()));
p_ApplyVertexButton = new QPushButton("apply", widget);
connect(p_ApplyVertexButton, SIGNAL(clicked()), this, SLOT(slotApplyVertex()));
Q3BoxLayout * vlayoutc = new Q3VBoxLayout(widget);
Q3BoxLayout * hlayout = new Q3HBoxLayout(vlayoutc);
hlayout->addWidget(p_EditX);
hlayout->addWidget(p_EditY);
hlayout->addWidget(p_EditZ);
vlayoutc->addWidget(p_ApplyVertexButton);
}
// the color widget
{
QWidget * widget = new QWidget(this);
tabWidget->addTab(widget, "color");
p_EditR = new QLineEdit(widget);
p_EditG = new QLineEdit(widget);
p_EditB = new QLineEdit(widget);
p_EditA = new QLineEdit(widget);
connect(p_EditR, SIGNAL(returnPressed()), this, SLOT(slotApplyColor()));
connect(p_EditG, SIGNAL(returnPressed()), this, SLOT(slotApplyColor()));
connect(p_EditB, SIGNAL(returnPressed()), this, SLOT(slotApplyColor()));
connect(p_EditA, SIGNAL(returnPressed()), this, SLOT(slotApplyColor()));
p_ApplyColorButton = new QPushButton("apply", widget);
connect(p_ApplyColorButton, SIGNAL(clicked()), this, SLOT(slotApplyColor()));
Q3BoxLayout * vlayoutc = new Q3VBoxLayout(widget);
Q3BoxLayout * hlayoutb = new Q3HBoxLayout(vlayoutc);
hlayoutb->addWidget(p_EditR);
hlayoutb->addWidget(p_EditG);
hlayoutb->addWidget(p_EditB);
hlayoutb->addWidget(p_EditA);
vlayoutc->addWidget(p_ApplyColorButton);
}
// properties widget
{
QWidget * widget = new QWidget(this);
tabWidget->addTab(widget, "prop");
//.........这里部分代码省略.........
示例4: QMainWindow
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
browser_ = new WebBrowser;
browser_->loadSettings();
browser_->GoHome();
//setCentralWidget(browser_);
// PESTAÑAS
QTabWidget *tabWidgetMainWindow = new QTabWidget(this);
tabWidgetMainWindow->setMinimumSize(800,600);
tabWidgetMainWindow->addTab(browser_, "Pestaña 1");
tabWidgetMainWindow->addTab(new WebBrowser, "Pestaña 2");
tabWidgetMainWindow->setCurrentIndex(1);
tabWidgetMainWindow->show();
setCentralWidget(tabWidgetMainWindow);
zoomVar = 1; // inicialización del zoom
// inicializamos los menus
mainMenu_ = new QMenuBar(this);
setMenuBar(mainMenu_);
mnuArchivo_ = new QMenu(tr("&Archivo"), this);
//mainMenu_ -> addMenu(mnuArchivo_);
mnuEditar_ = new QMenu(tr("&Editar"), this);
//mainMenu_ -> addMenu(mnuEditar_);
mnuVer_ = new QMenu(tr("&Ver"), this);
mainMenu_ -> addMenu(mnuVer_);
actPlusZoom = new QAction(tr("&Aumentar zoom"), this);
actPlusZoom -> setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Plus));
mnuVer_->addAction(actPlusZoom);
connect(actPlusZoom, SIGNAL(triggered()), this, SLOT(setPlusZoom()));
actMinusZoom_ = new QAction(tr("&Disminuir zoom"), this);
actMinusZoom_ -> setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Minus));
mnuVer_->addAction(actMinusZoom_);
connect(actMinusZoom_, SIGNAL(triggered()), this, SLOT(setMinusZoom()));
mnuMarcadores_ = new QMenu(tr("&Marcadores"), this);
mainMenu_ -> addMenu(mnuMarcadores_);
actAddBookmark_ = new QAction(tr("&Añadir a marcadores"), this);
actAddBookmark_ -> setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_O));
mnuMarcadores_->addAction(actAddBookmark_);
connect(actAddBookmark_, SIGNAL(triggered()), this, SLOT(addMarcador()));
mnuHerramientas_ = new QMenu(tr("&Herramientas"), this);
mainMenu_ -> addMenu(mnuHerramientas_);
actSetHomepage_ = new QAction(tr("Establecer como pagina principal"), this);
mnuHerramientas_->addAction(actSetHomepage_);
connect(actSetHomepage_, SIGNAL(triggered()), browser_, SLOT(setHomepage()));
mnuHistorial_ = new QMenu(tr("&Historial"), this);
mainMenu_ -> addMenu(mnuHistorial_);
actDeleteHistory_ = new QAction(tr("&Borrar el historial"), this);
actDeleteHistory_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
mnuHistorial_->addAction(actDeleteHistory_);
connect(actDeleteHistory_, SIGNAL(triggered()), this, SLOT(deleteHistory()));
showHistory();
readBookmarkFile();
for (int i = 0; i < bookmarkList.size(); ++i) {
QAction* tmp = new QAction(tr(bookmarkList.at(i).toLocal8Bit().constData()), this);
mnuMarcadores_->addAction(tmp);
connect(tmp,SIGNAL(triggered()),this,SLOT(PulsarMarcador()));
}
}