本文整理汇总了C++中WVBoxLayout类的典型用法代码示例。如果您正苦于以下问题:C++ WVBoxLayout类的具体用法?C++ WVBoxLayout怎么用?C++ WVBoxLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WVBoxLayout类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: AbstractUi
WebUi::WebUi(WApplication *app) :
AbstractUi(),
m_app(app)
{
app->setTitle("Quassel web interface");
WVBoxLayout *layout = new WVBoxLayout;
app->root()->setLayout(layout);
/*m_loginButton = new WPushButton("Connect");
m_loginButton->clicked().connect(this, &WebUi::connect);
layout->addWidget(m_loginButton);*/
_chatView = new WTableView(app->root());
layout->addWidget(_chatView);
_inputWidget = new WLineEdit(app->root());
layout->addWidget(_inputWidget);
QObject::connect(Client::coreConnection(), SIGNAL(userAuthenticationRequired(CoreAccount*,bool*,QString)), SLOT(userAuthenticationRequired(CoreAccount*,bool*,QString)));
QObject::connect(Client::coreConnection(), SIGNAL(connectionMsg(QString)), SLOT(printMsg(QString)));
QObject::connect(Client::coreConnection(), SIGNAL(progressTextChanged(QString)), SLOT(printMsg(QString)));
QObject::connect(Client::coreConnection(), SIGNAL(connectionError(QString)), SLOT(printMsg(QString)));
QObject::connect(Client::coreConnection(), SIGNAL(connectionErrorPopup(QString)), SLOT(printMsg(QString)));
//QObject::connect(Client::coreConnection(), SIGNAL(userAuthenticationRequired(CoreAccount*,bool*,QString)), SLOT(userAuthenticationRequired(CoreAccount*,bool*,QString)));
//Client::coreAccountModel()->load();
//if (!Client::coreConnection()->connectToCore()) {
bool ok;
userAuthenticationRequired(0, &ok, "");
//}
}
开发者ID:biffhero,项目名称:quassel-web,代码行数:31,代码来源:webui.cpp
示例2: createUI
/*! \brief Setup the user interface.
*/
void createUI() {
WContainerWidget *w = root();
w->setStyleClass("maindiv");
/*
* The main layout is a 3x2 grid layout.
*/
WGridLayout *layout = new WGridLayout();
layout->addWidget(createTitle("Folders"), 0, 0);
layout->addWidget(createTitle("Files"), 0, 1);
layout->addWidget(folderView(), 1, 0);
layout->setColumnResizable(0);
// select the first folder
folderView_->select(folderModel_->index(0, 0, folderModel_->index(0, 0)));
WVBoxLayout *vbox = new WVBoxLayout();
vbox->addWidget(fileView(), 1);
vbox->addWidget(pieChart(), 1);
vbox->setResizable(0);
layout->addLayout(vbox, 1, 1);
layout->addWidget(aboutDisplay(), 2, 0, 1, 2);
/*
* Let row 1 and column 1 take the excess space.
*/
layout->setRowStretch(1, 1);
layout->setColumnStretch(1, 1);
w->setLayout(layout);
}
开发者ID:USP,项目名称:wtcpp,代码行数:35,代码来源:TreeViewDragDrop.C
示例3: WContainerWidget
///
// Constructor
//
ResultsTable::ResultsTable(WContainerWidget *parent) :
WContainerWidget(parent),
mSortFilterProxyModel(NULL)
{
setStyleClass("tabdiv");
mModel = new WStandardItemModel(this);
mModel->insertColumns(0, 11);
mModel->setHeaderData(0, boost::any(WString::fromUTF8("Date")));
mModel->setHeaderData(1, boost::any(WString::fromUTF8("User")));
mModel->setHeaderData(2, boost::any(WString::fromUTF8("MRID")));
mModel->setHeaderData(3, boost::any(WString::fromUTF8("Name")));
mModel->setHeaderData(4, boost::any(WString::fromUTF8("Scan Name")));
mModel->setHeaderData(5, boost::any(WString::fromUTF8("Birthday")));
mModel->setHeaderData(6, boost::any(WString::fromUTF8("Scan Date")));
mModel->setHeaderData(7, boost::any(WString::fromUTF8("Manufacturer")));
mModel->setHeaderData(8, boost::any(WString::fromUTF8("Model")));
mModel->setHeaderData(9, boost::any(WString::fromUTF8("Software Ver")));
mModel->setHeaderData(10, boost::any(WString::fromUTF8("Pipeline")));
mModel->invisibleRootItem()->setRowCount(0);
mTreeView = new WTreeView();
mTreeView->setRootIsDecorated(false);
mTreeView->setAlternatingRowColors(true);
mTreeView->setSelectionMode(SingleSelection);
mTreeView->doubleClicked().connect(SLOT(this, ResultsTable::jobSelected));
mTreeView->clicked().connect(SLOT(this, ResultsTable::jobClicked));
WVBoxLayout *layout = new WVBoxLayout();
layout->addWidget(mTreeView);
setLayout(layout);
resetAll();
}
开发者ID:FNNDSC,项目名称:web,代码行数:38,代码来源:ResultsTable.cpp
示例4: sysPath
void WsContent::doEditPage(std::string path)
{
std::string newPath = path;
boost::algorithm::replace_first(newPath, "/Edit", "");
boost::algorithm::replace_first(newPath, "/SiteMap", "");
std::string sPathWithoutPrefix = WsApp->WsModules().pathWithoutPrefix(newPath); // ex. /SiteMap
std::string sysPath(m_sDocumentRoot + sPathWithoutPrefix);
WsUser* pUser = WsApp->wsUser();
NodePtr pNode = pUser->getAccessRoot()->eatPath(sPathWithoutPrefix);
if (!pNode.get() ) {
addWidget(new WsErrorPage(WsErrorPage::Error, path, pUser, "Returned node is null"));
return;
}
clear();
setOverflow(WContainerWidget::OverflowAuto);
WVBoxLayout* vbox = new WVBoxLayout();
setLayout(vbox);
WsFormConfig* m_formConfig = new WsFormConfig(pNode, WsApp->WsModules());
vbox->addWidget(m_formConfig, 0);
vbox->addWidget(WsApp->WsModules().module("WsModEditorUploader")->createContents());
std::string strExt(boost::filesystem::extension(sPathWithoutPrefix));
if ( strExt == ".fhtml" ) {
if ( !gdcore_isPathFile(sysPath) ) return;
gdFHtmlEditor* pEditor = new gdFHtmlEditor("", false);
pEditor->setCurrentPath(sysPath);
pEditor->readFile();
m_formConfig->setEditorFhtml(pEditor);
pEditor->resize(WLength(100, WLength::Percentage), WLength(400));
vbox->addWidget(pEditor, 1);
}
}
开发者ID:Wittyshare,项目名称:wittyshare,代码行数:31,代码来源:WsContent.cpp
示例5: disconnect
void SimpleChatWidget::letLogin()
{
disconnect();
clear();
WVBoxLayout *vLayout = new WVBoxLayout();
setLayout(vLayout, AlignLeft | AlignTop);
WHBoxLayout *hLayout = new WHBoxLayout();
vLayout->addLayout(hLayout);
hLayout->addWidget(new WLabel("User name:"), 0, AlignMiddle);
hLayout->addWidget(userNameEdit_ = new WLineEdit(user_), 0, AlignMiddle);
userNameEdit_->setFocus();
WPushButton *b = new WPushButton("Login");
hLayout->addWidget(b, 0, AlignMiddle);
b->clicked().connect(this, &SimpleChatWidget::login);
userNameEdit_->enterPressed().connect(this, &SimpleChatWidget::login);
vLayout->addWidget(statusMsg_ = new WText());
statusMsg_->setTextFormat(PlainText);
}
开发者ID:bvanhauwaert,项目名称:wt,代码行数:25,代码来源:SimpleChatWidget.C
示例6: WVBoxLayout
void SimpleChatWidget::createLayout(WWidget *messages, WWidget *userList,
WWidget *messageEdit,
WWidget *sendButton, WWidget *logoutButton)
{
/*
* Create a vertical layout, which will hold 3 rows,
* organized like this:
*
* WVBoxLayout
* --------------------------------------------
* | nested WHBoxLayout (vertical stretch=1) |
* | | |
* | messages | userList |
* | (horizontal stretch=1) | |
* | | |
* --------------------------------------------
* | message edit area |
* --------------------------------------------
* | WHBoxLayout |
* | send | logout |
* --------------------------------------------
*/
WVBoxLayout *vLayout = new WVBoxLayout();
// Create a horizontal layout for the messages | userslist.
WHBoxLayout *hLayout = new WHBoxLayout();
// Add widget to horizontal layout with stretch = 1
hLayout->addWidget(messages, 1);
messages->setStyleClass("chat-msgs");
// Add another widget to horizontal layout with stretch = 0
hLayout->addWidget(userList);
userList->setStyleClass("chat-users");
hLayout->setResizable(0, true);
// Add nested layout to vertical layout with stretch = 1
vLayout->addLayout(hLayout, 1);
// Add widget to vertical layout with stretch = 0
vLayout->addWidget(messageEdit);
messageEdit->setStyleClass("chat-noedit");
// Create a horizontal layout for the buttons.
hLayout = new WHBoxLayout();
// Add button to horizontal layout with stretch = 0
hLayout->addWidget(sendButton);
// Add button to horizontal layout with stretch = 0
hLayout->addWidget(logoutButton);
// Add nested layout to vertical layout with stretch = 0
vLayout->addLayout(hLayout, 0, AlignLeft);
setLayout(vLayout);
}
开发者ID:LifeGo,项目名称:wt,代码行数:58,代码来源:SimpleChatWidget.C
示例7: WContainerWidget
void Example::search_presenting(WContainerWidget* cw,
const MapViewer::GeoNodes& nodes) {
WContainerWidget* cw_n = new WContainerWidget();
WVBoxLayout* vl = new WVBoxLayout();
BOOST_FOREACH (MapViewer::GeoNode node, nodes) {
Coordinate& pos = node.first;
vl->addWidget(new WText(node.second + "<br />" +
str(boost::format("%.4f %.4f")
% pos.longitude() % pos.latitude())),
AlignTop);
}
开发者ID:NCAR,项目名称:wt-classes,代码行数:11,代码来源:map-viewer.cpp
示例8: clear
void AdsEditor::renderUI() {
AdsApplication *app = AdsApplication::adsApplication();
cppdb::session &db = app->db_;
clear();
WPushButton *btn = new WPushButton("Criar Anuncio", this);
btn->clicked().connect(this, &AdsEditor::novoAnuncio);
WPushButton *update = new WPushButton("Atualiza", this);
update->clicked().connect(this, &AdsEditor::renderUI);
new WBreak(this);
new WBreak(this);
new WText("<h3>Lista de Anuncios</h3>",this);
Wt::WContainerWidget *w = new Wt::WContainerWidget(this);
w->resize(600, WLength::Auto);
WVBoxLayout *layout = new Wt::WVBoxLayout();
cppdb::result res = db <<
"select id, titulo, url, imagem, texto, ativo "
" from anuncio";
while(res.next()) {
WContainerWidget *cont = new WContainerWidget();
AdsAnuncio *anuncio = new AdsAnuncio(cont);
res >> anuncio->id >> anuncio->titulo_ >> anuncio->link_ >>
anuncio->imagem_ >> anuncio->texto_ >> anuncio->ativo_;
WPushButton *tituloBtn = new WPushButton("Titulo",cont);
tituloBtn->clicked().connect(anuncio, &AdsAnuncio::editarTitulo);
WPushButton *urlBtn = new WPushButton("URL",cont);
urlBtn->clicked().connect(anuncio, &AdsAnuncio::editarURL);
WPushButton *imagemBtn = new WPushButton("Imagem",cont);
imagemBtn->clicked().connect(anuncio, &AdsAnuncio::editarImagem);
WPushButton *textoBtn = new WPushButton("Texto",cont);
textoBtn->clicked().connect(anuncio, &AdsAnuncio::editarTexto);
WCheckBox *ativoCheck = new Wt::WCheckBox("Ativo",cont);
if(anuncio->ativo_ == 1)
ativoCheck->setChecked(true);
else
ativoCheck->setChecked(false);
ativoCheck->changed().connect(anuncio, &AdsAnuncio::changeAtiva);
WPushButton *deletaBtn = new WPushButton("Deleta",cont);
deletaBtn->clicked().connect(anuncio, &AdsAnuncio::deletaAnuncio);
anuncio->renderUI();
layout->addWidget(cont);
}
w->setLayout(layout);
}
开发者ID:trumae,项目名称:PractWave,代码行数:53,代码来源:AdsEditor.cpp
示例9: makeToolbar
void gdContainerBar::init()
{
makeToolbar();
WVBoxLayout* vbox = new WVBoxLayout();
if ( !m_pPanel || !m_pPanel->titleBar() )
vbox->addWidget(m_pToolBar, 0);
// else
// m_pPanel->titleBarWidget()->addWidget(m_pToolBar);
vbox->addWidget(m_pView, 1);
resize(WLength(100, WLength::Percentage), WLength(100, WLength::Percentage));
setOverflow(WContainerWidget::OverflowHidden);
setLayout(vbox);
view()->model()->rowsInserted().connect(SLOT(this, gdContainerBar::doModelRowCountChanged));
view()->model()->rowsRemoved() .connect(SLOT(this, gdContainerBar::doModelRowCountChanged));
}
开发者ID:Wittyshare,项目名称:gdwtcore,代码行数:15,代码来源:gdContainerBar.cpp
示例10: WContainerWidget
///
// Constructor
//
MonitorPage::MonitorPage(const MRIBrowser *mriBrowser,
WContainerWidget *parent) :
WContainerWidget(parent),
mMRIBrowser(mriBrowser)
{
setStyleClass("tabdiv");
WGridLayout *layout = new WGridLayout();
layout->addWidget(createTitle("Cluster Jobs"), 0, 0);
WTabWidget *tabWidget = new WTabWidget();
tabWidget->setStyleClass("toptabdiv");
mMonitorLogTab = new MonitorLogTab(mriBrowser);
mMonitorResultsTab = new MonitorResultsTab(mriBrowser);
tabWidget->addTab(mMonitorResultsTab, "Results");
tabWidget->addTab(mMonitorLogTab, "Logs");
layout->addWidget(tabWidget, 1, 1);
WVBoxLayout *clusterJobsLayout = new WVBoxLayout();
mClusterJobBrowser = new ClusterJobBrowser();
mPatientInfoBox = new PatientInfoBox();
mPatientInfoBox->setStyleClass("verysmallgroupdiv");
clusterJobsLayout->addWidget(mClusterJobBrowser);
clusterJobsLayout->addWidget(mPatientInfoBox);
layout->addLayout(clusterJobsLayout, 1, 0);
// Let row 1 and column 2 take the excess space.
layout->setRowStretch(1, 1);
layout->setColumnStretch(1, 1);
setLayout(layout);
// Make connections
mClusterJobBrowser->clusterJobSelected().connect(SLOT(this, MonitorPage::jobSelectedChanged));
// All items in the tabbed widget need to be resized to 100% to
// fill the contents. This trick came from the Wt WTabWidget
// documentation and took me a good half a day to figure out.
mMonitorLogTab->resize(WLength(100, WLength::Percentage),
WLength(100, WLength::Percentage));
mMonitorResultsTab->resize(WLength(100, WLength::Percentage),
WLength(100, WLength::Percentage));
}
开发者ID:FNNDSC,项目名称:web,代码行数:50,代码来源:MonitorPage.cpp
示例11: internalPathNextPart
void Home::setup()
{
/*
* This function switches between the two major components of the homepage,
* depending on the internal path:
* /src -> source viewer
* /... -> homepage
*
* FIXME: we should take into account language /cn/src ...
*/
std::string base = internalPathNextPart("/");
if (base == SRC_INTERNAL_PATH) {
if (!sourceViewer_) {
delete homePage_;
homePage_ = 0;
root()->clear();
sourceViewer_ = sourceViewer("/" + SRC_INTERNAL_PATH + "/");
WVBoxLayout *layout = new WVBoxLayout();
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(sourceViewer_);
root()->setLayout(layout);
}
} else {
if (!homePage_) {
delete sourceViewer_;
sourceViewer_ = 0;
root()->clear();
createHome();
root()->addWidget(homePage_);
setLanguageFromPath();
}
}
}
开发者ID:GuLinux,项目名称:wt,代码行数:39,代码来源:Home.C
示例12: WContainerWidget
HydrovoltsConnectChartView::HydrovoltsConnectChartView(
HydrovoltsConnectModel* pModel,
WContainerWidget* parent):
WContainerWidget(parent),
m_y1(HydrovoltsConnectModel::COL_POWER),
m_y2(HydrovoltsConnectModel::COL_POWER, LineSeries, Y2Axis)
{
m_pModel = pModel;
resize(WLength::Auto, 600);
//resize(WLength::Auto, WLength::Auto);
setStyleClass("layoutdiv");
CreateChart();
HydrovoltsConnectChartToolbar* pToolbar = new HydrovoltsConnectChartToolbar( m_pModel, this);
pToolbar->y1Changed().connect(this, &HydrovoltsConnectChartView::OnY1Changed);
pToolbar->y2Changed().connect(this, &HydrovoltsConnectChartView::OnY2Changed);
WVBoxLayout *pLayout = new WVBoxLayout();
if (pLayout != NULL && m_pChart != NULL && pToolbar != NULL)
{
setWidth(WLength::Auto);
// Toolbar
pLayout->addWidget(pToolbar);
pLayout->setStretchFactor(pToolbar, 0);
// Chart
pLayout->addWidget(m_pChart);
pLayout->setStretchFactor(m_pChart,100);
//pLayout->setRowStretch();
//pLayout->setColumnStretch();
setLayoutSizeAware(true);
setLayout(pLayout);
}
}
开发者ID:hydrovolts,项目名称:hvconnect,代码行数:38,代码来源:HydrovoltsConnectChartView.cpp
示例13: getAccessRoot
void WsContent::viewDirectory(const std::string& path)
{
WsUser* pUser = WsApp->wsUser();
NodePtr pRootNode = pUser->getAccessRoot();
if ( !pRootNode ) {
wApp->log("notice") << "WsContent::viewDirectory() : Path = " << path << ", getAccessRoot() is null";
return;
}
NodePtr pNode = pRootNode.get()->eatPath(path);
if ( !pNode.get() ) {
wApp->log("notice") << "WsContent::viewDirectory() : Path = " << path << ", getAccessRoot() eatPath is null";
return;
}
std::string sInitPage = pNode.get()->getProperties().get()->get("global", "initial_page", "");
if ( sInitPage.size() > 0 ) {
std::string newPage = pNode.get()->getPath().string() + "/" + sInitPage;
wApp->log("notice") << "WsContent::viewDirectory() : set initial page to " << newPage;
return wApp->setInternalPath(newPage, true);
}
clear();
if ( !(pUser->isAdministrator() || pUser->isEditor()) )
if ( WsLayoutProperties::instance()->get("global", "use_content_directory_view", "false") == "false" ) return;
WsApp->hideImages(false);
WWidget* w = WsApp->WsModules().module("WsModDirectoryView2")->createContents();
WsOptions* wOpt = dynamic_cast<WsOptions*>(w);
wOpt->setOption("rootPath", path);
if ( 0 ) {
WVBoxLayout* vBox = new WVBoxLayout();
vBox->addWidget(w, 1);
setLayout(vBox);
setOverflow(WContainerWidget::OverflowHidden);
} else {
addWidget(w);
setOverflow(WContainerWidget::OverflowAuto);
}
}
开发者ID:Wittyshare,项目名称:wittyshare,代码行数:36,代码来源:WsContent.cpp
示例14: BaseWidget
IdeaSubmit::IdeaSubmit(CgiRoot *cgi, Wt::WDialog *parentDialog, bool editMode, size_t editRowId) : BaseWidget(cgi),
m_dlgParent(parentDialog),
m_editMode(editMode),
m_editRowId(editRowId),
m_editCompletedHandler(this)
{
this->clear();
this->addWidget(Layout());
this->setOverflow(WContainerWidget::OverflowAuto);
Div *dvButtonWrappers = new Div();
Div *dvButtons = new Div(dvButtonWrappers, "dvDialogButtons");
WPushButton *submitButton;
if (!m_editMode)
submitButton = new WPushButton(m_lang->GetString("HOME_SUBMIT_IDEA_DLG_OK_BUTTON"), dvButtons);
else
submitButton = new WPushButton(m_lang->GetString("HOME_SUBMIT_IDEA_DLG_OK_EDIT_BUTTON"), dvButtons);
WPushButton *returnButton = new WPushButton(m_lang->GetString("HOME_SUBMIT_IDEA_DLG_RETURN_BUTTON"), dvButtons);
submitButton->setStyleClass("dialogButton");
returnButton->setStyleClass("dialogButton");
WVBoxLayout *layout = new WVBoxLayout();
layout->addWidget(this);
layout->setStretchFactor(this, 1);
layout->addWidget(dvButtonWrappers );
layout->setStretchFactor(dvButtonWrappers , 0);
m_dlgParent->contents()->setLayout(layout);
if (m_editMode) {
string title;
int typegamesentertainment;
int typehygienehealth;
int typenewsinfo;
int typelearning;
int typenonepresenceservices;
int typeonlineshopping;
int typeothers;
string typeotherstext;
string description;
int audienceteens;
int audienceparents;
int audienceboys;
int audiencegirls;
int audiencewomen;
int audiencemen;
int audiencechilds;
int audienceallfamilymembers;
string usage;
string similar;
string difference;
result r = m_db->Sql() << "SELECT title, "
"typegamesentertainment, typehygienehealth, typenewsinfo, typelearning, "
"typenonepresenceservices, typeonlineshopping, typeothers, typeotherstext, "
"description, "
"audienceteens, audienceparents, audienceboys, audiencegirls, audiencewomen, "
"audiencemen, audiencechilds, audienceallfamilymembers, "
"usage, similar, difference "
"FROM [" + m_dbTables->Table("IDEAS")
+ "] WHERE rowid=?;" << m_editRowId << row;
if (!r.empty()) {
r >> title >> typegamesentertainment >> typehygienehealth
>> typenewsinfo >> typelearning >> typenonepresenceservices >> typeonlineshopping
>> typeothers >> typeotherstext >> description >> audienceteens >> audienceparents >> audienceboys
>> audiencegirls >> audiencewomen >> audiencemen >> audiencechilds >> audienceallfamilymembers
>> usage >> similar >> difference;
title = Crypto::Decrypt(title);
typeotherstext = Crypto::Decrypt(typeotherstext);
description = Crypto::Decrypt(description);
usage = Crypto::Decrypt(usage);
similar = Crypto::Decrypt(similar);
difference = Crypto::Decrypt(difference);
m_typeGamesEntertainmentCheckBox->setChecked(typegamesentertainment);
m_typeHygieneHealthCheckBox->setChecked(typehygienehealth);
m_typeNewsInfoCheckBox->setChecked(typenewsinfo);
m_typeLearningCheckBox->setChecked(typelearning);
m_typeNonePresenceServicesCheckBox->setChecked(typenonepresenceservices);
m_typeOnlineShoppingCheckBox->setChecked(typeonlineshopping);
m_typeOthersCheckBox->setChecked(typeothers);
if (typeothers)
m_typeOthersTextLineEdit->setText(WString::fromUTF8(typeotherstext));
m_titleLineEdit->setText(WString::fromUTF8(title));
m_descriptionTextArea->setText(WString::fromUTF8(description));
m_audienceTeensCheckBox->setChecked(audienceteens);
m_audienceParentsCheckBox->setChecked(audienceparents);
m_audienceBoysCheckBox->setChecked(audienceboys);
m_audienceGirlsCheckBox->setChecked(audiencegirls);
m_audienceWomenCheckBox->setChecked(audiencewomen);
m_audienceMenCheckBox->setChecked(audiencemen);
m_audienceChildsCheckBox->setChecked(audiencechilds);
m_audienceAllFamilyMembersCheckBox->setChecked(audienceallfamilymembers);
m_usageTextArea->setText(WString::fromUTF8(usage));
//.........这里部分代码省略.........
开发者ID:Siadatian,项目名称:samsungdforum.ir,代码行数:101,代码来源:ideasubmit.cpp
示例15: WContainerWidget
DetailManipulation::DetailManipulation(bool enhance, WContainerWidget *parent)
: WContainerWidget(parent), onlySmooth(!enhance)
{
resize(WLength::Auto, WLength::Auto);
// Image bar
prepareInputImages();
WContainerWidget *imageBar = new WContainerWidget;
WVBoxLayout *imageBarLayout = new WVBoxLayout();
for (size_t i = 0; i < inputImages.size(); ++i) {
WImage *img = inputImages[i]->getOriginalImage();
img->setStyleClass("image_button");
img->resize(160, 120);
img->setAttributeValue("onMouseOver", "this.width=192; this.height=144;");
img->setAttributeValue("onMouseOut", "this.width=160; this.height=120;");
img->clicked().connect(
boost::bind(&DetailManipulation::selectImage,
this,
i
)
);
imageBarLayout->addWidget(img);
}
imageBar->resize(200, WLength::Auto);
imageBar->setLayout(imageBarLayout);
selectedImageId = 0;
// Main component
imageTab = new WTabWidget();
imageTab->addTab(inputImages[selectedImageId]->getOriginalImage(), "Original");
if (onlySmooth) {
imageTab->addTab(new WImage(smoothedResult[selectedImageId].second), smoothedResult[selectedImageId].first);
}
else {
imageTab->addTab(new WImage(enhancedResult[selectedImageId].second), enhancedResult[selectedImageId].first);
}
imageTab->resize(600, WLength::Auto);
WGridLayout *controllerLayout = new WGridLayout();
WSlider *rSlider = new WSlider(Wt::Vertical);
rSlider->setRange(SLIDER_MINIMUM, SLIDER_MAXIMUM);
rSlider->setTickPosition(Wt::WSlider::TicksBothSides);
WDoubleSpinBox *rSpinBox = new WDoubleSpinBox();
rSpinBox->setMinimum(R_MINIMUM);
rSpinBox->setMaximum(R_MAXIMUM);
rSlider->sliderMoved().connect(
boost::bind(&DetailManipulation::changeDoubleSpinBoxValue,
this,
rSpinBox,
true,
_1)
);
rSpinBox->valueChanged().connect(
boost::bind(&DetailManipulation::changeSliderValue,
this,
rSlider,
1.f/(R_MAXIMUM-R_MINIMUM),
_1)
);
controllerLayout->addWidget(rSlider, 2, 0, 6, 1);
controllerLayout->addWidget(rSpinBox, 9, 0);
controllerLayout->addWidget(new WText("radius"), 10, 0);
WSlider *epsSlider = new WSlider(Wt::Vertical);
epsSlider->setMinimum(SLIDER_MINIMUM);
epsSlider->setMaximum(SLIDER_MAXIMUM);
epsSlider->setRange(SLIDER_MINIMUM, SLIDER_MAXIMUM);
epsSlider->setTickPosition(WSlider::TicksBothSides);
WDoubleSpinBox *epsSpinBox = new WDoubleSpinBox();
epsSpinBox->setMinimum(EPS_MINIMUM);
epsSpinBox->setMaximum(EPS_MAXIMUM);
epsSlider->sliderMoved().connect(
boost::bind(&DetailManipulation::changeDoubleSpinBoxValue,
this,
epsSpinBox,
false,
_1)
);
epsSpinBox->valueChanged().connect(
boost::bind(&DetailManipulation::changeSliderValue,
this,
epsSlider,
1.f/(EPS_MAXIMUM-EPS_MINIMUM),
_1)
);
controllerLayout->addWidget(epsSlider, 2, 1, 6, 1);
controllerLayout->addWidget(epsSpinBox, 9, 1);
controllerLayout->addWidget(new WText("epsilon"), 10, 1);
WPushButton *apply = new WPushButton("Apply");
apply->clicked().connect(
boost::bind(&DetailManipulation::applyEnhancement,
this,
rSpinBox,
epsSpinBox
)
);
//.........这里部分代码省略.........
开发者ID:mingyc,项目名称:edge-aware-filtering,代码行数:101,代码来源:project1.cpp
示例16: expression
void WDialog::create()
{
closeIcon_ = 0;
footer_ = 0;
modal_ = true;
resizable_ = false;
recursiveEventLoop_ = false;
impl_ = dynamic_cast<WTemplate *>(implementation());
const char *CSS_RULES_NAME = "Wt::WDialog";
WApplication *app = WApplication::instance();
if (!app->styleSheet().isDefined(CSS_RULES_NAME)) {
/* Needed for the dialog cover */
if (app->environment().agentIsIElt(9))
app->styleSheet().addRule("body", "height: 100%;");
std::string position
= app->environment().agent() == WEnvironment::IE6 ? "absolute" : "fixed";
// we use left: 50%, top: 50%, margin hack when JavaScript is not available
// see below for an IE workaround
app->styleSheet().addRule("div.Wt-dialog", std::string() +
(app->environment().ajax() ?
"visibility: hidden;" : "")
//"position: " + position + ';'
+ (!app->environment().ajax() ?
"left: 50%; top: 50%;"
"margin-left: -100px; margin-top: -50px;" :
"left: 0px; top: 0px;"),
CSS_RULES_NAME);
if (app->environment().agent() == WEnvironment::IE6) {
app->styleSheet().addRule
("div.Wt-dialogcover",
"position: absolute;"
"left: expression("
"(ignoreMe2 = document.documentElement.scrollLeft) + 'px' );"
"top: expression("
"(ignoreMe = document.documentElement.scrollTop) + 'px' );");
// simulate position: fixed left: 50%; top 50%
if (!app->environment().ajax())
app->styleSheet().addRule
("div.Wt-dialog",
"position: absolute;"
"left: expression("
"(ignoreMe2 = document.documentElement.scrollLeft + "
"document.documentElement.clientWidth/2) + 'px' );"
"top: expression("
"(ignoreMe = document.documentElement.scrollTop + "
"document.documentElement.clientHeight/2) + 'px' );");
}
}
LOAD_JAVASCRIPT(app, "js/WDialog.js", "WDialog", wtjs1);
WContainerWidget *layoutContainer = new WContainerWidget();
layoutContainer->setStyleClass("dialog-layout");
WVBoxLayout *layout = new WVBoxLayout(layoutContainer);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
impl_->bindWidget("layout", layoutContainer);
titleBar_ = new WContainerWidget();
app->theme()->apply(this, titleBar_, DialogTitleBarRole);
caption_ = new WText(titleBar_);
caption_->setInline(false);
contents_ = new WContainerWidget();
app->theme()->apply(this, contents_, DialogBodyRole);
layout->addWidget(titleBar_);
layout->addWidget(contents_, 1);
saveCoverState(app, app->dialogCover());
/*
* Cannot be done using the CSS stylesheet in case there are
* contained elements with setHideWithOffsets() set
*
* For IE, we cannot set it yet since it will confuse width measurements
* to become minimum size instead of (unconstrained) preferred size
*/
if (app->environment().ajax()) {
setAttributeValue("style", "visibility: hidden");
/*
* This is needed for animations only, but setting absolute or
* fixed positioning confuses layout measurement in IE browsers
*/
if (!app->environment().agentIsIElt(9))
setPositionScheme(Fixed);
} else
setPositionScheme(app->environment().agent() == WEnvironment::IE6
? Absolute : Fixed);
}
开发者ID:NeilNienaber,项目名称:wt,代码行数:99,代码来源:WDialog.C
示例17: WContainerWidget
///
// Constructor
//
LoginPage::LoginPage(WContainerWidget *parent) :
WContainerWidget(parent),
mLoggedIn(false),
mLogoutRequested(false)
{
setStyleClass("maindiv");
WLabel* loginText = new WLabel("Enter username and password:");
mUserNameLineEdit = new WLineEdit("");
WText *userNameText = new WText("User Name:");
mPasswordLineEdit = new WLineEdit("");
mPasswordLineEdit->setEchoMode(WLineEdit::Password);
WText *passwordText = new WText("Password:");
WPushButton *loginButton = new WPushButton("Login");
WGridLayout *loginLayout = new WGridLayout();
loginLayout->addWidget(userNameText, 0, 0, AlignRight);
loginLayout->addWidget(mUserNameLineEdit, 0, 1, AlignLeft);
loginLayout->addWidget(passwordText, 1, 0, AlignRight);
loginLayout->addWidget(mPasswordLineEdit, 1, 1, AlignLeft);
WGridLayout *textLayout = new WGridLayout();
textLayout->addWidget(loginText, 0, 0, AlignCenter);
WGridLayout *buttonLayout = new WGridLayout();
buttonLayout->addWidget(loginButton, 0, 0, AlignCenter | AlignMiddle);
WImage *chbLogo = new WImage(tr("logo-image").toUTF8());
WGridLayout *chbLogoLayout = new WGridLayout();
chbLogoLayout->addWidget(chbLogo, 0, 0, AlignCenter);
WLabel *titleLabel = new WLabel(tr("page-top-text"));
titleLabel->setStyleClass("logintitlediv");
WGridLayout *titleLayout = new WGridLayout();
titleLayout->addWidget(titleLabel, 0, 0, AlignCenter);
WContainerWidget *loginContainer = new WContainerWidget();
loginContainer->setStyleClass("logindiv");
mFailureLabel = new WLabel("Invalid username and/or password. Try again.");
mFailureLabel->setStyleClass("redtext");
WVBoxLayout *layout = new WVBoxLayout();
layout->addLayout(chbLogoLayout, AlignCenter);
layout->addLayout(titleLayout, AlignCenter);
layout->addLayout(textLayout, AlignCenter);
layout->addLayout(loginLayout);
layout->addWidget(mFailureLabel);
layout->addLayout(buttonLayout, AlignCenter | AlignMiddle);
mFailureLabel->hide();
loginContainer->setLayout(layout, AlignTop);
WVBoxLayout *pageLayout = new WVBoxLayout();
pageLayout->addWidget(loginContainer);
pageLayout->addWidget(new WText(tr("login-page-text")));
setLayout(pageLayout, AlignMiddle | AlignCenter);
loginButton->clicked().connect(SLOT(this, LoginPage::login));
mPasswordLineEdit->enterPressed().connect(SLOT(this, LoginPage::login));
resetAll();
}
开发者ID:FNNDSC,项目名称:web,代码行数:72,代码来源:LoginPage.cpp
示例18: WContainerWidget
WWidget *StyleLayout::wBoxLayout()
{
WContainerWidget *result = new WContainerWidget();
topic("WHBoxLayout", "WVBoxLayout", result);
addText(tr("layout-WBoxLayout"), result);
WContainerWidget *container;
WText *item;
WHBoxLayout *hbox;
WVBoxLayout *vbox;
/*
* first hbox
*/
container = new WContainerWidget(result);
container->setStyleClass("yellow-box");
hbox = new WHBoxLayout();
container->setLayout(hbox);
item = addText(tr("layout-item1"));
item->setStyleClass("green-box");
hbox->addWidget(item);
item = addText(tr("layout-item2"));
item->setStyleClass("blue-box");
hbox->addWidget(item);
addText(tr("layout-WBoxLayout-stretch"), result);
/*
* second hbox
*/
container = new WContainerWidget(result);
container->setStyleClass("yellow-box");
hbox = new WHBoxLayout();
container->setLayout(hbox);
item = addText(tr("layout-item1"));
item->setStyleClass("green-box");
hbox->addWidget(item, 1);
item = addText(tr("layout-item2"));
item->setStyleClass("blue-box");
hbox->addWidget(item);
addText(tr("layout-WBoxLayout-vbox"), result);
/*
* first vbox
*/
container = new WContainerWidget(result);
container->resize(150, 150);
container->setStyleClass("yellow-box centered");
vbox = new WVBoxLayout();
container->setLayout(vbox);
item = addText(tr("layout-item1"));
item->setStyleClass("green-box");
vbox->addWidget(item);
item = addText(tr("layout-item2"));
item->setStyleClass("blue-box");
vbox->addWidget(item);
/*
* second vbox
*/
container = new WContainerWidget(result);
container->resize(150, 150);
container->setStyleClass("yellow-box centered");
vbox = new WVBoxLayout();
container->setLayout(vbox);
item = addText(tr("layout-item1"));
item->setStyleClass("green-box");
vbox->addWidget(item, 1);
item = addText(tr("layout-item2"));
item->setStyleClass("blue-box");
vbox->addWidget(item);
addText(tr("layout-WBoxLayout-nested"), result);
/*
* nested boxes
*/
container = new WContainerWidget(result);
container->resize(200, 200);
container->setStyleClass("yellow-box centered");
vbox = new WVBoxLayout();
container->setLayout(vbox);
item = addText(tr("layout-item1"));
item->setStyleClass("green-box");
vbox->addWidget(item, 1);
hbox = new WHBoxLayout();
vbox->addLayout(hbox);
//.........这里部分代码省略.........
开发者ID:ReWeb3D,项目名称:wt,代码行数:101,代码来源:StyleLayout.C
示例19: GitViewApplication
/*! \brief Constructor.
*/
GitViewApplication(const WEnvironment& env)
: WApplication(env)
{
useStyleSheet("gitview.css");
setTitle("Git model example");
const char *gitRepo = getenv("GITVIEW_REPOSITORY_PATH");
WGridLayout *grid = new WGridLayout();
grid->addWidget(new WText("Git repository path:"), 0, 0);
grid->addWidget(repositoryEdit_ = new WLineEdit(gitRepo ? gitRepo : "")
, 0, 1, AlignLeft);
grid->addWidget(repositoryError_ = new WText(), 0, 2);
grid->addWidget(new WText("Revision:"), 1, 0);
grid->addWidget(revisionEdit_ = new WLineEdit("master"), 1, 1, AlignLeft);
grid->addWidget(revisionError_ = new WText(), 1, 2);
repositoryEdit_->setTextSize(30);
revisionEdit_->setTextSize(20);
repositoryError_->setStyleClass("error-msg");
revisionError_->setStyleClass("error-msg");
repositoryEdit_->enterPressed()
.connect(this, &GitViewApplication::loadGitModel);
revisionEdit_->enterPressed()
.connect(this, &GitViewApplication::loadGitModel);
WPushButton *b = new WPushButton("Load");
b->clicked().connect(this, &GitViewApplication::loadGitModel);
grid->addWidget(b, 2, 0, AlignLeft);
gitView_ = new WTreeView();
gitView_->resize(300, WLength::Auto);
gitView_->setSortingEnabled(false);
gitView_->setModel(gitModel_ = new GitModel(this));
gitView_->setSelectionMode(SingleSelection);
gitView_->selectionChanged().connect(this, &GitViewApplication::showFile);
sourceView_ = new SourceView(DisplayRole,
GitModel::ContentsRole,
GitModel::FilePathRole);
sourceView_->setStyleClass("source-view");
if (environment().javaScript()) {
/*
* We have JavaScript: We can use layout managers so everything will
* always fit nicely in the window.
*/
WVBoxLayout *topLayout = new WVBoxLayout();
topLayout->addLayout(grid, 0, AlignTop | AlignLeft);
WHBoxLayout *gitLayout = new WHBoxLayout();
gitLayout->setLayoutHint("table-layout", "fixed");
gitLayout->addWidget(gitView_, 0);
gitLayout->addWidget(sourceView_, 1);
topLayout->addLayout(gitLayout, 1);
root()->setLayout(topLayout);
root()->setStyleClass("maindiv");
} else {
/*
* No JavaScript: let's make the best of the situation using regular
* CSS-based layout
*/
root()->setStyleClass("maindiv");
WContainerWidget *top = new WContainerWidget();
|
请发表评论