本文整理汇总了C++中QScrollBar::setObjectName方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollBar::setObjectName方法的具体用法?C++ QScrollBar::setObjectName怎么用?C++ QScrollBar::setObjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollBar
的用法示例。
在下文中一共展示了QScrollBar::setObjectName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switchToServer
void StartScene::switchToServer(Server *server) {
// performs leaving animation
QPropertyAnimation *logo_shift = new QPropertyAnimation(logo, "pos", this);
QPropertyAnimation *logo_shrink = new QPropertyAnimation(logo, "scale", this);
logo_shrink->setEndValue(0.5);
QParallelAnimationGroup *group = new QParallelAnimationGroup(this);
group->addAnimation(logo_shift);
group->addAnimation(logo_shrink);
group->start(QAbstractAnimation::DeleteWhenStopped);
foreach (Button *button, buttons)
delete button;
buttons.clear();
server_log = new QTextEdit();
server_log->setReadOnly(true);
server_log->resize(700, 420);
QRectF startSceneRect = sceneRect();
server_log->move(startSceneRect.width() / 2 - server_log->width() / 2,
startSceneRect.height() / 2 - server_log->height() / 2 + logo->boundingRect().height() / 4);
server_log->setFrameShape(QFrame::NoFrame);
server_log->setFont(QFont("Verdana", 12));
server_log->setTextColor(Config.TextEditColor);
setServerLogBackground();
QGraphicsProxyWidget *widget = addWidget(server_log);
widget->setParent(this);
QScrollBar *logBoxVScrollBar = server_log->verticalScrollBar();
if (NULL != logBoxVScrollBar) {
logBoxVScrollBar->setObjectName("sgsVSB");
logBoxVScrollBar->setStyleSheet(Settings::getQSSFileContent());
}
printServerInfo();
connect(server, SIGNAL(server_message(QString)), server_log, SLOT(append(QString)));
update();
}
示例2: RebuildEditView
void AvatarEditor::RebuildEditView()
{
if (!avatar_widget_)
return;
// Activate/deactivate export button based on whether export currently supported
QPushButton *button = avatar_widget_->findChild<QPushButton *>("but_export");
if (button)
button->setEnabled(rexlogicmodule_->GetAvatarHandler()->AvatarExportSupported());
QWidget* mat_panel = avatar_widget_->findChild<QWidget *>("panel_materials");
QWidget* attachment_panel = avatar_widget_->findChild<QWidget *>("panel_attachments");
if (!mat_panel || !attachment_panel)
return;
Scene::EntityPtr entity = rexlogicmodule_->GetAvatarHandler()->GetUserAvatar();
if (!entity)
return;
EC_AvatarAppearance* appearance = entity->GetComponent<EC_AvatarAppearance>().get();
if (!appearance)
return;
int width = 308-10;
int tab_width = 302-10;
int itemheight = 20;
// Materials
ClearPanel(mat_panel);
const AvatarMaterialVector& materials = appearance->GetMaterials();
mat_panel->resize(width, itemheight * (materials.size() + 1));
for (uint y = 0; y < materials.size(); ++y)
{
QPushButton* button = new QPushButton("Change", mat_panel);
button->setObjectName(QString::fromStdString(ToString<int>(y))); // Material index
button->resize(50, 20);
button->move(width - 50, y*itemheight);
button->show();
QObject::connect(button, SIGNAL(clicked()), this, SLOT(ChangeTexture()));
// If there's a texture name, use it, because it is probably more understandable than material name
std::string texname = materials[y].asset_.name_;
if (materials[y].textures_.size())
texname = materials[y].textures_[0].name_;
QLabel* label = new QLabel(QString::fromStdString(texname), mat_panel);
label->resize(200,20);
label->move(0, y*itemheight);
label->show();
}
// Attachments
ClearPanel(attachment_panel);
const AvatarAttachmentVector& attachments = appearance->GetAttachments();
attachment_panel->resize(width, itemheight * (attachments.size() + 1));
for (uint y = 0; y < attachments.size(); ++y)
{
QPushButton* button = new QPushButton("Remove", attachment_panel);
button->setObjectName(QString::fromStdString(ToString<int>(y))); // Attachment index
button->resize(50, 20);
button->move(width - 50, y*itemheight);
button->show();
QObject::connect(button, SIGNAL(clicked()), this, SLOT(RemoveAttachment()));
std::string attachment_name = attachments[y].name_;
// Strip away .xml from the attachment name for slightly nicer display
std::size_t pos = attachment_name.find(".xml");
if (pos != std::string::npos)
attachment_name = attachment_name.substr(0, pos);
QLabel* label = new QLabel(QString::fromStdString(attachment_name), attachment_panel);
label->resize(200,20);
label->move(0, y*itemheight);
label->show();
}
// Modifiers
QTabWidget* tabs = avatar_widget_->findChild<QTabWidget *>("tab_appearance");
if (!tabs)
return;
for (;;)
{
QWidget* tab = tabs->widget(0);
if (!tab)
break;
tabs->removeTab(0);
delete tab;
}
const MasterModifierVector& master_modifiers = appearance->GetMasterModifiers();
// If no master modifiers, show the individual morph/bone controls
if (!master_modifiers.size())
{
QWidget* morph_panel = GetOrCreateTabScrollArea(tabs, "Morphs");
QWidget* bone_panel = GetOrCreateTabScrollArea(tabs, "Bones");
if (!morph_panel || !bone_panel)
return;
//.........这里部分代码省略.........
示例3: createWidget
QWidget* WidgetStyle::createWidget(const QString& name)
{
if(name == "CheckBox")
{
QCheckBox* box = new QCheckBox("CheckBox");
box->setObjectName("CheckBox");
return setLayoutWidget({ box }, { 100, 30 });
}
else if(name == "ComboBox")
{
QComboBox* box = new QComboBox;
box->addItem("Item1");
box->addItem("Item3");
box->addItem("Item3");
box->setObjectName("ComboBox");
return setLayoutWidget({ box }, { 70, 30 });
}
else if(name == "DateEdit")
{
QDateEdit* date = new QDateEdit;
date->setObjectName("DateEdit");
return setLayoutWidget({ date }, { 110, 40 });
}
else if(name == "DateTimeEdit")
{
QDateTimeEdit* date = new QDateTimeEdit;
date->setObjectName("DateTimeEdit");
return setLayoutWidget({ date }, { 160, 30 });
}
else if(name == "Dialog")
{
QDialog* dialog = new QDialog;
dialog->setObjectName("Dialog");
return setLayoutWidget({ dialog }, { 160, 110 });
}
else if(name == "DockWidget") //?
{
QDockWidget* widget = new QDockWidget;
widget->setObjectName("DockWidget");
widget->resize(61, 22);
return widget;
}
else if(name == "DoubleSpinBox")
{
QDoubleSpinBox* box = new QDoubleSpinBox;
box->setObjectName("DoubleSpinBox");
return setLayoutWidget({ box }, { 90, 40 });
}
else if(name == "Frame") //??
{
QFrame* frame = new QFrame;
frame->setObjectName("Frame");
frame->resize(150, 100);
return frame;
}
else if(name == "GroupBox")
{
QGroupBox* box = new QGroupBox("GroupBox");
box->setObjectName("GroupBox");
return setLayoutWidget({ box }, { 160, 110 });
}
else if(name == "Label")
{
QLabel* label = new QLabel("Label");
label->setObjectName("Label");
return setLayoutWidget({ label }, { 40, 20});
}
else if(name == "LineEdit")
{
QLineEdit* line = new QLineEdit;
line->setObjectName("LineEdit");
return setLayoutWidget({ line }, { 30, 30 });
}
else if(name == "ListView") //??
{
QListView* view = new QListView;
view->setObjectName("ListView");
view->resize(71, 71);
return view;
}
else if(name == "ListWidget")
{
QListWidget* list = new QListWidget;
list->setObjectName("ListWidget");
for(int i = 0; i < 20; i++)
list->addItem(QString("Item %1").arg(i));
return setLayoutWidget({ list }, { 80, 80 });
}
else if(name == "MainWindow")
{
QMainWindow* window = new QMainWindow;
window->setObjectName("MainWindow");
return setLayoutWidget({ window }, { 160, 110 });
}
else if(name == "Menu")
{
QMenu* parentMenu = new QMenu;
parentMenu->setObjectName("Menu");
parentMenu->addMenu("Menu1");
QMenu* menu1 = parentMenu->addMenu("Menu2");
//.........这里部分代码省略.........