本文整理汇总了C++中QUiLoader类的典型用法代码示例。如果您正苦于以下问题:C++ QUiLoader类的具体用法?C++ QUiLoader怎么用?C++ QUiLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QUiLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
void TexturePreviewEditor::Initialize()
{
// UiServiceInterface* ui= framework_->GetService<UiServiceInterface>();
// if (!ui)
// return;
// Create widget from ui file
QUiLoader loader;
QFile file("./data/ui/texture_preview.ui");
if (!file.exists())
{
OgreAssetEditorModule::LogError("Cannot find OGRE Script Editor .ui file.");
return;
}
mainWidget_ = loader.load(&file);
file.close();
setAttribute(Qt::WA_DeleteOnClose);
resize(cWindowMinimumWidth, cWindowMinimumHeight);
layout_ = new QVBoxLayout;
layout_->addWidget(mainWidget_);
layout_->setContentsMargins(0, 0, 0, 0);
setLayout(layout_);
// Get controls
okButtonName_ = mainWidget_->findChild<QPushButton *>("okButton");
connect(okButtonName_, SIGNAL(clicked()), this, SLOT(Closed()));
headerLabel_ = mainWidget_->findChild<QLabel *>("imageNameLabel");
scaleLabel_ = mainWidget_->findChild<QLabel *>("imageScaleLabel");
QLabel *assetIdLabel = mainWidget_->findChild<QLabel *>("imageAssetIdLabel");
if(assetIdLabel)
assetIdLabel->setText(inventoryId_);
imageLabel_ = new TextureLabel();
imageLabel_->setObjectName("previewImageLabel");
imageLabel_->setScaledContents(true);
imageLabel_->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
QObject::connect(imageLabel_, SIGNAL(MouseClicked(QMouseEvent*)), this, SLOT(TextureLabelClicked(QMouseEvent*)));
scrollAreaWidget_ = mainWidget_->findChild<QScrollArea *>("imageScrollArea");
scrollAreaWidget_->widget()->layout()->addWidget(imageLabel_);
// Set black background image that will be replaced once the real image has been received.
QImage emptyImage = QImage(QSize(256, 256), QImage::Format_ARGB32);
emptyImage.fill(qRgba(0,0,0,0));
imageLabel_->setPixmap(QPixmap::fromImage(emptyImage));
headerLabel_->setText(objectName());
// Add widget to UI via ui services module
setWindowTitle(tr("Texture: ") + objectName());
// UiProxyWidget *proxy = ui->AddWidgetToScene(this);
// connect(proxy, SIGNAL(Closed()), this, SLOT(Closed()));
// proxy->show();
// ui->BringWidgetToFront(proxy);
}
示例2: qtuiloader_load
static int
qtuiloader_load(lua_State *L)
{
// this
QUiLoader *loader = luaQ_checkqobject<QUiLoader>(L, 1);
// file
QFile afile;
QIODevice *file = qobject_cast<QIODevice*>(luaQ_toqobject(L, 2));
if (!file && lua_isstring(L, 2))
{
file = &afile;
const char *fn = lua_tostring(L, 2);
afile.setFileName(QFile::decodeName(fn));
if (! afile.open(QIODevice::ReadOnly))
luaL_error(L,"cannot open file '%s' for reading (%s)",
fn, afile.errorString().toLocal8Bit().constData() );
}
else if (!file)
{
file = &afile;
void *udata = luaL_checkudata(L, 2, LUA_FILEHANDLE);
if (! afile.open(*(FILE**)udata, QIODevice::ReadOnly))
luaL_error(L,"cannot use stream for reading (%s)",
afile.errorString().toLocal8Bit().constData() );
}
// parent
QWidget *parent = luaQ_optqobject<QWidget>(L, 3);
// load
QWidget *w = loader->load(file, parent);
luaQ_pushqt(L, w, !parent);
return 1;
}
示例3: m_metadata
Plugin::Plugin(const QVariantMap &metadata, Plugin::Type type)
: m_metadata(metadata), m_type(type), m_enabled(true)
{
if ( m_metadata.contains("ui") )
{
QStringList ui = m_metadata["ui"].toStringList();
if ( ui.isEmpty() )
ui << m_metadata["ui"].toString();
foreach(QString file_name, ui)
{
QFile ui_file(QDir(string_data("plugin_dir"))
.absoluteFilePath(file_name) );
if ( ui_file.open(QFile::ReadOnly|QFile::Text) )
{
QUiLoader loader;
QWidget *widget = loader.load(&ui_file);
if ( widget )
{
if ( widget->windowIcon().isNull() )
widget->setWindowIcon(icon());
//((QObject*)widget)->setParent(this);
widget->hide();
m_widgets << widget;
connect(widget,SIGNAL(destroyed(QObject*)),SLOT(dialog_destroyed(QObject*)));
}
}
}
示例4: InitEditorWindow
void UICanvasTestEdit::InitEditorWindow()
{
boost::shared_ptr<UiServices::UiModule> ui_module = framework_->GetModuleManager()->GetModule<UiServices::UiModule>(Foundation::Module::MT_UiServices).lock();
// If this occurs, we're most probably operating in headless mode.
if (ui_module.get() == 0)
return;
QUiLoader loader;
QFile file("./data/ui/uicanvastestedit.ui");
if (!file.exists())
{
QtModule::LogError("Cannot find UI canvas test editor .ui file.");
return;
}
editor_widget_ = loader.load(&file);
if (!editor_widget_)
return;
editor_widget_proxy_ = ui_module->GetSceneManager()->AddWidgetToScene(editor_widget_, UiServices::UiWidgetProperties(QPointF(60,60), editor_widget_->size(), Qt::Dialog, "3D GUI"));
// Connect signals
QPushButton *button = editor_widget_->findChild<QPushButton *>("but_bind");
if (button)
QObject::connect(button, SIGNAL(clicked()), this, SLOT(BindCanvas()));
button = editor_widget_->findChild<QPushButton *>("but_unbind");
if (button)
QObject::connect(button, SIGNAL(clicked()), this, SLOT(UnbindCanvas()));
QObject::connect(editor_widget_proxy_, SIGNAL(Visible(bool)), this, SLOT(Shown(bool)));
}
示例5: QFile
void ControllersControlGroupDialog::setControlUI(QString ControlPath)
{
QFile* UiFile = new QFile("./Controllers/" + ControlPath + ".ui");
if (!UiFile->exists())
{
QMessageBox::warning(this, tr("UI File"),
tr("Cannot found file %1:\n%2.")
.arg(UiFile->fileName())
.arg(UiFile->errorString()));
this->rejected();
return;
}
if (!UiFile->open(QFile::ReadOnly | QFile::Text))
{
QMessageBox::warning(this, tr("SAX Bookmarks"),
tr("Cannot read file %1:\n%2.")
.arg(UiFile->fileName())
.arg(UiFile->errorString()));
this->rejected();
return;
}
QUiLoader uiLoader;
ui->ControlUI->layout()->addWidget(uiLoader.load(UiFile));
connect(ui->ControlAdd, SIGNAL(pressed()), this, SLOT(addControl()));
return;
}
示例6: main
int main(int argc, char **argv)
{
Q_INIT_RESOURCE(table);
QApplication app(argc, argv);
QScriptEngine engine;
QFile scriptFile(":/table.js");
scriptFile.open(QIODevice::ReadOnly);
engine.evaluate(scriptFile.readAll());
scriptFile.close();
QUiLoader loader;
QFile uiFile(":/table.ui");
uiFile.open(QIODevice::ReadOnly);
QWidget *ui = loader.load(&uiFile);
uiFile.close();
QScriptValue func = engine.evaluate("Table");
QScriptValue scriptUi = engine.newQObject(ui);
QScriptValue table = func.construct(QScriptValueList() << scriptUi);
if(engine.hasUncaughtException()) {
QScriptValue value = engine.uncaughtException();
QString lineNumber = QString("\nLine Number:%1\n").arg(engine.uncaughtExceptionLineNumber());
QStringList btList = engine.uncaughtExceptionBacktrace();
QString trace;
for(short i=0; i<btList.size(); ++i)
trace += btList.at(i);
QMessageBox::information(NULL, QObject::tr("Exception"), value.toString() + lineNumber + trace );
}
ui->show();
return app.exec();
}
示例7: LoadUI
POCO_END_MANIFEST
//API stuff here first
//for javascript to load a .ui file and get the widget in return, to assign connections
QScriptValue RexQtScript::LoadUI(QScriptContext *context, QScriptEngine *engine)
{
QWidget *widget;
QScriptValue qswidget;
boost::shared_ptr<QtUI::QtModule> qt_module = RexQtScript::staticframework->GetModuleManager()->GetModule<QtUI::QtModule>(Foundation::Module::MT_Gui).lock();
boost::shared_ptr<QtUI::UICanvas> canvas_;
//if ( qt_module.get() == 0)
// return NULL;
canvas_ = qt_module->CreateCanvas(QtUI::UICanvas::External).lock();
QUiLoader loader;
QFile file("../RexQtScriptModule/proto/dialog.ui");
widget = loader.load(&file);
canvas_->AddWidget(widget);
// Set canvas size.
canvas_->resize(widget->size());
canvas_->Show();
qswidget = engine->newQObject(widget);
return qswidget;
}
示例8: InitEditorWindow
void OgreScriptEditor::InitEditorWindow()
{
// Create widget from ui file
QUiLoader loader;
QFile file("./data/ui/ogrescripteditor.ui");
if (!file.exists())
{
OgreAssetEditorModule::LogError("Cannot find OGRE Script Editor .ui file.");
return;
}
mainWidget_ = loader.load(&file);
file.close();
layout_ = new QVBoxLayout;
layout_->addWidget(mainWidget_);
layout_->setContentsMargins(0, 0, 0, 0);
setLayout(layout_);
// Get controls
lineEditName_ = mainWidget_->findChild<QLineEdit *>("lineEditName");
buttonSaveAs_ = mainWidget_->findChild<QPushButton *>("buttonSaveAs");
buttonCancel_ = mainWidget_->findChild<QPushButton *>("buttonCancel");
// Connect signals
QObject::connect(buttonSaveAs_, SIGNAL(clicked()), this, SLOT(SaveAs()));
QObject::connect(buttonCancel_, SIGNAL(clicked(bool)), this, SLOT(Close()));
QObject::connect(lineEditName_, SIGNAL(textChanged(const QString &)), this, SLOT(ValidateScriptName(const QString &)));
}
示例9: QWidget
UploadProgressWindow::UploadProgressWindow(InventoryModule *owner, QWidget *parent) :
QWidget(parent), owner_(owner), mainWidget_(0), layout_(0), uploadCount_(0)
{
QUiLoader loader;
QFile file("./data/ui/uploadprogress.ui");
file.open(QFile::ReadOnly);
mainWidget_ = loader.load(&file, this);
file.close();
layout_ = new QVBoxLayout;
layout_->addWidget(mainWidget_);
setLayout(layout_);
progressBar_ = mainWidget_->findChild<QProgressBar *>("progressBar");
labelFileNumber_ = mainWidget_->findChild<QLabel *>("labelFileNumber");
// Add widget to UI via ui services module
boost::shared_ptr<UiServices::UiModule> ui_module =
owner_->GetFramework()->GetModuleManager()->GetModule<UiServices::UiModule>(Foundation::Module::MT_UiServices).lock();
if (!ui_module.get())
return;
proxyWidget_ = ui_module->GetInworldSceneController()->AddWidgetToScene(
this, UiServices::UiWidgetProperties("Upload Progress Window", UiServices::SceneWidget));
}
示例10: attachAllWidget
void MainWindow::attachAllWidget()
{
QString displayname;
QUiLoader loader;
//const int singletime = 1;
QFile file;
for(int i = 0; i < displayDocklist.size();i++)
{
displayname = QString("/usr/local/opi/ui/")+displayDocklist.at(i)+".ui";
//pattach = new AttachChannelAccess(displayname.toStdString().c_str(), i, singletime );
file.setFileName(displayname);
file.open(QFile::ReadOnly);
pwidget = loader.load(&file);
vecACHAcc.push_back(pwidget);
if (!pwidget)
{
QWidget *page = new QWidget();
QPushButton *pbut = new QPushButton(page);
pbut -> setGeometry(0,0,180,40);
char display[30];
sprintf(display,"%s: %d",displayname.toStdString().c_str(), i);
pbut -> setText(display);
stackedWidget->addWidget(page);
}
else
{
pwidget->setAutoFillBackground (true);
stackedWidget->addWidget(pwidget);
};
};
}
示例11: LogError
QWidget *QtUiAsset::Instantiate(bool addToScene, QWidget *parent)
{
if (!IsLoaded())
{
LogError("QtUiAsset::Instantiate: Cannot instantiate an unloaded UI Asset \"" + Name().toStdString() + "\"!");
return 0;
}
// Get the asset data with the assetrefs replaced to point to the disk sources on the current local system.
QByteArray data = GetRefReplacedAssetData();
QUiLoader loader;
QDataStream dataStream(&data, QIODevice::ReadOnly);
QWidget *widget = loader.load(dataStream.device(), parent);
if (!widget)
{
LogError("QtUiAsset::Instantiate: Failed to instantiate widget from UI asset \"" + Name().toStdString() + "\"!");
return 0;
}
if (addToScene)
{
UiProxyWidget *proxy = assetAPI->GetFramework()->Ui()->AddWidgetToScene(widget);
if (!proxy)
LogError("QtUiAsset::Instantiate: Failed to add widget to main QGraphicsScene in UI asset \"" + Name().toStdString() + "\"!");
}
return widget;
}
示例12: uiFile
QWidget *ActionProxyWidget::CreateNewOpenSimWorld()
{
QWidget *new_os_world_widget;
current_grid_info_map_.clear();
QUiLoader loader;
QFile uiFile("./data/ui/ether/world-edit-opensim.ui");
new_os_world_widget = loader.load(&uiFile, 0);
uiFile.close();
QPushButton *button;
button = new_os_world_widget->findChild<QPushButton*>("pushButtonGetGridInfo");
connect(button, SIGNAL( clicked() ), SLOT( GridInfoRequested() ));
button = new_os_world_widget->findChild<QPushButton*>("pushButtonSave");
connect(button, SIGNAL( clicked() ), SLOT( SaveInformation() ));
QPixmap pic = CretatePicture(QSize(150,150), "./data/ui/images/ether/world.png");
QLabel *pic_label = new_os_world_widget->findChild<QLabel*>("pictureLabel");
pic_label->setPixmap(pic);
current_type_ = "new-world-opensim";
current_os_world_data_ = 0;
return new_os_world_widget;
}
示例13: qtuiloader_pluginPaths
static int
qtuiloader_pluginPaths(lua_State *L)
{
QUiLoader *loader = luaQ_checkqobject<QUiLoader>(L, 1);
luaQ_pushqt(L, QVariant(loader->pluginPaths()));
return 1;
}
示例14: on_actionStatisticalRemoval_triggered
void MainWindow::on_actionStatisticalRemoval_triggered()
{
//load RadiusOutlier Ui
QUiLoader loader;
QFile file(":/forms/StatisticalRemoval.ui");
file.open(QFile::ReadOnly);
QDialog *statisticalRemovalForm = dynamic_cast<QDialog *>(loader.load(&file, this));
file.close();
if(statisticalRemovalForm->exec()==QDialog::Accepted)
{
while(statisticalRemovalForm->isVisible());//untill it closed
QLineEdit *std=statisticalRemovalForm->findChild<QLineEdit *>("stddev");
QLineEdit *n=statisticalRemovalForm->findChild<QLineEdit *>("neighbor");
QString txt ="Applying Statistical filter to the cloud ...";
QProgressDialog *p=new QProgressDialog( txt,QString(),0, 0, this);
p->setWindowModality(Qt::WindowModal);
p->setVisible(true);
connect(controller, SIGNAL(finished()), p, SLOT(reset()));
QtConcurrent::run(controller,&CloudControl::filter,std->text().toDouble(),n->text().toInt(),1);
//int re=controller->RadiusOutlier(r->text().toDouble(),n->text().toInt());
}
}
示例15: ShowWindow
void KeyBindingsConfigWindow::ShowWindow()
{
QUiLoader loader;
QFile file("./data/ui/KeyBindingsConfig.ui");
file.open(QFile::ReadOnly);
QWidget *contents_widget_ = loader.load(&file, this);
assert(contents_widget_);
file.close();
if (!contents_widget_)
return;
QVBoxLayout *layout = new QVBoxLayout;
assert(layout);
layout->addWidget(contents_widget_);
layout->setContentsMargins(0,0,0,0);
setLayout(layout);
configList = findChild<QTreeWidget*>("configList");
QPushButton *apply = findChild<QPushButton*>("pushButtonApply");
connect(apply, SIGNAL(pressed()), this, SLOT(ApplyKeyConfig()));
QPushButton *ok = findChild<QPushButton*>("pushButtonOK");
connect(ok, SIGNAL(pressed()), this, SLOT(ButtonOK()));
QPushButton *cancel = findChild<QPushButton*>("pushButtonCancel");
connect(cancel, SIGNAL(pressed()), this, SLOT(ButtonCancel()));
connect(configList, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(ConfigListAdjustEditable(QTreeWidgetItem *, int)));
connect(configList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(ConfigListAdjustEditable(QTreeWidgetItem *, int)));
PopulateBindingsList();
setWindowTitle(tr("Actions"));
setAttribute(Qt::WA_DeleteOnClose);
}