本文整理汇总了C++中resize函数的典型用法代码示例。如果您正苦于以下问题:C++ resize函数的具体用法?C++ resize怎么用?C++ resize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setObjectName
//.........这里部分代码省略.........
startButton->setObjectName(QString::fromUtf8("startButton"));
sizePol.setHeightForWidth(startButton->sizePolicy().hasHeightForWidth());
startButton->setSizePolicy(sizePol);
startButton->setText("Run");
connect(startButton,SIGNAL(clicked()), this, SLOT(timerRun()));
splitter2->addWidget(startButton);
vboxLayout0->addWidget(splitter2);
tabWidget->addTab(tab_0, QApplication::translate("MainWindow", "PMS Panel", 0, QApplication::UnicodeUTF8));
menubar = new QMenuBar(this);
menubar->setObjectName(QString::fromUtf8("menubar"));
menubar->setGeometry(QRect(0, 0, 1280, 30));
menu_File = new QMenu(menubar);
menu_File->setObjectName(QString::fromUtf8("menu_File"));
menu_Util = new QMenu(menubar);
menu_Util->setObjectName(QString::fromUtf8("menu_Util"));
menu_Help = new QMenu(menubar);
menu_Help->setObjectName(QString::fromUtf8("menu_Help"));
setMenuBar(menubar);
QLabel *slabel1 = new QLabel("Set your mouse on the dynamic value to read PVNAME.");
slabel1->setAlignment(Qt::AlignHCenter);
slabel1->setMinimumSize(slabel1->sizeHint());
slabel1->setFrameStyle(QFrame::Panel | QFrame::Plain);
QFrame *sframe = new QFrame();
QVBoxLayout *svlayout = new QVBoxLayout(sframe);
svlayout->setSpacing(1);
svlayout->setMargin(2);
statusBar()->addWidget(sframe,1);
toolBar = new QToolBar(this);
toolBar->setObjectName(QString::fromUtf8("toolBar"));
QPalette palette;
QBrush brush(QColor(108, 147, 255, 100));
brush.setStyle(Qt::SolidPattern);
palette.setBrush(QPalette::Active, QPalette::Base, brush);
palette.setBrush(QPalette::Active, QPalette::AlternateBase, brush);
QBrush brush1(QColor(44, 51, 91, 100));
brush1.setStyle(Qt::SolidPattern);
palette.setBrush(QPalette::Active, QPalette::Window, brush1);
QBrush brush2(QColor(108, 147, 255, 100));
brush2.setStyle(Qt::SolidPattern);
palette.setBrush(QPalette::Inactive, QPalette::Base, brush2);
QBrush brush3(QColor(44, 51, 91, 100));
brush3.setStyle(Qt::SolidPattern);
palette.setBrush(QPalette::Inactive, QPalette::Window, brush3);
QBrush brush4(QColor(44, 51, 91, 100));
brush4.setStyle(Qt::SolidPattern);
palette.setBrush(QPalette::Disabled, QPalette::Base, brush4);
QBrush brush5(QColor(44, 51, 91, 100));
brush5.setStyle(Qt::SolidPattern);
palette.setBrush(QPalette::Disabled, QPalette::Window, brush5);
toolBar->setPalette(palette);
toolBar->setOrientation(Qt::Horizontal);
addToolBar(static_cast<Qt::ToolBarArea>(4), toolBar);
menubar->addAction(menu_File->menuAction());
menubar->addAction(menu_Util->menuAction());
menubar->addSeparator();
menubar->addAction(menu_Help->menuAction());
menu_File->addAction(action_Exit);
QSize size(1280, 1024);
size = size.expandedTo(minimumSizeHint());
resize(size);
tabWidget->setCurrentIndex(0);
QMetaObject::connectSlotsByName(this);
msgframe = new QFrame(centralwidget);
msgframe->setObjectName(QString::fromUtf8("msgframe"));
QSizePolicy sizePolicy4(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(5));
sizePolicy4.setHorizontalStretch(0);
sizePolicy4.setVerticalStretch(0);
msgframe->setGeometry(QRect(19, 820, 1255, 90));
//msgframe->setSizePolicy(sizePolicy4);
//msgframe->setGeometry(QRect(18, 880, 1254, 70));
//msgframe->setMinimumSize(QSize(1164, 90));
//msgframe->setFrameShape(QFrame::StyledPanel);
//msgframe->setFrameShadow(QFrame::Raised);
setCentralWidget(centralwidget);
QObject::connect(tabWidget, SIGNAL(currentChanged(int)), SLOT(setDefaultIndex(int)));
// Set Object Text.
setWindowTitle(QApplication::translate("MainWindow", "PMS (Plant Monitoring System)", 0, QApplication::UnicodeUTF8));
action_Exit->setText(QApplication::translate("MainWindow", "e&Xit", 0, QApplication::UnicodeUTF8));
tabWidget->setTabText(tabWidget->indexOf(tab_0), QApplication::translate("MainWindow", "PMS Data Retrieval", 0, QApplication::UnicodeUTF8));
menu_File->setTitle(QApplication::translate("MainWindow", "&File", 0, QApplication::UnicodeUTF8));
menu_Util->setTitle(QApplication::translate("MainWindow", "&Util", 0, QApplication::UnicodeUTF8));
menu_Help->setTitle(QApplication::translate("MainWindow", "&Help", 0, QApplication::UnicodeUTF8));
} // makeUI
示例2: QDialog
LoremManager::LoremManager(ScribusDoc* doc, QWidget* parent) : QDialog( parent )
{
m_Doc=doc;
setModal(true);
setWindowTitle( tr( "Lorem Ipsum" ) );
setWindowIcon(QIcon(loadIcon ( "AppIcon.png" )));
LoremManagerLayout = new QGridLayout(this) ;
LoremManagerLayout->setMargin(10);
LoremManagerLayout->setSpacing(5);
layout3 = new QVBoxLayout;
layout3->setMargin(0);
layout3->setSpacing(5);
loremList = new QTreeWidget( this );
loremList->setRootIsDecorated(true);
loremList->setColumnCount(1);
loremList->setHeaderLabel( tr("Select Lorem Ipsum"));
loremList->header()->setClickable( false );
loremList->header()->setResizeMode( QHeaderView::ResizeToContents );
loremList->setSelectionMode(QAbstractItemView::SingleSelection);
layout3->addWidget( loremList );
layout2 = new QHBoxLayout;
layout2->setMargin(0);
layout2->setSpacing(5);
paraLabel = new QLabel( this );
layout2->addWidget( paraLabel );
paraBox = new QSpinBox( this );
paraBox->setMinimum( 1 );
paraBox->setValue(PrefsManager::instance()->appPrefs.miscPrefs.paragraphsLI);
layout2->addWidget( paraBox );
randomCheckBox = new QCheckBox(this);
randomCheckBox->setChecked(true);
layout2->addWidget( randomCheckBox );
paraSpacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout2->addItem( paraSpacer );
layout3->addLayout( layout2 );
layout1 = new QHBoxLayout;
layout1->setMargin(0);
layout1->setSpacing(5);
buttonSpacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
layout1->addItem( buttonSpacer );
okButton = new QPushButton( this );
layout1->addWidget( okButton );
cancelButton = new QPushButton( this );
layout1->addWidget( cancelButton );
layout3->addLayout( layout1 );
LoremManagerLayout->addLayout( layout3, 0, 0 );
languageChange();
// reading lorems
QDir d(getLoremLocation(QString::null), "*.xml");
QFileInfoList list = d.entryInfoList();
QListIterator<QFileInfo> it(list);
QFileInfo fi;
LanguageManager * langmgr( LanguageManager::instance() );
// langmgr->init(false);
while (it.hasNext())
{
fi = it.next();
if (langmgr->getLangFromAbbrev(fi.baseName(), false).isEmpty())
continue;
LoremParser *parser = new LoremParser(fi.fileName());
if (!parser->correct)
{
delete parser;
continue;
}
availableLorems[parser->name] = fi.fileName();
QTreeWidgetItem *item = new QTreeWidgetItem(loremList);
if (parser->name=="la")
item->setText(0, standardloremtext);
else
item->setText(0, langmgr->getLangFromAbbrev(parser->name, true));
QTreeWidgetItem *subItem;
subItem = new QTreeWidgetItem(item);
subItem->setText(0, tr("Author:") + " " + parser->author);
subItem = new QTreeWidgetItem(item);
subItem->setText(0, tr("Get More:") + " " + parser->url);
subItem = new QTreeWidgetItem(item);
subItem->setText(0, tr("XML File:") + " " + fi.fileName());
delete parser;
}
loremList->sortItems(0, Qt::AscendingOrder);
loremList->setSortingEnabled(false);
resize( QSize(320, 340).expandedTo(minimumSizeHint()) );
QList<QTreeWidgetItem *> defItem;
defItem.clear();
defItem = loremList->findItems(langmgr->getTransLangFromLang(m_Doc->Language), Qt::MatchExactly);
if (defItem.count() == 0)
defItem = loremList->findItems(standardloremtext, Qt::MatchExactly);
//.........这里部分代码省略.........
示例3: QDialog
MainDialog::MainDialog(QWidget *parent)
: QDialog(parent)
, mHostEdit(new QLineEdit)
, mPortEdit(new QLineEdit)
, mUserEdit(new QLineEdit)
, mPswdEdit(new QLineEdit)
, mLAddrEdit(new QLineEdit)
, mLPortEdit(new QLineEdit)
, mWaitEdit(new QLineEdit)
, mCtrlBtn(new QPushButton(tr("Start")))
, mQuitBtn(new QPushButton(tr("Quit")))
, mLogList(new QListWidget)
, mInfoIcon(QPixmap(":/icon-info.png"))
, mWarnIcon(QPixmap(":/icon-warn.png"))
, mErrorIcon(QPixmap(":/icon-error.png"))
, mStoppedIcon(QPixmap(":/icon-stopped.png"))
, mConnectingIcon(QPixmap(":/icon-connecting.png"))
, mConnectedIcon(QPixmap(":/icon-connected.png"))
, mSleepingIcon(QPixmap(":/icon-sleeping.png"))
, mSettings(new QSettings(QSettings::IniFormat, QSettings::UserScope,
"glacjay", "sshproxy", this))
, mIsKeepRunning(false)
, mProcess(new QProcess(this))
, mRestartTimer(new QTimer(this))
{
setWindowTitle(tr("SSH Proxy"));
setWindowIcon(mConnectedIcon);
mHostEdit->setText(mSettings->value("ssh/host").toString());
mPortEdit->setText(mSettings->value("ssh/port", "22").toString());
mUserEdit->setText(mSettings->value("ssh/user").toString());
mLAddrEdit->setText(mSettings->value("ssh/laddr", "127.0.0.1").toString());
mLPortEdit->setText(mSettings->value("ssh/lport", "1077").toString());
mWaitEdit->setText(mSettings->value("ssh/wait", "10").toString());
mPortEdit->setValidator(new QIntValidator(1, 65535));
mPswdEdit->setEchoMode(QLineEdit::Password);
mLPortEdit->setValidator(new QIntValidator(1, 65535));
mWaitEdit->setValidator(new QIntValidator);
mLogList->setWordWrap(true);
mProcess->setProcessChannelMode(QProcess::MergedChannels);
QLabel *hostLabel = new QLabel(tr("SSH Host:"));
hostLabel->setBuddy(mHostEdit);
QLabel *portLabel = new QLabel(tr("SSH Port:"));
portLabel->setBuddy(mPortEdit);
QLabel *userLabel = new QLabel(tr("Username:"));
userLabel->setBuddy(mUserEdit);
QLabel *pswdLabel = new QLabel(tr("Password:"));
pswdLabel->setBuddy(mPswdEdit);
QLabel *lAddrLabel = new QLabel(tr("Listen Addr:"));
lAddrLabel->setBuddy(mLAddrEdit);
QLabel *lPortLabel = new QLabel(tr("Listen Port:"));
lPortLabel->setBuddy(mLPortEdit);
QLabel *waitLabel = new QLabel(tr("Seconds wait to reconnect:"));
waitLabel->setBuddy(mWaitEdit);
QVBoxLayout *inputLayout = new QVBoxLayout;
inputLayout->addWidget(hostLabel);
inputLayout->addWidget(mHostEdit);
inputLayout->addWidget(portLabel);
inputLayout->addWidget(mPortEdit);
inputLayout->addWidget(userLabel);
inputLayout->addWidget(mUserEdit);
inputLayout->addWidget(pswdLabel);
inputLayout->addWidget(mPswdEdit);
inputLayout->addWidget(lAddrLabel);
inputLayout->addWidget(mLAddrEdit);
inputLayout->addWidget(lPortLabel);
inputLayout->addWidget(mLPortEdit);
inputLayout->addWidget(waitLabel);
inputLayout->addWidget(mWaitEdit);
inputLayout->insertStretch(-1);
inputLayout->addWidget(mCtrlBtn);
inputLayout->addWidget(mQuitBtn);
QGroupBox *inputGroup = new QGroupBox(tr("Settings"));
inputGroup->setLayout(inputLayout);
QVBoxLayout *logLayout = new QVBoxLayout;
logLayout->addWidget(mLogList);
QGroupBox *logGroup = new QGroupBox(tr("Log"));
logGroup->setLayout(logLayout);
QSplitter *splitter = new QSplitter(Qt::Horizontal);
splitter->addWidget(inputGroup);
splitter->addWidget(logGroup);
splitter->setStretchFactor(1, 5);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(splitter);
setLayout(mainLayout);
resize(1000, 600);
connect(mCtrlBtn, SIGNAL(clicked(void)), this, SLOT(on_mCtrlBtn_clicked(void)));
connect(mQuitBtn, SIGNAL(clicked(void)), this, SLOT(onQuit(void)));
//.........这里部分代码省略.........
示例4: resize
ShowWidget::ShowWidget(QWidget *parent)
:QWidget(parent)
{
resize(600,500);
this->setWindowTitle("Database");
this->setStyleSheet("background-color: rgb(0, 205, 255)");
view = new QTableView(this);
view->setGeometry(0,0,500,500);
view->setStyleSheet("background-color: white;color:black");
QVBoxLayout *vbox = new QVBoxLayout;
QHBoxLayout *hbox = new QHBoxLayout;
addButton = new QPushButton(this);
addButton->setText("添加");
addButton->setStyleSheet("background-color: rgb(15, 125, 254);");
removeButton = new QPushButton(this);
removeButton->setText("删除");
removeButton->setStyleSheet("background-color: rgb(15, 125, 254);");
changeButton = new QPushButton(this);
changeButton->setText("修改");
changeButton->setStyleSheet("background-color: rgb(15, 125, 254);");
findButton = new QPushButton(this);
findButton->setText("查找");
findButton->setStyleSheet("background-color: rgb(15, 125, 254);");
flushButton = new QPushButton(this);
flushButton->setText("刷新");
flushButton->setStyleSheet("background-color: rgb(15, 125, 254);");
vbox->addWidget(addButton);
vbox->addWidget(changeButton);
vbox->addWidget(removeButton);
vbox->addWidget(findButton);
vbox->addWidget(flushButton);
hbox->addWidget(view);
hbox->addLayout(vbox);
this->setLayout(hbox);
model = new QSqlRelationalTableModel;
model->setTable("student");
model->setSort(0,Qt::AscendingOrder);
model->setRelation(4,QSqlRelation("city","id","name"));
model->setHeaderData(0,Qt::Horizontal,"ID号");
model->setHeaderData(1, Qt::Horizontal, "姓名");
model->setHeaderData(2, Qt::Horizontal, "年龄");
model->setHeaderData(3, Qt::Horizontal, "专业");
model->setHeaderData(4, Qt::Horizontal, "城市");
model->select();
// model->removeColumn(0);
view->setModel(model);
// view->setSelectionMode(QAbstractItemView::NoEditTriggers);
view->setSelectionBehavior(QAbstractItemView::SelectRows);
QSqlQuery query;
/* query.exec("select name from student");
int num = 0;
while(query.next())
{
num++;
}
for(int i =0;i<=3;i++)
{
view->setColumnWidth(i,110);
}
for(int j = 0;j<num;j++)
{
view->setRowHeight(j,60);
}*/
// view->setItemDelegate(new QSqlRelationalDelegate(view));
connect(addButton,&QPushButton::clicked,this,&ShowWidget::addEvent);
connect(removeButton,&QPushButton::clicked,this,&ShowWidget::removeEvent);
connect(findButton,&QPushButton::clicked,this,&ShowWidget::findEvent);
connect(changeButton,&QPushButton::clicked,this,&ShowWidget::changeEvent);
connect(flushButton,&QPushButton::clicked,this,&ShowWidget::flushEvent);
}
示例5: QWidget
SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle) :
QWidget(0, f), curAlignment(0)
{
// set reference point, paddings
int paddingLeft = 14;
int paddingTop = 470;
int titleVersionVSpace = 17;
int titleCopyrightVSpace = 32;
float fontFactor = 1.0;
// define text to place
QString titleText = tr("Owncoin Core");
QString versionText = QString(tr("Version %1")).arg(QString::fromStdString(FormatFullVersion()));
QString copyrightTextBtc = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin Core developers"));
QString copyrightTextOwncoin = QChar(0xA9)+QString(" 2014-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Owncoin Core developers"));
QString titleAddText = networkStyle->getTitleAddText();
QString font = QApplication::font().toString();
// load the bitmap for writing some text over it
pixmap = networkStyle->getSplashImage();
QPainter pixPaint(&pixmap);
pixPaint.setPen(QColor(100,100,100));
// check font size and drawing with
pixPaint.setFont(QFont(font, 28*fontFactor));
QFontMetrics fm = pixPaint.fontMetrics();
int titleTextWidth = fm.width(titleText);
if(titleTextWidth > 160) {
// strange font rendering, Arial probably not found
fontFactor = 0.75;
}
pixPaint.setFont(QFont(font, 28*fontFactor));
fm = pixPaint.fontMetrics();
titleTextWidth = fm.width(titleText);
pixPaint.drawText(paddingLeft,paddingTop,titleText);
pixPaint.setFont(QFont(font, 15*fontFactor));
pixPaint.drawText(paddingLeft,paddingTop+titleVersionVSpace,versionText);
// draw copyright stuff
pixPaint.setFont(QFont(font, 10*fontFactor));
pixPaint.drawText(paddingLeft,paddingTop+titleCopyrightVSpace,copyrightTextBtc);
pixPaint.drawText(paddingLeft,paddingTop+titleCopyrightVSpace+12,copyrightTextOwncoin);
// draw additional text if special network
if(!titleAddText.isEmpty()) {
QFont boldFont = QFont(font, 10*fontFactor);
boldFont.setWeight(QFont::Bold);
pixPaint.setFont(boldFont);
fm = pixPaint.fontMetrics();
int titleAddTextWidth = fm.width(titleAddText);
pixPaint.drawText(pixmap.width()-titleAddTextWidth-10,pixmap.height()-25,titleAddText);
}
pixPaint.end();
// Set window title
setWindowTitle(titleText + " " + titleAddText);
// Resize window and move to center of desktop, disallow resizing
QRect r(QPoint(), pixmap.size());
resize(r.size());
setFixedSize(r.size());
move(QApplication::desktop()->screenGeometry().center() - r.center());
subscribeToCoreSignals();
}
示例6: toLong
ArbitraryInteger ArbitraryInteger::operator -=(long v){
cout << "-= long value " << toLong() << " same as ";
resize(sizeof(long));
cout << toLong() << endl;
}
示例8: QDialog
//.........这里部分代码省略.........
layerTable->setItem(info->layerInfo.count()-counter-1, 2, tW);
layerTable->setRowHeight(info->layerInfo.count()-counter-1, 40);
counter++;
}
tabLayout->addWidget( layerTable );
layerTable->setColumnWidth(1, 24 + col2Width);
layerTable->setColumnWidth(0, 24 + col1Width);
blendMode->setCurrentIndex(0);
// headerH->setResizeMode(QHeaderView::Fixed);
propsTab->addTab( tab, tr( "Layers" ) );
}
tab_2 = new QWidget( propsTab );
tabLayout_2 = new QVBoxLayout( tab_2 );
tabLayout_2->setMargin(6);
tabLayout_2->setSpacing(6);
pathList = new QListWidget( tab_2 );
pathList->clear();
pathList->setIconSize(QSize(40, 40));
QMap<QString, FPointArray>::Iterator it;
if (info->PDSpathData.count() != 0)
{
for (it = info->PDSpathData.begin(); it != info->PDSpathData.end(); ++it)
{
QImage pixm(40, 40, QImage::Format_ARGB32_Premultiplied);
ScPainter *p = new ScPainter(&pixm, 40, 40);
p->clear();
p->translate(3.0, 3.0);
if (it.key() == info->clipPath)
{
pixm.fill(Qt::green);
p->clear(Qt::green);
}
else
pixm.fill(Qt::white);
FPointArray Path;
Path.resize(0);
Path = info->PDSpathData[it.key()].copy();
FPoint min = getMinClipF(&Path);
Path.translate(-min.x(), -min.y());
FPoint max = Path.WidthHeight();
QTransform mm;
mm.scale(34.0 / qMax(max.x(), max.y()), 34.0 / qMax(max.x(), max.y()));
Path.map(mm);
p->setupPolygon(&Path);
p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
p->setBrush(Qt::white);
p->setFillMode(ScPainter::None);
p->setStrokeMode(ScPainter::Solid);
p->strokePath();
p->end();
delete p;
QPixmap pm;
pm=QPixmap::fromImage(pixm);
new QListWidgetItem(QIcon(pm), it.key(), pathList);
if (it.key() == info->usedPath)
{
pathList->setCurrentRow(pathList->count()-1);
pathList->currentItem()->setSelected(true);
}
}
}
tabLayout_2->addWidget( pathList );
resetPath = new QPushButton( tr("Don't use any Path"), tab_2);
tabLayout_2->addWidget( resetPath );
propsTab->addTab( tab_2, tr( "Paths" ) );
ExtImagePropsLayout->addWidget( propsTab );
layoutBottom = new QHBoxLayout;
layoutBottom->setMargin(0);
layoutBottom->setSpacing(6);
livePreview = new QCheckBox( this );
livePreview->setText( tr( "Live Preview" ) );
livePreview->setChecked(true);
doPreview = true;
layoutBottom->addWidget( livePreview );
QSpacerItem* spacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
layoutBottom->addItem( spacer );
okButton = new QPushButton( CommonStrings::tr_OK, this );
layoutBottom->addWidget( okButton );
cancelButton = new QPushButton( CommonStrings::tr_Cancel, this );
cancelButton->setDefault( true );
layoutBottom->addWidget( cancelButton );
ExtImagePropsLayout->addLayout( layoutBottom );
resize(330, 320);
connect(pathList, SIGNAL( itemClicked(QListWidgetItem*) ), this, SLOT( selPath(QListWidgetItem*) ) );
connect(resetPath, SIGNAL(clicked()), this, SLOT(noPath()));
connect(livePreview, SIGNAL(clicked()), this, SLOT(changePreview()));
connect(okButton, SIGNAL(clicked()), this, SLOT(leaveOK()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(leaveCancel()));
if (info->layerInfo.count() != 0)
{
layerTable->selectionModel()->clearSelection();
opacitySpinBox->setEnabled(false);
blendMode->setEnabled(false);
connect(m_timer, SIGNAL(timeout()), this, SLOT(changedLayer()));
connect(layerTable, SIGNAL(itemSelectionChanged()), this, SLOT(selLayer()));
connect(opacitySpinBox, SIGNAL(valueChanged(double)), this, SLOT(delayedLayerChange()));
connect(blendMode, SIGNAL(activated(int)), this, SLOT(changedLayer()));
}
示例9: printf
//.........这里部分代码省略.........
for (int x = 0; x < textureRes; x++){
for (int y = 0; y < textureRes; y++){
int i = textureRes * y + x;
iconPrmData[i*4 + 0] = -0.5; // colorType
iconPrmData[i*4 + 1] = -0.5; // iconType
iconPrmData[i*4 + 2] = 0.0;
iconPrmData[i*4 + 3] = 0.0;
}
}
iconPrmTex.setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);
iconPrmTex.loadData(iconPrmData, textureRes, textureRes, GL_RGBA);
//spring
springPrmData = new float[numParticles*4];
for (int x = 0; x < textureRes; x++){
for (int y = 0; y < textureRes; y++){
int i = textureRes * y + x;
springPrmData[i*4 + 0] = ofRandom(0.06, 0.12); // K
springPrmData[i*4 + 1] = ofRandom(0.2, 0.35); // topSpeed
springPrmData[i*4 + 2] = ofRandom(0.001, 0.03); // minSpeed;
springPrmData[i*4 + 3] = 1.0; // attractOn
if(ofRandom(0, 100)>99){
springPrmData[i*4 + 2] = ofRandom(0.15, 0.2);
}
}
}
springPrmTex.setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);
springPrmTex.loadData(springPrmData, textureRes, textureRes, GL_RGBA);
// pos
posData = new float[numParticles*3];
for (int x = 0; x < textureRes; x++){
for (int y = 0; y < textureRes; y++){
int i = textureRes * y + x;
posData[i*3 + 0] = 0.0; //x;
posData[i*3 + 1] = 0.0; //y;
posData[i*3 + 2] = 0.0;
}
}
posPingPong.allocate(textureRes, textureRes, GL_RGB32F);
posPingPong.src->getTextureReference().loadData(posData, textureRes, textureRes, GL_RGB);
posPingPong.dst->getTextureReference().loadData(posData, textureRes, textureRes, GL_RGB);
// vel
velData = new float[numParticles*4];
for (int i = 0; i < numParticles; i++){
velData[i*4 + 0] = 0;
velData[i*4 + 1] = 0;
velData[i*4 + 2] = 0; //a
velData[i*4 + 3] = 0; //a
}
velPingPong.allocate(textureRes, textureRes,GL_RGBA32F);
velPingPong.src->getTextureReference().loadData(velData, textureRes, textureRes, GL_RGBA);
velPingPong.dst->getTextureReference().loadData(velData, textureRes, textureRes, GL_RGBA);
int w = ofGetWindowWidth();
int h = ofGetWindowHeight();
renderFBO.allocate(w, h, GL_RGB32F);
renderFBO.getTextureReference().setTextureMinMagFilter(GL_NEAREST, GL_NEAREST);
// renderFBO.getTextureReference().setTextureMinMagFilter(GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_NEAREST);
renderFBO.begin();
ofClear(0,0,0,0);
renderFBO.end();
//img128.getTextureReference().setTextureMinMagFilter(GL_LINEAR, GL_LINEAR); // flickering
//img128.getTextureReference().setTextureMinMagFilter(GL_NEAREST, GL_NEAREST); // sliced
//img128.getTextureReference().setTextureMinMagFilter(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR_MIPMAP_LINEAR); // not so good
//img128.getTextureReference().setTextureMinMagFilter(GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_NEAREST);
//img128.getTextureReference().setTextureMinMagFilter(GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_NEAREST);
//img128.getTextureReference().setTextureMinMagFilter(GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST_MIPMAP_LINEAR);
// img1.getTextureReference().setTextureMinMagFilter(GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST_MIPMAP_LINEAR);
// img2.getTextureReference().setTextureMinMagFilter(GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST_MIPMAP_LINEAR);
// img4.getTextureReference().setTextureMinMagFilter(GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST_MIPMAP_LINEAR);
// img8.getTextureReference().setTextureMinMagFilter(GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST_MIPMAP_LINEAR);
// img16.getTextureReference().setTextureMinMagFilter(GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST_MIPMAP_LINEAR);
// img32.getTextureReference().setTextureMinMagFilter(GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST_MIPMAP_LINEAR);
// img64.getTextureReference().setTextureMinMagFilter(GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST_MIPMAP_LINEAR);
// img128.getTextureReference().setTextureMinMagFilter(GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST_MIPMAP_LINEAR);
// texadv.allocate(testApp::getW(), testApp::getH(), GL_RGB);
//texId = renderFBO.getTextureReference().getTextureData().textureID;
resize(testApp::getW(), testApp::getH());
}
示例10: QDialog
AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *const options, RecentlyUsed *const recentlyUsed, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences)
:
QDialog(parent),
m_options(options),
m_recentlyUsed(recentlyUsed),
m_sysinfo(sysinfo),
m_preferences(preferences),
m_defaults(new OptionsModel(sysinfo)),
ui(new Ui::AddJobDialog()),
m_monitorConfigChanges(true)
{
//Init the dialog, from the .ui file
ui->setupUi(this);
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
//Fix dialog size
ui->buttonSaveTemplate->setMaximumHeight(20);
ui->buttonDeleteTemplate->setMaximumHeight(20);
resize(width(), minimumHeight());
setMinimumSize(size());
setMaximumHeight(height());
//Init combobox items
ui->cbxTuning ->addItem(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED));
ui->cbxProfile->addItem(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED));
//Hide optional controls
ui->checkBoxApplyToAll->setVisible(false);
//Monitor combobox changes
connect(ui->cbxEncoderType, SIGNAL(currentIndexChanged(int)), this, SLOT(encoderIndexChanged(int)));
connect(ui->cbxEncoderVariant, SIGNAL(currentIndexChanged(int)), this, SLOT(variantIndexChanged(int)));
connect(ui->cbxRateControlMode, SIGNAL(currentIndexChanged(int)), this, SLOT(modeIndexChanged(int)));
//Activate buttons
connect(ui->buttonBrowseSource, SIGNAL(clicked()), this, SLOT(browseButtonClicked()));
connect(ui->buttonBrowseOutput, SIGNAL(clicked()), this, SLOT(browseButtonClicked()));
connect(ui->buttonSaveTemplate, SIGNAL(clicked()), this, SLOT(saveTemplateButtonClicked()));
connect(ui->buttonDeleteTemplate, SIGNAL(clicked()), this, SLOT(deleteTemplateButtonClicked()));
//Setup validator
ui->editCustomX264Params->installEventFilter(this);
ui->editCustomX264Params->setValidator(new StringValidatorX264(ui->labelNotificationX264, ui->iconNotificationX264));
ui->editCustomX264Params->clear();
ui->editCustomAvs2YUVParams->installEventFilter(this);
ui->editCustomAvs2YUVParams->setValidator(new StringValidatorAvs2YUV(ui->labelNotificationAvs2YUV, ui->iconNotificationAvs2YUV));
ui->editCustomAvs2YUVParams->clear();
//Install event filter
ui->labelHelpScreenX264->installEventFilter(this);
ui->labelHelpScreenAvs2YUV->installEventFilter(this);
//Monitor for options changes
connect(ui->cbxEncoderType, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged()));
connect(ui->cbxEncoderArch, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged()));
connect(ui->cbxEncoderVariant, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged()));
connect(ui->cbxRateControlMode, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged()));
connect(ui->spinQuantizer, SIGNAL(valueChanged(double)), this, SLOT(configurationChanged()));
connect(ui->spinBitrate, SIGNAL(valueChanged(int)), this, SLOT(configurationChanged()));
connect(ui->cbxPreset, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged()));
connect(ui->cbxTuning, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged()));
connect(ui->cbxProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged()));
connect(ui->editCustomX264Params, SIGNAL(textChanged(QString)), this, SLOT(configurationChanged()));
connect(ui->editCustomAvs2YUVParams, SIGNAL(textChanged(QString)), this, SLOT(configurationChanged()));
//Create context menus
ADD_CONTEXTMENU_ACTION(ui->editCustomX264Params, QIcon(":/buttons/page_edit.png"), tr("Open the Text-Editor"), editorActionTriggered);
ADD_CONTEXTMENU_ACTION(ui->editCustomAvs2YUVParams, QIcon(":/buttons/page_edit.png"), tr("Open the Text-Editor"), editorActionTriggered);
ADD_CONTEXTMENU_SEPARATOR(ui->editCustomX264Params);
ADD_CONTEXTMENU_SEPARATOR(ui->editCustomAvs2YUVParams);
ADD_CONTEXTMENU_ACTION(ui->editCustomX264Params, QIcon(":/buttons/page_copy.png"), tr("Copy to Clipboard"), copyActionTriggered);
ADD_CONTEXTMENU_ACTION(ui->editCustomAvs2YUVParams, QIcon(":/buttons/page_copy.png"), tr("Copy to Clipboard"), copyActionTriggered);
ADD_CONTEXTMENU_ACTION(ui->editCustomX264Params, QIcon(":/buttons/page_paste.png"), tr("Paste from Clipboard"), pasteActionTriggered);
ADD_CONTEXTMENU_ACTION(ui->editCustomAvs2YUVParams, QIcon(":/buttons/page_paste.png"), tr("Paste from Clipboard"), pasteActionTriggered);
//Setup template selector
loadTemplateList();
connect(ui->cbxTemplate, SIGNAL(currentIndexChanged(int)), this, SLOT(templateSelected()));
}
示例11: geometry
void Widget::resizeWindow(QMouseEvent *e)
{
if (!Settings::getInstance().getUseNativeDecoration())
{
if (allowToResize)
{
int xMouse = e->pos().x();
int yMouse = e->pos().y();
int wWidth = geometry().width();
int wHeight = geometry().height();
if (cursor().shape() == Qt::SizeVerCursor)
{
if (resizeVerSup)
{
int newY = geometry().y() + yMouse;
int newHeight = wHeight - yMouse;
if (newHeight > minimumSizeHint().height())
{
resize(wWidth, newHeight);
move(geometry().x(), newY);
}
}
else
resize(wWidth, yMouse+1);
}
else if (cursor().shape() == Qt::SizeHorCursor)
{
if (resizeHorEsq)
{
int newX = geometry().x() + xMouse;
int newWidth = wWidth - xMouse;
if (newWidth > minimumSizeHint().width())
{
resize(newWidth, wHeight);
move(newX, geometry().y());
}
}
else
resize(xMouse, wHeight);
}
else if (cursor().shape() == Qt::SizeBDiagCursor)
{
int newX = 0;
int newWidth = 0;
int newY = 0;
int newHeight = 0;
if (resizeDiagSupDer)
{
newX = geometry().x();
newWidth = xMouse;
newY = geometry().y() + yMouse;
newHeight = wHeight - yMouse;
}
else
{
newX = geometry().x() + xMouse;
newWidth = wWidth - xMouse;
newY = geometry().y();
newHeight = yMouse;
}
if (newWidth >= minimumSizeHint().width() and newHeight >= minimumSizeHint().height())
{
resize(newWidth, newHeight);
move(newX, newY);
}
else if (newWidth >= minimumSizeHint().width())
{
resize(newWidth, wHeight);
move(newX, geometry().y());
}
else if (newHeight >= minimumSizeHint().height())
{
resize(wWidth, newHeight);
move(geometry().x(), newY);
}
}
else if (cursor().shape() == Qt::SizeFDiagCursor)
{
if (resizeDiagSupEsq)
{
int newX = geometry().x() + xMouse;
int newWidth = wWidth - xMouse;
int newY = geometry().y() + yMouse;
int newHeight = wHeight - yMouse;
if (newWidth >= minimumSizeHint().width() and newHeight >= minimumSizeHint().height())
{
resize(newWidth, newHeight);
move(newX, newY);
}
else if (newWidth >= minimumSizeHint().width())
{
resize(newWidth, wHeight);
move(newX, geometry().y());
}
//.........这里部分代码省略.........
示例12: graphics
GraphicsInterface::DataBufferObject DataBufferManager::getAllocationBufferObject(AllocationObject allocationObject,
uintptr_t& offset)
{
if (!allocationObject)
return nullptr;
auto allocation = reinterpret_cast<const Allocation*>(allocationObject);
if (allocation->isDynamic)
{
// For dynamic allocations simply return its data buffer with no offset
offset = 0;
return allocation->buffer;
}
auto group = allocation->group;
// Return the offset to this allocation from the start of the data buffer
offset = allocation->allocation->firstBlock * group->blockSize;
// Dirty static data groups need to be reuploaded to the graphics interface
if (group->isDirty)
{
// No longer dirty
group->isDirty = false;
// Create data buffer if needed
if (!group->buffer)
{
group->buffer = graphics().createDataBuffer();
if (!group->buffer)
{
LOG_ERROR << "Failed creating static data buffer";
return nullptr;
}
}
// Allocate a buffer to ready to receive the contents of this static data group
auto uploadBuffer = Vector<byte_t>();
try
{
uploadBuffer.resize(group->getActiveBlockCount() * group->blockSize);
}
catch (const std::bad_alloc&)
{
LOG_ERROR << "Failed allocating memory for the upload buffer";
return nullptr;
}
// Fill the upload buffer
for (auto i = 0U; i < group->allocations.size(); i++)
{
auto a = group->allocations[i];
memcpy(&uploadBuffer[a->firstBlock * group->blockSize], a->data, a->dataSize);
}
// Upload to the graphics interface
auto timer = SimpleTimer();
graphics().uploadStaticDataBuffer(group->buffer, allocation->type, uploadBuffer.size(), uploadBuffer.getData());
LOG_INFO << "Updated static " << (allocation->type == GraphicsInterface::VertexDataBuffer ? "vertex" : "index")
<< " data group " << group << ", size: " << FileSystem::formatByteSize(uploadBuffer.size())
<< ", time: " << timer;
}
return group->buffer;
}
示例13: width
void HtmlEditor::resizeWebView(int w, int h)
{
int widthDelta = width() - ui->webView->width();
int heightDelta = height() - ui->webView->height();
resize(w + widthDelta, h + heightDelta);
}
示例14: resize
void GLEBoolArray::setBoolAt(bool v, int i) {
resize(i);
m_Elems[i] = v;
}
示例15: resize
string& string::strip() {
nall::strip(data());
resize(length());
return *this;
}