tabwidget和版本户主和房产证有关系吗吗

> QDialog上的QTabWidget有关问题
QDialog上的QTabWidget有关问题
发布时间: & &
浏览:9 & &
回复:1 & &
悬赏:0.0希赛币
QDialog下的QTabWidget问题我在一个QDialog下添加了一个tabWidget,在其下添加了一positionTab,给这个positionTab设置了layout,但是运行后发现positionTab下什么东西都没有。。。  C/C++ code   QTabWidget *tabWidget = new QTabW QWidget *positionTab = new QWidget(); QFormLayout *lightPositionLayout = new QFormLayout(); lightPositionLayout-&addRow(&X:&,xpos); lightPositionLayout-&addRow(&Y:&,ypos); lightPositionLayout-&addRow(&Z:&,zpos); positionTab-&setLayout(lightPositionLayout); tabWidget-&addTab(positionTab,&Position&);
研究了快3个小时了看不明白到底哪里错了。奇怪的地方在于,下面的代码会让tabWidget的另外一个tab(ambientTab)下显示“This is a low”!  C/C++ code   QLabel *ambientTab = new QLabel(tr(&This is a low&)); tabWidget-&addTab(ambientTab,tr(&Ambient&));
有高人解释一下我到底哪里错了吗???还是QDialog下的QTabWidget有问题?
addRow有问题。和UI相关的设计,最好使用Qt Designer,不易出错。下面是我用它生成的代码,你比较一下:/********************************************************************************** Form generated from reading UI file 'designerGg6260.ui'**** Created: Wed Jul 4 21:55:40 2012**
by: Qt User Interface Compiler version 4.8.2**** WARNING! All changes made in this file will be lost when recompiling UI file!********************************************************************************/#ifndef DESIGNERGG6260_H#define DESIGNERGG6260_H#include &QtCore/QVariant&#include &QtGui/QAction&#include &QtGui/QApplication&#include &QtGui/QButtonGroup&#include &QtGui/QDialog&#include &QtGui/QFormLayout&#include &QtGui/QHeaderView&#include &QtGui/QLabel&#include &QtGui/QLineEdit&#include &QtGui/QTabWidget&#include &QtGui/QVBoxLayout&#include &QtGui/QWidget&QT_BEGIN_NAMESPACEclass Ui_Dialog{public:
QVBoxLayout *verticalL
QTabWidget *tabW
QWidget *formLayoutW
QFormLayout *formL
QLabel *xL
QLineEdit *xLineE
QLabel *yL
QLineEdit *yLineE
QLabel *zL
QLineEdit *zLineE
void setupUi(QDialog *Dialog)
if (Dialog-&objectName().isEmpty())
Dialog-&setObjectName(QString::fromUtf8(&Dialog&));
Dialog-&resize(400, 300);
verticalLayout = new QVBoxLayout(Dialog);
verticalLayout-&setObjectName(QString::fromUtf8(&verticalLayout&));
tabWidget = new QTabWidget(Dialog);
tabWidget-&setObjectName(QString::fromUtf8(&tabWidget&));
tab = new QWidget();
tab-&setObjectName(QString::fromUtf8(&tab&));
formLayoutWidget = new QWidget(tab);
formLayoutWidget-&setObjectName(QString::fromUtf8(&formLayoutWidget&));
formLayoutWidget-&setGeometry(QRect(70, 30, 160, 80));
formLayout = new QFormLayout(formLayoutWidget);
formLayout-&setObjectName(QString::fromUtf8(&formLayout&));
formLayout-&setContentsMargins(0, 0, 0, 0);
xLabel = new QLabel(formLayoutWidget);
xLabel-&setObjectName(QString::fromUtf8(&xLabel&));
formLayout-&setWidget(0, QFormLayout::LabelRole, xLabel);
xLineEdit = new QLineEdit(formLayoutWidget);
xLineEdit-&setObjectName(QString::fromUtf8(&xLineEdit&));
formLayout-&setWidget(0, QFormLayout::FieldRole, xLineEdit);llovel1987 & &
& & (0)(0)
本问题标题:
本问题地址:
温馨提示:本问题已经关闭,不能解答。
暂无合适的专家
&&&&&&&&&&&&&&&
希赛网 版权所有 & &&&&湘教QS2-164&&增值电信业务经营许可证湘B2-Android 切换卡(TabWidget) - CSDN博客
先看下效果图
TabWidget继承自TabActivity类,并实现setOnTabChangedListener的onTabChanged方法来监听Tab的改变:
布局文件:
&?xml version=&1.0& encoding=&utf-8&?&
&TabHost xmlns:android=&/apk/res/android&
android:id=&@android:id/tabhost&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&&
&LinearLayout
android:orientation=&vertical&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&&
&TabWidget
android:id=&@android:id/tabs&
android:layout_width=&fill_parent&
android:layout_height=&wrap_content& /&
&FrameLayout
android:id=&@android:id/tabcontent&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&&
android:id=&@+id/textview1&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:text=&this is a tab& /&
android:id=&@+id/textview2&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:text=&this is another tab& /&
android:id=&@+id/textview3&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:text=&this is a third tab& /&
&/FrameLayout&
&/LinearLayout&
&/TabHost&
public class Android_actionBar extends TabActivity{
* Action Bar学习
//声明TabHost对象
& & TabHost mTabH
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.actionbar);&
//取得TabHost对象
& & & & mTabHost = getTabHost();
& & & & //新建一个newTabSpec(newTabSpec)
& & & & //设置其标签和图标(setIndicator)
& & & & //设置内容(setContent)
& & & & mTabHost.addTab(mTabHost.newTabSpec(&tab_test1&)
& & & & & & & & .setIndicator(&通话记录&).setContent(R.id.textview1));
& & & & mTabHost.addTab(mTabHost.newTabSpec(&tab_test2&)
& & & & & & & & .setIndicator(&已接来电&).setContent(R.id.textview2));
& & & & mTabHost.addTab(mTabHost.newTabSpec(&tab_test3&)
& & & & & & & & .setIndicator(&未接来电&).setContent(R.id.textview3));
& & & & //设置TabHost的背景颜色
& & & & //mTabHost.setBackgroundColor(Color.argb(150, 22, 70, 150));
& & & & //设置TabHost的背景图片资源
& & & & //mTabHost.setBackgroundResource(R.drawable.bg0);
& & & & //设置当前显示哪一个标签
& & & & mTabHost.setCurrentTab(0);
& & & & //标签切换事件处理,setOnTabChangedListener
& & & & mTabHost.setOnTabChangedListener(new OnTabChangeListener()
& & & & & & // TODO Auto-generated method stub
& & & & & & @Override
& & & & & & public void onTabChanged(String tabId)
& & & & & & {
& & & & & & & & & & Dialog dialog = new AlertDialog.Builder(Android_actionBar.this)
& & & & & & & & & & & & & & .setTitle(&提示&)
& & & & & & & & & & & & & & .setMessage(&当前选中:&+tabId+&标签&)
& & & & & & & & & & & & & & .setPositiveButton(&确定&,
& & & & & & & & & & & & & & new DialogInterface.OnClickListener()
& & & & & & & & & & & & & & {
& & & & & & & & & & & & & & & & public void onClick(DialogInterface dialog, int whichButton)
& & & & & & & & & & & & & & & & {
& & & & & & & & & & & & & & & & & & dialog.cancel();
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & & & }).create();//创建按钮
& & & & & & &
& & & & & & & & & & dialog.show();
& & & & & & } & & & & &&
& & & & });Android 切换卡(TabWidget) - CSDN博客
先看下效果图
TabWidget继承自TabActivity类,并实现setOnTabChangedListener的onTabChanged方法来监听Tab的改变:
布局文件:
&?xml version=&1.0& encoding=&utf-8&?&
&TabHost xmlns:android=&/apk/res/android&
android:id=&@android:id/tabhost&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&&
&LinearLayout
android:orientation=&vertical&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&&
&TabWidget
android:id=&@android:id/tabs&
android:layout_width=&fill_parent&
android:layout_height=&wrap_content& /&
&FrameLayout
android:id=&@android:id/tabcontent&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&&
android:id=&@+id/textview1&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:text=&this is a tab& /&
android:id=&@+id/textview2&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:text=&this is another tab& /&
android:id=&@+id/textview3&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:text=&this is a third tab& /&
&/FrameLayout&
&/LinearLayout&
&/TabHost&
public class Android_actionBar extends TabActivity{
* Action Bar学习
//声明TabHost对象
& & TabHost mTabH
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.actionbar);&
//取得TabHost对象
& & & & mTabHost = getTabHost();
& & & & //新建一个newTabSpec(newTabSpec)
& & & & //设置其标签和图标(setIndicator)
& & & & //设置内容(setContent)
& & & & mTabHost.addTab(mTabHost.newTabSpec(&tab_test1&)
& & & & & & & & .setIndicator(&通话记录&).setContent(R.id.textview1));
& & & & mTabHost.addTab(mTabHost.newTabSpec(&tab_test2&)
& & & & & & & & .setIndicator(&已接来电&).setContent(R.id.textview2));
& & & & mTabHost.addTab(mTabHost.newTabSpec(&tab_test3&)
& & & & & & & & .setIndicator(&未接来电&).setContent(R.id.textview3));
& & & & //设置TabHost的背景颜色
& & & & //mTabHost.setBackgroundColor(Color.argb(150, 22, 70, 150));
& & & & //设置TabHost的背景图片资源
& & & & //mTabHost.setBackgroundResource(R.drawable.bg0);
& & & & //设置当前显示哪一个标签
& & & & mTabHost.setCurrentTab(0);
& & & & //标签切换事件处理,setOnTabChangedListener
& & & & mTabHost.setOnTabChangedListener(new OnTabChangeListener()
& & & & & & // TODO Auto-generated method stub
& & & & & & @Override
& & & & & & public void onTabChanged(String tabId)
& & & & & & {
& & & & & & & & & & Dialog dialog = new AlertDialog.Builder(Android_actionBar.this)
& & & & & & & & & & & & & & .setTitle(&提示&)
& & & & & & & & & & & & & & .setMessage(&当前选中:&+tabId+&标签&)
& & & & & & & & & & & & & & .setPositiveButton(&确定&,
& & & & & & & & & & & & & & new DialogInterface.OnClickListener()
& & & & & & & & & & & & & & {
& & & & & & & & & & & & & & & & public void onClick(DialogInterface dialog, int whichButton)
& & & & & & & & & & & & & & & & {
& & & & & & & & & & & & & & & & & & dialog.cancel();
& & & & & & & & & & & & & & & & }
& & & & & & & & & & & & & & }).create();//创建按钮
& & & & & & &
& & & & & & & & & & dialog.show();
& & & & & & } & & & & &&
& & & & });第37课 TabWidget控件学习 - Android开发从零开始 - 好知网
L37TabWidget控件学习
正在载入视频,请稍等...
小提示:如无法播放此课程视频,请或。
恭喜您完成了该课时的学习,还有3课时未学,
该操作需要登录,请先或。
课程创建人
IT达人,分享了众多安卓和IOS开发教程。
课程最新笔记
1、安装JDK,1.5以上版本。2、下载Eclipse,推荐安装3.5版本。根据自己的操作系统下载安装。3、安装Andr...
(未完)1.android需要的jdk版本1.5以上(包括1.5)2.eclipse3.5比较好,3.6容易假死3.安装...
1.点击start启动模拟器. ⑴启动模拟器之后,进行配置.配置语言,(点击steting-language&...
课程最新问题
相关小组最新话题
学习路上要有伙伴同行!
每天同学们在这儿学习数万课时,登录后一起学习交流吧。
已有好知网帐号? 也可从合作网站帐号登录:}

我要回帖

更多关于 网速和路由器有关系吗 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信