• 6851阅读
  • 4回复

类似标签页叠加的形式的问题?(有难度吗) [复制链接]

上一主题 下一主题
离线dym123_dym
 
只看楼主 倒序阅读 楼主  发表于: 2010-01-13

图1

图2


我的窗口启动起来时图1,我想让他一启动就是图2。也就是Paragraphs,Customers两个Dock窗口在一块叠加的类似标签页叠加的形式。
以下代码:
leaddocktest::leaddocktest()
 : QMainWindow()
{
 ui.setupUi(this);
 createDockWindows();
}
leaddocktest::~leaddocktest()
{
}
 void leaddocktest::createDockWindows()
 {
      viewMenu = menuBar()->addMenu(tr("&View"));
  dock = new QDockWidget(tr("Customers"), this);
  dock->setAllowedAreas(Qt::LeftDockWidgetArea| Qt::RightDockWidgetArea);
  customerList = new QListWidget(dock);
  customerList->addItems(QStringList()
   << "John Doe, Harmony Enterprises,  Ambleton"
   << " Memorabilia,Beaton"
   << "Tammy Shea,38 Sea Views, Carlton"
   << "Tim Sheen, Caraba Gifts"
   << "Sol Harvey, Chicos Coffee"
   << "Sally Hobart, Tiroli Tea");
  dock->setWidget(customerList);
  addDockWidget(Qt::RightDockWidgetArea, dock);// LeftDockWidgetArea
  viewMenu->addAction(dock->toggleViewAction());
  dock = new QDockWidget(tr("Paragraphs"), this);
  paragraphsList = new QListWidget(dock);
  paragraphsList->addItems(QStringList()
   << "Thank you for your payment which we have received today."
   << "Your order has been dispatched and should be with you "
   "within 28 days."
   << "We have dispatched those items that were in stock. The "
   "rest of your order will be dispatched once all the "
   "remaining items have arrived at our warehouse. No "
   "additional shipping charges will be made."
   << "You made a small overpayment (less than $5) which we "
   "will keep on account for you, or return at your request."
   << "You made a small underpayment (less than $1), but we have "
   "sent your order anyway. We'll add this underpayment to "
   "your next bill."
   << "Unfortunately you did not send enough money. Please remit "
   "an additional $. Your order will be dispatched as soon as "
   "the complete amount has been received."
   << "You made an overpayment (more than $5). Do you wish to "
   "buy more items, or should we return the excess to you?");
  dock->setWidget(paragraphsList);
  addDockWidget(Qt::RightDockWidgetArea, dock);
  viewMenu->addAction(dock->toggleViewAction());
  connect(customerList, SIGNAL(currentTextChanged(const QString &)),
   this, SLOT(insertCustomer(const QString &)));
  connect(paragraphsList, SIGNAL(currentTextChanged(const QString &)),
   this, SLOT(addParagraph(const QString &)));
 }
离线午小夜

只看该作者 1楼 发表于: 2010-01-13
QTabWidget Class
[操作系统版本]  Windows XP;Linux Ubuntu;Linux Fedora;
[Qt SDK版本]    4.7.0
[SDK 发布日期]  2010.05
[IDE(集成开发环境)] QtCreator
个人网页:http://hi.baidu.com/午小夜
學歷:Royal Jalidon
离线dbzhang800

只看该作者 2楼 发表于: 2010-01-13
void QMainWindow::tabifyDockWidget ( QDockWidget * first, QDockWidget * second )
离线dym123_dym
只看该作者 3楼 发表于: 2010-01-13
谢谢dbzhang800了,解决了
离线wangxiao358

只看该作者 4楼 发表于: 2010-11-13
标签怎么设置在上面呢?就想IE7 那样的?
快速回复
限100 字节
 
上一个 下一个