English 中文(简体)
在S60创建像申请一样的 Sym
原标题:Creating a Symbian s like application menu at S60

我想作一 app,一开始,就显示一 men。 就像你在S60发表看法一样。 这里是一张屏幕。

“what

我如何做到这一点? 我试图将QMainWindow作为QMenu的中心目标,并在QMenu上增加QAction。 但是,当我执政时,这只字不提。 我曾试图利用QMenuBar使QMenu变得如此。 这是一种oka。 但是,我只能用上下钥匙在装置中选择菜单。 当我宣传这些选择(Qt:PositiveSoftKey)时,菜巴也表现出来。 我甚至补充说,在由QMainWindow拥有的菜.(Bar)之外。

这是我的第一个法典:

QAction* act1= new QAction(tr("act1"),this);
QObject::connect(tes,SIGNAL(triggered()),this,SLOT(close()));
QAction* act2= new QAction(tr("act2"),this);
QObject::connect(tes,SIGNAL(triggered()),this,SLOT(close()));
QMenu* menu = new QMenu(this);
menu->addAction(act1);
menu->addAction(act2);
setCentralWidget(menu);

这丝毫没有说明。

我的第二项尝试就是:

Qt Code: Switch view
QAction* act1= new QAction(tr("act1"),this);
QObject::connect(tes,SIGNAL(triggered()),this,SLOT(close()));
QAction* act2= new QAction(tr("act2"),this);
QObject::connect(tes,SIGNAL(triggered()),this,SLOT(close()));
QMenuBar* menubar = new QMenuBar(this);
QMenu* menu = menubar->addMenu(tr("menu"));
menu->addAction(act1);
menu->addAction(act2);
setCentralWidget(menu);

它显示了菜单。 但是,当我部署到这个装置时,我可以不使用钥匙选择。 在模拟器上,如果我点击了QAction项目以外的其他地方,那么菜单就损失了。

我正在采用另一种做法,使用Vertical Layout的QPushButton。 该守则是:

QWidget* centralWidget = new QWidget(this);
QScrollArea* scrollArea = new QScrollArea(this);
scrollArea->setWidget(centralWidget);
scrollArea->setWidgetResizable(true);
setCentralWidget(scrollArea);

QVBoxLayout* centralLayout = new QVBoxLayout(centralWidget);
QPushButton* button1 = new QPushButton(tr("button 1"));
QPushButton* button2 = new QPushButton(tr("button 2"));
centralLayout->addWidget(button1);
centralLayout->addWidget(button2);
centralLayout->setContentsMargins(0,0,0,0);
button1->setFocus();

Here it s look:

8button

“奥凯”,这很好。 但是,如果这有8个县。 如果只有2个县,它就认为:

“2button”/

looks? 防止这种情况的任何方法?

最佳回答

对我来说,你重新尝试复制的《倡议》是一份备选办法清单,因此,为什么不试图根据一份植被清单创建《国际倡议》?

Asumming that you re going to use a list, you have to options from which you have to choose based on your needs and your app requirements:

  • Qt Widgets: Available in all the Qt support Plataforms. 为台式创建,在台上工作,但对于移动设备感到奇怪。 查阅QListWidget/a>和QListView

  • Qt Quick: It isn t available for S40 phones or S60 3rd edition, not available for non-touch phones, basically. Created for "touch enabled UI s", it doesn t offer a stable set of widgets (buttons, comboboxes) yet, but it offers a set of primitives (like rectangles or images) that gives you a lot of freedom to create your UI s and it looks pretty good. I think that this is what Lucian used to create the UI from his answer. This examples could be of particular interest: http://doc.qt.io/archives/qt-4.7/all-examples.html

页: 1

希望!

EDIT:增加QListWidget的例子

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    for(int i=0; i<10; i++) {
        QListWidgetItem *item = new QListWidgetItem(QIcon("Qt.png"), QString("Item %1").arg(i));
        ui->listWidget->insertItem(i, item);
    }
    ui->listWidget->setIconSize(QSize(64, 64));

    connect(ui->listWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(onItemClicked(QListWidgetItem*)));
}

void MainWindow::onItemClicked(QListWidgetItem *item)
{
    QMessageBox::information(this, "", QString("%1 pressed").arg(item->text()));
}

问题回答

你们在世界上都有创造你们的布局的自由。 使这些纽州更加接近? 他们认为,他们的核心是什么?

所附图像带给我30秒钟,以创造和看看已经是体面的(根据我的设计师的技能)。

“entergraph





相关问题
Very basic WPF layout question

How do I get this listbox to be maxiumum size, i.e. fill the group box its in. I ve tried width="auto" Height="auto", width="stretch" Height="stretch" annoyingly at the moment, it dynamicly sizes to ...

How to align the text to top of TextView?

How to align the text to top of a TextView? Equivalent Android API for Swings setInsets()? that is top of text should start be in (0,0) of TextView <?xml version="1.0" encoding="utf-8"?> <...

Centring a flow in Shoes

Can I center the contents of a flow in Shoes? I know that a paragraph can be centred like: para Centred paragrpah , :align=> center However, this does not work with flows: flow(:align=> ...

Overlaying with CSS

I want to load a website in an iframe, and overlay the website with some hints about the website that is shown. However, i got stuck at the point that the website has a variable passive white space at ...

How do you normally make a program look beautiful? [closed]

How can I make an Application look nice and not like an amateur pulled it together? I mean graphic-wise. Is there some sort of book you can read regarding beautiful program layouts, etc? I put this ...

热门标签