久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

手工編碼 GUI 與 Qt 設計器 GUI

Hand Coded GUI Versus Qt Designer GUI(手工編碼 GUI 與 Qt 設計器 GUI)
本文介紹了手工編碼 GUI 與 Qt 設計器 GUI的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我利用這些假期學習編寫 Qt 應用程序.幾個小時前,我正在閱讀有關 Qt Designer 的文章,這讓我想知道:在 Qt 中編寫真實世界應用程序的人使用什么來設計他們的 GUI?事實上,人們一般是如何設計 GUI 的?

I'm spending these holidays learning to write Qt applications. I was reading about Qt Designer just a few hours ago, which made me wonder : what do people writing real world applications in Qt use to design their GUIs? In fact, how do people design GUIs in general?

一方面,我發現手工編寫代碼在概念上比使用 Qt Designer 更簡單,但對于復雜的 GUI,Designer 可能更有意義.使用 Designer 可能可以實現大型 GUI,但隨著時間的推移,隨著復雜性的增加,它們可能變得非常難以管理(這只是我的意見).我還下載了 AmaroK 源代碼來看看那些人在做什么,并發現了許多對 addWidget() 和朋友的調用,但沒有一個由 Designer 創建的 XML 文件(除此之外:AmaroK 必須是我最喜歡的應用程序)任何平臺).

I, for one, found that writing the code by hand was conceptually simpler than using Qt Designer, although for complex GUIs Designer might make sense. Large GUIs might be possible using Designer, but with time they might become very difficult to manage as complexity increases (this is just my opinion). I also downloaded the AmaroK source code to take a peek at what those guys were doing, and found many calls to addWidget() and friends, but none of those XML files created by Designer (aside: AmaroK has to be my favorite application ever on any platform).

那么,什么是創建 GUI 的正確"方式?設計師還是代碼?在此討論中,讓我們考慮以下類型的 GUI:

What, then, is the "right" way to create a GUI? Designer or code? Let us, for this discussion, consider the following types of GUIs :

  1. 簡單的對話框,只需要輸入、顯示一些結果并退出.讓我們假設一個應用程序使用 YouTube URL 并將視頻下載到用戶的硬盤上.新手可能會開始使用的應用程序類型.
  2. 中級 GUI,例如帶有一些工具欄/菜單項的便簽編輯器.讓我們以 xPad 為例(http://getxpad.com/).我會說大多數應用程序都屬于實用程序"類別.
  3. 非常復雜的 GUI,例如 AmaroK 或 OpenOffice.當您看到它們時,您就知道它們,因為它們使您的眼睛流血.
  1. Simple dialogs that just need to take input, show some result and exit. Let's assume an application that takes a YouTube URL and downloads the video to the user's hard disk. The sort of applications a newbie is likely to start out with.
  2. Intermediate level GUIs like, say, a sticky notes editor with a few toolbar/menu items. Let's take xPad for example (http://getxpad.com/). I'd say most applications falling in the category of "utilities".
  3. Very complex GUIs, like AmaroK or OpenOffice. You know 'em when you see 'em because they make your eyes bleed.

推薦答案

我們使用 Designer 的經驗始于 Qt3.

Our experience with Designer started in Qt3.

Qt3

那時,Designer 主要用于生成代碼,然后您可以將這些代碼編譯到您的應用程序中.我們開始為此目的而使用所有生成的代碼,一旦您編輯它,您就無法再返回并重新生成它而不會丟失您的編輯.我們最終只使用生成的代碼并在此之后手工完成所有事情.

At that point, Designer was useful mainly to generate code that you would then compile into your application. We started using for that purpose but with all generated code, once you edit it, you can no longer go back and regenerate it without losing your edits. We ended up just taking the generated code and doing everything by hand henceforth.

Qt4

Qt4 在 Designer 上有顯著改進.它不再只生成代碼,但您可以動態加載您的設計器文件(在 xml 中)和 將它們動態連接到程序中正在運行的對象 -- 無需生成代碼,但是,您必須在 Designer 中命名這些項目并堅持使用這些名稱以免破壞您的代碼.

Qt4 has improved on Designer significantly. No longer does it only generate code, but you can dynamically load in your Designer files (in xml) and dynamically connect them to the running objects in your program -- no generated code however, you do have to name the items in Designer and stick with the names to not break your code.

我的評估是,它遠不如 Mac OS X 上的 Interface Builder 有用,但在這一點上,我可以看到直接在程序中使用 Designer 文件.

My assessment is that it's nowhere near as useful as Interface Builder on Mac OS X, but at this point, I could see using the Designer files directly in a program.

自從 Qt3 以來,我們就沒有再使用 Designer,但仍然使用它來進行原型設計和調試布局.

We haven't moved back to Designer since Qt3, but still use it to prototype, and debug layouts.

對于您的問題:

  1. 您可能可以使用 Qt 提供的標準對話框.QInputDialog 或者如果您繼承 QDialog,請確保使用 QButtonDialogBox以確保您的按鈕具有正確的平臺布局.

  1. You could probably get away with using the standard dialogs that Qt offers. QInputDialog or if you subclass QDialog, make sure to use QButtonDialogBox to make sure your buttons have the proper platform-layout.

您可能可以使用有限的 Designer 功能來做一些更有限的事情,例如 xPad.

You could probably do something more limited like xPad with limited Designer functionality.

我不認為你可以單獨使用 Designer 編寫類似 OpenOffice 的東西,但也許這不是重點.

I wouldn't think you could write something like OpenOffice solely with Designer but maybe that's not the point.

我會將 Designer 用作另一種工具,就像您的文本編輯器一樣.找到限制后,請嘗試使用不同的工具來解決新問題.我完全同意 Steve S 的觀點,即 Designer 的一個優點是其他不是程序員的人也可以進行布局.

I'd use Designer as another tool, just like your text editor. Once you find the limitations, try a different tool for that new problem. I totally agree with Steve S that one advantage of Designer is that someone else who's not a programmer can do the layout.

這篇關于手工編碼 GUI 與 Qt 設計器 GUI的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數據?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環: for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環?)
Reusing thread in loop c++(在循環 C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環形?)
主站蜘蛛池模板: 伊人一二三 | 黑人巨大精品欧美一区二区一视频 | 国产伊人精品 | 亚洲欧美在线观看 | 欧美精品久久久 | 国产日韩一区二区 | 国产精品毛片一区二区在线看 | 国产熟熟 | 免费av电影网站 | 免费视频一区 | 成人小视频在线观看 | japanhd美女动| 密色视频| 亚洲精品成人免费 | 青青操91 | 久久久久久久久久久爱 | 精品一区二区三区视频在线观看 | 喷潮网站| 91精品国产一区二区三区动漫 | 久久久久久国产精品免费免费狐狸 | 久久国内 | 日韩av免费看 | 欧美激情国产日韩精品一区18 | 精品国产乱码久久久久久蜜柚 | 日韩三区 | 国产成人av电影 | 午夜一区 | 99亚洲 | 夜夜摸天天操 | 一区二区三区四区在线视频 | 精品国产18久久久久久二百 | 欧美色影院 | 日本三级电影免费观看 | 日本国产一区二区 | 一区二区在线看 | 黄色成人在线网站 | 日本不卡一区二区三区 | 中文字幕精品视频在线观看 | 欧美一级久久 | 久久激情视频 | 免费国产视频 |