QT维基百科

所需积分/C币:11 2018-07-10 05:56:00 3.81MB PDF

包含QT开发过程中可能遇到的400多个问题的详细解答,是做QT开发人员的好帮手。
7/10/2018 Technical FAQ-Qt Wiki 113 Is there a way to work around the fact that the dockwindow is only hidden and not closed? 114 Is there a limitation on Windows as to how many QRegions we can have? 115 How can I create a Q Dialog that has no minimize, maximize and close buttons in the titlebar? 116 How can I maintain several configurations using only one source tree 117 My underlines for accelerators don 't show up in the context menus when I press Alt, while they do for normal menus. What's wrong? 118 How to build pdb for release version of Qt? 119 Do you provide a tool for creating graphs? 120 I am unable to step into the Qt code in Visual Studio, what can the problem be? 121 Why do ActiveQt controls no longer work after an upgrade to Internet Explorer 7 122 Do you support using Qt in the Cygwin shell on Windows? 123 When untaring thc Qt package the following warning is sccn Tar.gz filc content filc @longlink with zero permission and sizc. How can this 124 The font Rendering is distorted on Windows, what could cause this problem? 125 When I compile my Qt based program I get a parse/syntax error in one of Qt's header files. What's wrong? 126 How is configuration management handled? 127 Why does a statically built Qt use the dynamic Visual Studio runtime libraries Do I need to deploy those with my application? 128 What do I need installed on my machine to begin using Qt Creator and/or the Qt SDK? 129 When I read a XPM image into a QImage, is there a way i get determine which color is the transparent one? 130 How do I find out the propcrtics of my Linux Framc Buffer? 131 How can I find out where the contents of my Mac binary package is installed? 132Ho 133 Purify complains about UMRs(Uninitialized Memory Reads)in the QGDict constructor? Is this a bug in Qt? 134 How is your double buffering implemented? 136 How can I find out what image formats my application supports? 137 Drawing dotted lines seems slow, do you have a solution for this? 138 How can I paint outside the paintevent? 139 How can I resize a Q Dock widget programatically? 140 When I build Qt I scc thc following: ***[listboxcditor h] Tracc/BPT trap and it fails to build 141 How can I add widgets to my QFilcDialog instance? 142 How can i draw text that is both filled and outlined? 143 Purify found a memory leak in qapplication xll cpp Why dont you clean up the XIM (X Input Method) structure 144 You say I can program for multiple platforms with one source tree with Qt. Do I need cross-compilers or special tools? 145 Are any benchmarking and performance measurement tools used? 146 Why can't Qt Mac for Cocoa be configured with-static? 147 unixODBC FreeTDS qGetString Data: Error while fetching data 148 Why is my text not antialiased? 149 How can a QModelindex be retrived from the model for an internal data item? 150 How to avoid subclassing all available styles when wanting to change a small aspect of a widget for all styles 151 How do i create tooltips in QHeader view? 153 How can I change the width of the popup list in my combobox? ginsidcsigner 152 How can I makc Designer look for plugins outside qtDircctorylplug 154 How can I have both text and a pixmap on a QL. abel? 155 How can I avoid a paint Event() when focus changes on Windows? 156 I have problems building an application that uses a Qt Designer plugin on windows. Can you give some advice? 157 How can I create checkable items in a QTree Widget 158 How can I avoid drawing the focus rect on my buttons? 159 When the FileMode is Directory Only in my Q FileDialog, how can I select multiple directories? 160 When converting my pixmap to a HBitMAP using to winHBITMAP(Q Pixmap: PremultipliedAlpha), they appear with a black background. Hlow can I give the icons a transparent background? 161 Hlow to compress data with Qt? 162 How can I prevent the MDI subwindows from closing when pressing CtrI+W? 163 Compiling a Qt program fails with error messages looking something like this: uIndefined reference tovt. 1 Button 164 Polling SQL connection to test connectivity 165 Q Web View does not display Chinese fonts from a Chinese web site 166 How can I use QSound with ALSA? 167 Is there a Qt way to handle UNIX/POSIX signals? 168 How can I move a window around when using Qt: Frameless window Hint? 169 Antialiasing does not work with VNC 170 On which opcrating systcms docs Qt Creator run 171 What is the difference between a static and a shared build of the Qt library? 172 Moving my application away from MFC, why would I select Qt as the toolkit to move to 173 How can I prevent the clicked signal from being emitted when i want to grab the double clicked( signal in my item view 174 How can I draw custom subcontrol for a complex control 175 How can I change the header text of my model based view 176 How can I create a dialog that can be closed programatically, but not by the user https://wiki.qt.io/techNicalFaq#howcani__canverta_qstringtochar.2aAndviceversa3f 3/150 7/10/2018 Technical FAQ-Qt Wiki 177 Is it possible for either the left or right dock areas to have full height of their side rather than having the bottom take the full width? 178 QScriptEngine: uncaught Exception Number( is returning 0 even though the error is elsewhere. What's wrong? 179 I use a Qt-plugin in a non-Qt program on the Mac. When unloading the plugin, the application's menubar is deleted. What's going wrong? 180 Is Qt compatible with. NET? 181 Does Qt Creator support embedded/mobile software development? 182 Which image formats does Qt support? 183 Why does nothing happen when I set the palette background color on a Q Push Button in some styles? 184 How can I change the size of the icon in the tab of a QToolBox? 185 Is there a way to tell QTree View to always resize itself based on the contents of all columns? 186 How can i make the scrollbar thinner 187 How can I dctcct a period of no user intcraction? 188 How can I change the color of the items in my model? 189 How can I handle events in the titlebar and change its color etc 190 How can I specify a default location and file name that will be used if a user selects print to file, but not have print to file as the default option 191 Why are the changes made in the Language tab in the International settings not respected on the mac? 192 How can I prevent the view from scrolling when the user selects an item in a view? 193 I am experiencing random crashes when running my application on Windows, what can be wrong? 194 How to prevent right mouse click sclcction for a QTrcc Widget? 195 My application's plugins won t load on some Windows machines, what can be wrong? 196 Is it possible to suppress the scaling of the background of QGraphics View? 197 How can I add version information to my application? 198 OpenGL and translucent background do not work together due to a limitation 199 The eclipse integration will not install when using Wascana Desktop Developer, what can be wrong? 200 I get errors when building my Qt/Windows project where one of my paths appears to be cut off, what can be wrong? 201 How can I clone a widget? 202 What does the syntax CONFIG(debug, debugrelease)mean? What does the lst argument specify and similarly what is the 2nd? 203 How can I add a non-resource image to a QTextDocument? 204 How can I modify the color for individual words for items in a vicw? 205 What kind of font support docs Qt for Embedded Linux offer 206 Docs Qt for Embedded Linux offer support for internationalization? 207 Is a gUI software design tool provided with Qt for Embedded Linux? 208 what is the difference between ot for embedded Linux and ot/X11 209 Can Qt for Embedded Linux display on landscape displays in portrait orientation and visa versa 210 Does Qt for Embedded Linux support any screen size? 211 How do i run Qt for Embedded linux applications without a keyboard? 212 In Qt for Embedded Linux, when I create a pen with the style Qt Dashline and a width of greater than 1, it does not appear to work in Q Painter: draw LineO. Is that a limitation of the embedded librar 213 What kind of IDEs can bc used with Qt for Embedded Linux? 214 Does the Qt for Embedded Linux graphics subsystem have the capability write the updates only to the frame buffer, or does it always update the complete frame buffer? 215 How do i enable the touch screen in Qt for Embedded Linux? 216 Can I execute a Qt for Embedded Linux application on my development PC although my X-server is running 217 Why do i receive the following error message when building makeqpf: Some of the required modules(nocrosscompiler) are not available 218 Can I develop software with Qt/Xll or Qt/windows and easily change to Qt for Embedded Linux? 219 Is an X server rcquired for Qt for Embedded Linux? 220 What is a standard way of configuring Qt/c for a desktop systcm used for devcloping Qt for Embedded Linux applications? 221 What are the graphics capabilities of Qt for Embedded Linu 222 How do I add true-type fonts when migrating my application from Qt-X1l to Qt for Embedded I inux? 223 Why do I receive the QVFb Driver Not Found message when running a Qt for Embedded Linux application? 224 Why does the compilation of Qt for Embedded Linux fail with the message: dialogs/qprintdialog cpp: 790: cups/cups. h: No such file or 225 Is there a way to get access to the virtual framebuffer inside a Q Pixmap so that we can render to this address, and then blt the result to 226 How can I add an accelerated graphics driver? 227 Why is it not allowed to copy QObjects? 228 Are there any tools for the job of converting Windows MfC dialogs? =Yes, the GUI layout of Windows dialogs can to some degree be automaticallytranslatedtotheQtequivalentusingKdab'stoolKnuthttp:/www.klaralvdalens-datakonsult.se/?page=products&sub 229 Is it possible to set a header and footer when printing a QTextDocument? 230 How do I run a Qt for Embedded Linux application without a mous 231 Can I use Qt for Embedded linux on a PXA27x development board with our own version of Linux? 232 My Qt/Windows application is running out of user handles, as the application contains a huge amount of widgets. What can be done about this 233 Parentheses show up incorrectly for English text in a right-to-left application. What is wrong 234 Is there a way to modify the window flags without causing flicker? 235 How can I change the width of the scrollbar of QWeb View 236 I get an'Error while parsing/XXX/qrc xXX.cpp, Java Heap Space. What's the problem https://wiki.qt.io/techNicalFaq#howcani__canverta_qstringtochar.2aAndviceversa3f 4/150 7/10/2018 Technical FAQ-Qt Wiki 237 Is there a way of sizing the window so that it is never overlapped by the taskbar (or it doesn't overlap the taskbar)? 238 How can i draw shadows behind windows 239 How can I display vertical text in the section of a QHeader View? 240 Why does not touching and moving work when running the imagegestures example on Windows 7? 241 How can I align the checkboxes in a view? 242 How can I dynamically switch between languages in my application using e. g a QComboBox? 243 When building Qt using Mingw i get the following error: Makefile Debug: 24691: Ms M multiple target patterns. What can be wrong? QTable view? 245 How do i make text follow the line/curve and angle of the QPainterPath? 246 When i run my Qt for Embedded Linux application I get the crror message Can't drive dcpth 32 247 I want to run my Qt for Embedded Linux application on thc QvFb, but I gct the mcssagc Can't opcn framebuffer device /dcv/fb0: driver cannot connect 248 Where do i put the plug-in library file for a touch screen driver plug-in? 249 setClickable( and setSortIndicator Showno affect the entire QHeader View, is there a way to have it affect only certain sections 250 How can i debug the Qt source files when running my application inside Visual Studio? 251 How can QTextcursor be used to select a row in a QText Table? 252 How do I apply patch files to Qt source files? 253 When dragging and dropping between 2 views, how can I perform a move without pressing Shift? 254 How can I gct rid of thc sizegrip of a window on Mac Os X? 255 How do I add a custom Info plist to my mac application with qmake? ill new Qt sDK packages be released? 257 Why is it only possible to draw in the gUI thread and how can this he worked around? 258 How can i make the text of a disabled widget look enabled 259 Why do you provide container classes as an alternative to STL in Qt? 260 How do i create a default size for the rows in a table view? 261 How can I embed e. g a Qmain window inside a QDialog 262 How do i set the width or height of the header sections in a view? 263 How can I sort the items in a QTable widget on multiple columns? 264 How can I translatc the application mcnu on thc mac 265 When popping up a context menu, how can I gct hold of the ccll where the menu popped up in my vicw? 266 Intclliscnsc does not work for my Qt application. what's wrong pler 268 When running on Linux then Eclipse crashes frequently. The problematic frame seems to be 'gtk tooltips set tip+Ox ldc. what is the problem 269 Does Qt for Embedded Linux support mouse shortcuts? 270 How can I make a Q Combo Box have multiple selection? 271 How can i draw vcrtical text? 272 I would like to detect if the expansion sign has been clicked in my QTree view. How can this be achieved? 273 How can I catch Alt-F4 in my Qt application 274 When running a Qt application on the french translation of Mac os x, about shows up instead of a propos in the application menu. what 275 How can I have a partially transparent pixmap on my toplevel window? 276 How can i do multiselection in a QCalendarwidget? 277 Is it possible to install and run Qt for Embedded Linux on a headless machine? 278 Does Qt for Embedded Linux support keyboard navigation? 279 Docs the Qt for Embedded Linux window ing system support standard window opcrations? 280 How does Qt for Embedded Linux acccss the display? 281 Why can't i debug the Qt sources when using the Qt SDK? 282 Does Qt for Embedded L inux make any assumptions about keyboard and mouse events or can we use our own drivers? 283H I change the row height of a QTree View? 284Ho I avoid the underlining of links in a QTextBrowser? 285 Is it possible with Qt for Embedded Linux to maximize a window to full screen mode without any toolbars, scrollbars, menubars and the like 286 What kind of touch scrccn touch pancl support docs Qt for Embedded Linux havc? 287 How can I add tooltips to a Q comboBox? 288 How can I translate the ok and cancel buttons when using the static QMessageBox functions? 289 Why doesn't Mac OS X respect carriage return? 290 can i embed a widget with a titlebar inside a q graphics Scene? 291 How can I detect hover events on the tabs of a Qtab widget? 292 Errors using macdeployyt caused by old version of XCode 293 I would like to know how I can build Qt on Solaris / HP-UX/AIX 294 How can I have several Qt versions installed under WINNT\system32? 295 How can I set an empty default value in QSpinBox? 296 How can I use one horizontal scrollbar to scroll several GRaphics Views? 297 How can I get webkit to load local resources referenced within html returned from a custom scheme? 298 How can I gct a QStackcd Widget to automatically switch sizc depending on the contcnt of thc pagc? 299 How can I modify the color of some of the rows in my QTable widget? https://wiki.qt.io/techNicalFaq#howcani__canverta_qstringtochar.2aAndviceversa3f 150 7/10/2018 Technical FAQ-Qt Wiki 300 llow can I get hold of a cell widget's row? 301 Loading a sql driver from a customized location 302 How can I detect in the pro file if I am compiling on a 32 bit or a 64 bit platform? 303 How can I disable autoscroll when selecting a partially displayed column in a QTree View? 304 Can Qt Assistant be modified and redistributed with my application? 305 How can I drag from e.g a QList Widget and drop in an editable QTable View? 306 How can I build 64 bit Qt on a 32 bit system 307 How can I convert a q String to char* and vice versa? 308 How can I programatically find out which rows/items are visible in my view 309 How do I create a sIn from a subdirS template? 310 When sctting a global color group on my Mac everything gocs black. What is the problcm? 311 How to minimize memory footprint in Qt for Embedded linux 312 Who implements the antialiasing? You or the platform? 313 What function can I replace the QPaintDeivce handle( function from Qt 3 in Qt 4 with? 314 Why does the pushbutton suddenly become square on the Mac when it gets down to a certain size? 315 How can I keep the pixmap background at all times for flat buttons? 316 How can I get rid of the focus rectangle for a QText Edit in the motif style? 317 Can I resize a toplevel window to zero height and zero width? 3 18 After installing a new Qt version, Designer crashes when it loads the plugins, what's wrong 319 How can I easily create a Visual Studio project from my existing pro file 320 Is there a way to tell qmake to copy files into my application bundle (c.g. private frameworks, sound files, ctc ) 321 Which UML modelers can be uscd to perform reverse cnginccring on code writtcn with QU? 322 How does Qt pick a font for the application? 323 How can I make one of my toolbars appear on the right hand side of the topdock area? 324 My custom widget appears as a grey rectangle in Designer How can I fix this 325 How can I run multiple instances of an application on Mac OSX? 326 Can I use your icons in my product 327 How can I represent rich text in an itemview 328 How can I lay out a splitter so that one widget takes 2/3 of the space and another 1/3? 329 QText Edit gets a performance problem when filling up 330 Why doesn't Opengl improve the performance of the chip demo 331 How can I get rid of the white space outside the cells of my table? 332 Do I have to delete my child widgets? 333 Is there a listing of the details of the changes in Qt 4 and what needs to be done to migrate from Qt 3.3.x to Qt 4? 334 How do I export my form without changing the generated code? 335 Is there a simple way to change the coordinate system of Q Painter so that the logical coordinates start from the lower left corner instead of 336 How can I use plugins in a statically built Qt library in Qt 4? 337 Is there a way i can get rid of the icon in the mdi child window's titlebar 338 How can I find subitems in a QTree Widget using findltems? 339 Displaying a big pixmap or image docs not work. How can this bc fixcd 340 Does QPainter support alpha channels with a PRinter? 341 What is the Qt. Visual Studio add-in? 342 How can I trigger the redraw of a single Q GiraphicslItem? 343 I have a problem installing a Qt RPM/deb/etc package 344 Is a desktop simulation tool available? I add a tool ate line? 346 How can I draw a pixmap with a background color after the pixmap is constructed from an image? 347 What is the program qtusagereporter? 348 Why is not the MySql driver loaded when running my application? 349 How can I have my widget resize when I hide a child widget in a layout? 350 How can I initialize the sizc of the ccntral widget insidc a QMain Window? 351 How can I prevent a window from becoming active when clicking on it on Windows? 352 How can i get hold of all of the visible items in my QI ist View? 353 How can I print a widge 354 How can I get debug output from my Qt applications? 355 How to deal correctly with project files that should generate a debug and release build 356 How do I make a Qt application make a 'beep'sound? 357 How can I instantiate new objects in my Qt Script code? 358 update has problems translating classes which are using a namespace, how can I solve this? 359 How can I insert a checkbox into the header of my view? 360 I would like to add somc widgets to a QMcssagc Box. How can I do it? 361 Do you have integration with Xcode? 362 Is it possiblc to change the language of Qt Assistant's GUI? 363 Does Qt provide translations for the user visible strings of the widgets? 364 We would like to use Linguist with an MFC application, without converting MfC to Qt. Is this possible? https://wiki.qt.io/techNicalFaq#howcani__canverta_qstringtochar.2aAndviceversa3f 150 7/10/2018 Technical FAQ-Qt Wiki 365 Is there a way to remove the checkbox from a QTree Widgetltem? 366" Why doesn't my keyboard work after I have done an export QWS KEYBOARD=/dev/tty? 367 How can I implement my own proxy model that is more advanced than juist sorting/filtering 368 Mediaplayer demo program pauses before file is finished on embedded platform 369 How to improve graphics performance on Xll 370 How can I get QMAKE POST LINK to work with more than one command on Windows 371 How do i remove gtmain. lib from the Qt build? 372 How can my stylesheet account for custom properties? 373 How can I set headers for a Q Column view? 374 Why do i gct an crror when trying to sct a modcl on QTable widget 375 How can I create editable hcadcrs in a Q table vicw? 376 How can the user be prevented from assigning to an undeclared variable in Qt Script? 377 Why is the fragment removed when using QDesktop Services: open Urlo to open a local file url with a fragment? 378 How can I change the timeout period for a QToolTip 379 How can I make my Qt application use wchar t instead of wchar t-? 380 How can I create a QSettings group that is sorted numerically? 381 How can i displa rd in a Qlabel 382 How can I convert a colored QPixmap into a grayscaled QPixmap? 383 Why do i get the following error: QtMain lib(qtmain win obj): fatal error LNK1103: debugging information corrupt; recompile module? 384When creating a custom library on Winows and trying to use it in my application, then why do i get the error cannot open file 令令 lIbrary,lib? 385 Why do i get the error 'libpq- fe. h: No such file or directory when trying to build the psql plugin? 386 How can I use several Qt based dlls in an external application 387 How can I create a 3rd party plugin using Qt that performs event handling? 388 What is the difference between the QPSQL7 and QPSQL drivers? 389 Why do i get linking errors issued from moc w hen building my projcct? 390 Can I use CrtMem Checkpoint, CrtMem Difference and friends to look for memory leaks in my Qt application? 391 What is needed for deploying a Phonon based application? 392 When clicking a custom item delegate, how can I ensure that its row gets selected in the QTable view? 393 Is it possible to embed one Qt process into another Qt process? 394 How to emulate keystroke FI for use in QU/MFC Migration Framework solution? 395 Is there a way to create th Lil for video files? 396 Why do my widgets have a light background in Designer when using QCleanlooks Style, but a dark background when running the app? 397 Using Q Graphicslineltem with zoom-level-independent selectable regions 398 What can cause the data passed in to QNetworkAccessManager: posto not to be posted when using a sequential QIODevice subclass? 399 How can I spccd up the pcrformance when using Qlablc Widget: sclectRow (? 400 How can I detect whether a checkbox was clicked in my QTrcc Vicw? 401 How can I replace the checkbox indicator of a QList Widgctltcm with an icon? 402 How can I make long text appear elided for a QAction? 40 How can I remove the dotted rectangle from the cell that has focus in my QTable View? 404 Is it possible to translate the native filedialogs used on windows and Mac 405 How can I set up my environment for building Qt/Qt applications with MinGW? 406 Q Widget: activate Window(- behavior under windows 407 How can I show close(x) button for each tab in a QMdiarea? 408 How can i drag items between a QToolBar and a Qlist widget? 409 When setting a back ground pixmap for a widget, it is tiled if the pixmap is smaller than the widget. Is there a way to avoid this? 410 The performance is slow and some data is lost when sending data using Q Tcp Socket at short intervals. what can be wrong 411 How can I create a onc-linc QTextEdit? 412 How can I make Assistant look for translations outside qt Version translations when deploying my application? 413 How can I make the Qssl... classes work on windows? 415 How can I display a flash file in a Q Web View and ensure that nobody can copy the file? ned engine==0, type: 1? # 414 Why do i get the following error when using QPainter: QPainter: begin: Paint device retur 416 Why does not unicode characters show up for indices in my help documentation? 418 After installing the binary Qt package for VS 2005, Qt Designer won't run, what is causing this problem,3 417 When using the Alt key as a shortcut in my application, then why don' t i get a release event when hitting Alt+ Tab? 419 QWidget is returned as the windows name on Windows. is there a way to change the windows name to make it unique? 420 Why do all Qt 4.7 applications crash when using windows 7 x64 wVS 2010? 421 Is there a way to know if a widget is currently using a stylesheet? 422 How can I add comments to a ini file when using QScttings? 423 How can I detect in the pro file if I am compiling for a 32 bit or a 64 bit platform? 424 How can I get a list of the widgets added to a layout 425 How can I exclude user input for certain widgets when processing a long operation? 426 Why does the memory keep increasing when repeatedly pasting text and calling clear( in a QL Edit? 427 Is it possible to move the Qt directory to another directory after installation? 428 How can I prevent the font from scaling up when the DPI is increased? 429 How can I control whether a widget gets a focus frame or not on Mac? https://wiki.qt.io/techNicalFaq#howcani__canverta_qstringtochar.2aAndviceversa3f 7/150 7/10/2018 Technical FAQ-Qt Wiki 430 What are the minimum hardware requirements for Qt on the desktop 431 Is there any way to compile the Qt source code and Qt applications with /clr flag? 432 Why is the warning QObject: startTimer: timers cannot be started from another thread issued when my worker thread is running 433 How can I add buttons to the tabs of a QTabBar instead of having an icon/string? 434 How can I expand all children of a specific modelindex in a QTree View? 435 How to upgrade Qt on Windows? 436 How can i have multiple rows in a QTabBar? 437 How to toggle antialiasing for SVG rendering? 438 When using jom I get an error stating the script file could not be created. How do I fix this? 439 How to allow an application to only access webpages from a ccrtain host? 440 How can I enable autoscrolling when dragging ncar the edges in a QScrollArca? 441 How can I sort a view by locale? 442 How can I add spaces between the columns in a QTable Widget? 443 How can I cross-compile Qt/Embedded with Phonon support? 444"Why do i get the error QPrint Dialog: Cannot be used on non-native printers when printing to PDF using QPrint Dialog? 445 Why don't I get a vertical scrollbar when my table has l row and only parts of the row is shown? 446 Why don' t the qdir functions accept files that begin with:? 447 How can I programatically uncheck all buttons that have auto Exclusive set to true? 448 Is there a way that Qt can open a window containing a PdF file? 449 How can I create clickable menu title? 450 Is it possiblc to modify the titlebar in a Q Dock widget? 451 What is the usage of the gtlibinfix and gtnamcspace configuration options? 452 How can I use a Qobject(subclass)in qml? 453 How can I ensure that the widgets in my touch screen application have a minimum size? 4.54 Why does qt uses o instead of NUL I in its code? 455 How can we reference dynamically created objects in qml? 456 How can I disable compilation of some code for a certain platform? should I start learning Qt? 458 How can i add tooltips to actions in menus? 459 How can I do file handling in QML? 460 How can i create a window that has no taskbar entry? 461 How can I use QML in a worker thread? 462 How can I iterate ovcr all the children in my window? 463 How to change the application title in the application menu on the mac from being the application name? 464 How can I export the contents of a qtable widget to an excel workbook? 465 How can I embed widgets in QML? 466 How can I resize the Q main Window to the size of its central widget after removing the QDock widgets? 467 How can I modify the context menu that lists dockwidgets and toolbars in QMain Window? 468 How can I create new QObjects in QML? 469 How can I add elements created in QMl to a GRaphics View 470 Is there any way to include a. qrc file in another. gre file 471 How can I pass a value or a string from QML to C++? 472 How can I crcatc multiple toplevel windows in QML? 473 How can I allow external objects to directly acccss and modify child objects in a component? 474 Why do i get metatype errors when trying to use my custom class with Q variant and properties? 475 How can I change the column width of a QTable Widget when it is being resized? 476 How can I make a window unmovable? 477 How can I remove the plus/minus sign from a QTree Widget and still be able to expand the items 478 How can I move entire rows in my QTable Widget? 479 How can I build Qt 4 with Webkit but without GStreamer? When to use QPlugin Loader vs QLibrary when splitting code into several dlls? QplugInloaderhttp:/idoc.qt.1oqt-5/qpluginloader.htmloffersanadvantageoverQlibrAryhttp:/doc.qt.io/qt-5/qlibrary.htmlbecauseitchecksthatthe plugin is linked against the same version of Qt as the application. Q Library will not do this check for you. If the library is Qt based and only used within a QtapplicationthenthisisprobablythebestapproachSeethedocumentationhttpi/doc.qt.io/qt-5/plugins-howto.htmlonhowtocreateplugins If you want to make the dlls usable with other applications, then you will need to use QLibrary and create the library as a normal c-+ librar The plugin approach is generally the easier one to set up and use as you can drop in more plugins into the application without too much of a problem Finally, in order to break up your code into several dlls, you could simply create shared libraries that you link against, see http:i/doc.qt.io/sharedlibrary,html What is the process for contributing to Qt Thecontributionguidelinesaredetailedonthiswikipage(contributiOnguidelines)http://wiki.qt.io/qt-cOntributioN-guidelines https://wiki.qt.io/techNicalFaq#howcani__canverta_qstringtochar.2aAndviceversa3f 8:150 7/10/2018 Technical FAQ-Qt Wiki (Answer updated May 2014 How can I invoke functions on Objects from another thread? There are a two basic methods for calling a function from one thread on a Qobject in another thread The most basic operation is to post an event to the object in the other thread. The event loop in the target objects thread will then deliver the event to thetargetobjectSeethedocumentationhttp://doc.qt.ioiqt-5/threads-gobject.htmlfper-thread-event-loop a The second approach is to make use of Qt's queued connections. This is also implemented in terms of the first method, and works for any target object that has an event loop running in the thread that owns it. One can either specify a queued connection by passing the parameter Qt::QueuedConnectionhttp://doc.qt.1o/qt-5/qt.htmlfconnectiontYpe-enumtotheconnectstatementoruseQt::AutoconnectioN,thedefaultwhich decidesatruntimehowtheslotshouldbecalledSeethedocumentationhttp:/idoc.gt.io!qt-5/threads-gobject.html#signals-and-slots-across-threads How can i rotate items in a Q Graphics View using the mouse? YoucanrotateitemsinaQgrapHicsViewhttp:/doc.qt.io/qt-5/qgraphicsview.htmlusingthemousebyreimplementingthemousepressevento http://doc.qt.ioiqt-5/qgraphicsitem.htmltmousePresseventandmousemoveeventohttp://doc.qt.io/qt-5/qgraphicsitem.htmlfmousemoveeventforthe items. In the mouse Press Event( you can store the position for the mouse press and use that in the mouse Evento in order to calculate the value for the rotationTherotationcanthenbesetinthemousemoveeventoeitherbycreatingaQtransFormhttp:/doc.qt.io/qt-5/qtransform.htmlandcalling settransfOrmohttp:/doc.qt.io/qt-5qgraphicsitem.html#settransformontheitemorbycallingsetrotatIonohttp:/doc.qt.ioiqt- 5/qgraphicsitem html# Rotation on the item The example below illustrates how this can be done include <otGui> iclass GraphicsEllipseIten public oGraphicsEllipseItem bli GraphicsF11 sette O rotation 0; setFlags(flags()I QGraphicsItem: ItemIsSelectable) void mousepressFvent(QGrahicssceneMousefvent event initialPos- napToScene(event->pos(); QGraphicsItem sepressEvent(event) void mouseMoveEvent(QGraphicsSceneMouseEvent *event) QPpintF pos-mapToscene(event->poso) if (pos y(> initialPos y())t ++rotation y else rotation; } ⊥f1 QTransforn xf xform rotate(rotation); setTrar s forn( xform setRotation(rotation) fendi initialPos= pos oPointF initialpos; i greal ro iclass Graphicsview: public QGraphicsview Graphicsview() QGraphicsscene scene new QGraphicsscene() setscere(scene) QRect rectangle(16, 20, 80, 60); QRect rectangle(50, 80, B0, 60) iraphicsEllipseItem "item1= new GraphicsEllipseItem(); item1- retreat(-48,-38,88,68); scene->addItem(item1)i iint main(int argc, char w*argv) OApplication app(argc, argv); Graphicsview box return arp execo The Makefile generated by the Qt Eclipse Integration has no'dist'target. Is it really missing You find dist targets in both the generated Makefile Debug and makefile Release. You can create an Eclipse Make Target with target dist and build command'make-f Makefile Release to use it from Eclipse https://wiki.qt.io/techNicalFaq#howcani__canverta_qstringtochar.2aAndviceversa3f 9/150 7/10/2018 Technical FAQ-Qt Wiki Why is Qt released under LGpL? The LGPL license will make it easier for developers to adopt Qt. By spreading the use of Qt as widely as possible and establishing a robust ecosystem How can I make the non-slot and non-property members of an object available to the script engine? BydefaultonlyaqObject'shttp://doc.qt.ioqt-5/qobject.htmlsignalsslotspropertiesandchildobjectsareavailabletoscriptswhenaQobjectispassedto the QscripT engine's newqobject( Http: /doc. qt. io/qt-5/qscriptengine. htmlnewqobject function In order to make other members of the class available to the engine you can use one of the following approaches Crcatc a binding for it yourself, for cxample by crcating your own object that calls the rclcvant function in a sl 2.uSenewFunctionhttp:/idoc.qt.ioqt-5/qscriptengine.html#newFunction 3.UsetheQtScriptGeneratorhttp://labs.trolltech.com/blogs/2008/03:10,bind-aid/thatgeneratesQtbindingsforQtScriptsee: How can I trigger the parent widget to resize when its child widget is resized programmatically? It is the job of the layout to determine the size and position of the widgets. So if you explicitly resize a child widget which is inside a layout, you need to ensurethatthenewsizeispassedcorrectlythroughthelayoutsystemThiscanbedonebyensuringthatthewidgetssizehintohttp://doc.qt.ioiqt qwidget. htmI#size Hint-prop returns the new size. The value returned by the sizeHinto will be used when the lay out calculates the new size. So after the sizehintohaschangedsimplycallupdateGeometryhttp://doc.qt.io/qt-5/qwidget.htmlfupdateGeometrythatwillnotifythelayoutsystemthatthewidget has changed and may need to change geometry analternativewaytoensurethattheparentwidgetisresizedinresponsetoitschildbeingresized,istocallsetfixedsIze()http:/doc.qt.ioqt- 5/qwidget. html#set Fixedsize on the child The following example illustrates how this can be done Include <otGui> I class Label public QLabel i Q_OBJECT ipublic ahel(const String text, cWidget parent ): Ql ahel(text, parenT) hangesize false: setAutoFillBackground(true): QPalette pal- palette; pal setColor (Palette: window, Qt: red setPalette(pal) Size sizeHintO const if(changesize)f return Qsi7e(400, 400); else return QLabel: : sizeHint(): oid setchangedsize(bool value honl crangesize class widget public QWidget { geto label Orld" this y bel *label2 new QLabel("Standard abel",this) PAlette pal labe12->palette; pal set Color(PAlette: Window, Qt: blue); ate1·> setch e(true; if(oldsi7pwi c lahe1->si7PHint().width()II https://wiki.qt.io/techNicalFaq#howcani__canverta_qstringtochar.2aAndviceversa3f 101

...展开详情
img
carlcarl0903

关注 私信 TA的资源

上传资源赚积分,得勋章
相关内容推荐