本文整理汇总了C++中QUiLoader::setLanguageChangeEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ QUiLoader::setLanguageChangeEnabled方法的具体用法?C++ QUiLoader::setLanguageChangeEnabled怎么用?C++ QUiLoader::setLanguageChangeEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QUiLoader
的用法示例。
在下文中一共展示了QUiLoader::setLanguageChangeEnabled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitEditorWindow
void AvatarEditor::InitEditorWindow()
{
Foundation::UiServiceInterface *ui = rexlogicmodule_->GetFramework()->GetService<Foundation::UiServiceInterface>();
if (ui == 0) // If this occurs, we're most probably operating in headless mode.
return;
QUiLoader loader;
loader.setLanguageChangeEnabled(true);
QFile file("./data/ui/avatareditor.ui");
if (!file.exists())
{
RexLogicModule::LogError("Cannot find avatar editor .ui file.");
return;
}
avatar_widget_ = loader.load(&file, this);
if (!avatar_widget_)
return;
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(avatar_widget_);
layout->setContentsMargins(0, 0, 0, 0);
setLayout(layout);
// Connect signals.
QPushButton *button = avatar_widget_->findChild<QPushButton *>("but_export");
if (button)
QObject::connect(button, SIGNAL(clicked()), this, SLOT(ExportAvatar()));
button = avatar_widget_->findChild<QPushButton *>("but_exportlocal");
if (button)
QObject::connect(button, SIGNAL(clicked()), this, SLOT(ExportAvatarLocal()));
button = avatar_widget_->findChild<QPushButton *>("but_load");
if (button)
QObject::connect(button, SIGNAL(clicked()), this, SLOT(LoadAvatar()));
button = avatar_widget_->findChild<QPushButton *>("but_revert");
if (button)
QObject::connect(button, SIGNAL(clicked()), this, SLOT(RevertAvatar()));
button = avatar_widget_->findChild<QPushButton *>("but_attachment");
if (button)
QObject::connect(button, SIGNAL(clicked()), this, SLOT(AddAttachment()));
setWindowTitle(tr("Avatar Editor"));
ui->AddWidgetToScene(this);
ui->AddWidgetToMenu(this);
}
示例2: Initialize
void NoteCardManager::Initialize()
{
QUiLoader loader;
loader.setLanguageChangeEnabled(true);
QFile file("./data/ui/notecardmanager.ui");
file.open(QFile::ReadOnly);
contents_ = loader.load(&file, this);
if (!contents_)
{
NoteCardModule::LogError("Could not load notecard manager layout");
return;
}
file.close();
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(contents_);
layout->setContentsMargins(0,0,0,0);
setLayout(layout);
boost::shared_ptr<UiServices::UiModule> ui_module = framework_->GetModuleManager()->GetModule<UiServices::UiModule>().lock();
if (ui_module)
{
UiServices::UiWidgetProperties widget_properties(contents_->windowTitle(), UiServices::SceneWidget);
proxy_ = ui_module->GetInworldSceneController()->AddWidgetToScene(this, widget_properties);
}
else
NoteCardModule::LogError("Could not add widget to scene");
tree_ = findChild<QTreeWidget*>("tree_cards");
if (tree_)
{
QObject::connect(tree_, SIGNAL(itemActivated(QTreeWidgetItem *, int)), this, SLOT(SelectNoteCard()));
}
create_button_ = findChild<QPushButton*>("but_create");
if (create_button_)
{
QObject::connect(create_button_, SIGNAL(pressed()), this, SLOT(CreateNoteCard()));
}
delete_button_ = findChild<QPushButton*>("but_delete");
if (delete_button_)
{
QObject::connect(delete_button_, SIGNAL(pressed()), this, SLOT(DeleteNoteCard()));
}
}
示例3: Initialize
void TerrainWeightEditor::Initialize()
{
if (fw_->IsHeadless())
return;
QUiLoader loader;
loader.setLanguageChangeEnabled(true);
QString str("./data/ui/terrainwtex_editor.ui");
QFile file(str);
if(!file.exists())
{
EnvironmentModule::LogError("Cannot find " +str.toStdString()+ " file");
return;
}
editor_widget_ = loader.load(&file, this);
if (editor_widget_ == 0)
return;
// UiProxyWidget *editor_proxy = fw_->Ui()->AddWidgetToScene(this);
// if (editor_proxy == 0)
// return;
// ui->AddWidgetToMenu(this, tr("Terrain Texture Weightmap Editor"));
// ui->RegisterUniversalWidget("Weights", editor_proxy);
QSpinBox *box = editor_widget_->findChild<QSpinBox*>("brush_size");
if(box)
{
brush_size_max_ = box->maximum();
brush_size_ = box->value();
}
box = editor_widget_->findChild<QSpinBox*>("brush_modifier");
if(box)
brush_modifier_ = box->maximum();
QDoubleSpinBox *dbox = editor_widget_->findChild<QDoubleSpinBox*>("brush_falloff");
if(dbox)
falloff_percentage_ = dbox->value();
InitializeCanvases();
InitializeConnections();
emit BrushValueChanged();
}
示例4: InitInventoryWindow
void InventoryWindow::InitInventoryWindow()
{
QUiLoader loader;
loader.setLanguageChangeEnabled(true);
QFile uiFile("./data/ui/inventory.ui");
mainWidget_ = loader.load(&uiFile, this);
uiFile.close();
setWindowTitle(QApplication::translate("Inventory::InventoryWindow", "Inventory"));
// Layout
layout_ = new QVBoxLayout(this);
layout_->addWidget(mainWidget_);
layout_->setContentsMargins(0, 0, 0, 0);
setLayout(layout_);
///\todo Disable crappy search line edit feature for now. Maybe do better some day.
/*
QHBoxLayout *line_layout = new QHBoxLayout();
line_layout->setContentsMargins(7, 0, 7, 0);
QLineEdit *lineEditSearch_ = new QLineEdit(mainWidget_);
QObject::connect(lineEditSearch_, SIGNAL(textChanged(const QString &)), this, SLOT(Search(const QString &)));
lineEditSearch_->setText("Search...");
line_layout->addWidget(lineEditSearch_);
*/
// Create inventory tree view.
treeView_ = new InventoryTreeView(mainWidget_);
// layout_->addLayout(line_layout);
layout_->addWidget(treeView_);
// Connect signals
///\todo Connecting both these signals causes WebDav inventory to work incorrectly.
// connect(treeView_, SIGNAL(expanded(const QModelIndex &)), this, SLOT(ExpandFolder(const QModelIndex &)));
connect(treeView_, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(OpenItem()));
CreateActions();
}
示例5: file
ECEditorWindow::ECEditorWindow(Framework* fw, QWidget *parent) :
QWidget(parent),
framework(fw),
toggleEntitiesButton(0),
entityList(0),
ecBrowser(0),
hasFocus(true)
{
QUiLoader loader;
loader.setLanguageChangeEnabled(true);
QFile file(Application::InstallationDirectory() + "data/ui/eceditor.ui");
file.open(QFile::ReadOnly);
if (!file.exists())
{
LogError("Cannot find " + Application::InstallationDirectory() + "data/ui/eceditor.ui file.");
return;
}
QWidget *contents = loader.load(&file, this);
if (!contents)
{
LogError("Could not load editor layout");
return;
}
contents->installEventFilter(this);
file.close();
Scene *scene = fw->Scene()->MainCameraScene();
assert(scene);
undoManager_ = new UndoManager(scene->shared_from_this(), this);
transformEditor = new TransformEditor(scene->shared_from_this(), undoManager_);
QVBoxLayout *layout = new QVBoxLayout(this);
undoButton_ = findChild<QToolButton *>("undoButton");
undoButton_->setDisabled(true);
redoButton_ = findChild<QToolButton *>("redoButton");
redoButton_->setDisabled(true);
undoButton_->setIcon(QIcon(Application::InstallationDirectory() + "data/ui/images/icon/undo-icon.png"));
redoButton_->setIcon(QIcon(Application::InstallationDirectory() + "data/ui/images/icon/redo-icon.png"));
undoButton_->setMenu(undoManager_->UndoMenu());
redoButton_->setMenu(undoManager_->RedoMenu());
layout->addWidget(contents);
layout->setContentsMargins(0,0,0,0);
setLayout(layout);
setWindowTitle(contents->windowTitle());
resize(contents->size());
toggleEntitiesButton = findChild<QPushButton *>("but_show_entities");
entityList = findChild<QListWidget*>("list_entities");
QWidget *entity_widget = findChild<QWidget*>("entity_widget");
if(entity_widget)
entity_widget->hide();
QWidget *browserWidget = findChild<QWidget*>("browser_widget");
if (browserWidget)
{
ecBrowser = new ECBrowser(framework, this, browserWidget);
ecBrowser->setMinimumWidth(100);
QVBoxLayout *property_layout = dynamic_cast<QVBoxLayout *>(browserWidget->layout());
if (property_layout)
property_layout->addWidget(ecBrowser);
}
ECEditorModule *ecEditorModule = framework->GetModule<ECEditorModule>();
if (ecBrowser)
{
// signals from attribute browser to editor window.
connect(ecBrowser, SIGNAL(ShowXmlEditorForComponent(const QString &)), SLOT(ShowXmlEditorForComponent(const QString &)));
connect(ecBrowser, SIGNAL(CreateNewComponent()), SLOT(CreateComponent()));
connect(ecBrowser, SIGNAL(SelectionChanged(const QString&, const QString &, const QString&, const QString&)),
SLOT(HighlightEntities(const QString&, const QString&)));
connect(ecBrowser, SIGNAL(SelectionChanged(const QString&, const QString &, const QString&, const QString&)),
SIGNAL(SelectionChanged(const QString&, const QString&, const QString&, const QString&)), Qt::UniqueConnection);
ecBrowser->SetItemExpandMemory(ecEditorModule->ExpandMemory());
}
if (entityList)
{
entityList->setSelectionMode(QAbstractItemView::ExtendedSelection);
connect(entityList, SIGNAL(itemSelectionChanged()), this, SLOT(RefreshPropertyBrowser()));
connect(entityList, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(ShowEntityContextMenu(const QPoint &)));
}
if (toggleEntitiesButton)
connect(toggleEntitiesButton, SIGNAL(pressed()), this, SLOT(ToggleEntityList()));
QPushButton *expandOrCollapseButton = findChild<QPushButton *>("expandOrCollapseButton");
if (expandOrCollapseButton && ecBrowser)
connect(expandOrCollapseButton, SIGNAL(clicked()), ecBrowser, SLOT(ExpandOrCollapseAll()));
connect(scene, SIGNAL(EntityRemoved(Entity*, AttributeChange::Type)), SLOT(RemoveEntity(Entity*)), Qt::UniqueConnection);
connect(scene, SIGNAL(ActionTriggered(Entity *, const QString &, const QStringList &, EntityAction::ExecTypeField)),
SLOT(OnActionTriggered(Entity *, const QString &, const QStringList &)), Qt::UniqueConnection);
connect(this, SIGNAL(FocusChanged(ECEditorWindow *)), ecEditorModule, SLOT(ECEditorFocusChanged(ECEditorWindow*)));
connect(this, SIGNAL(EditEntityXml(const QList<EntityPtr> &)), ecEditorModule, SLOT(CreateXmlEditor(const QList<EntityPtr> &)));
//.........这里部分代码省略.........