From fef846914f8db6dc117e206ef913d519bf6bb33e Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 29 Jul 2024 12:43:23 +0900 Subject: Rename basic widget nt* related files to equivalent tq* Signed-off-by: Michele Calgaro --- doc/classchart.doc | 30 +- doc/features.doc | 4 +- doc/html/abstractwidgets.html | 4 +- doc/html/addressbook-example.html | 148 +- doc/html/advanced.html | 6 +- doc/html/annotated.html | 30 +- doc/html/basic.html | 20 +- doc/html/buttongroups-example.html | 64 +- doc/html/canvas-chart-example.html | 10 +- doc/html/canvas-example.html | 4 +- doc/html/chart-canvasview-cpp.html | 8 +- doc/html/chart-chartform-cpp.html | 10 +- doc/html/chart-optionsform-cpp.html | 44 +- doc/html/chart-optionsform-h.html | 20 +- doc/html/chart-setdataform-cpp.html | 28 +- doc/html/chart-setdataform-h.html | 10 +- doc/html/checklists-example.html | 22 +- doc/html/classchart.html | 30 +- doc/html/classes.html | 30 +- doc/html/clientserver-example.html | 22 +- doc/html/customlayout-example.html | 24 +- doc/html/dclock-example.html | 10 +- doc/html/designer-manual-2.html | 2 +- doc/html/designer-manual-3.html | 6 +- doc/html/designer-manual-4.html | 20 +- doc/html/designer-manual-6.html | 54 +- doc/html/designer-manual-7.html | 40 +- doc/html/dialogs.html | 2 +- doc/html/dirview-example.html | 16 +- doc/html/distributor-example.html | 6 +- doc/html/drawdemo-example.html | 12 +- doc/html/eventsandfilters.html | 2 +- doc/html/extension-dialog-example.html | 4 +- doc/html/fileiconview-example.html | 38 +- doc/html/ftpclient-example.html | 8 +- doc/html/functions.html | 568 ++-- doc/html/grapher-nsplugin-example.html | 2 +- doc/html/headerfilesynonyms | 6 +- doc/html/headers.html | 24 +- doc/html/hello-example.html | 2 +- doc/html/helpsystem-example.html | 22 +- doc/html/helpviewer-example.html | 22 +- doc/html/hierarchy.html | 30 +- doc/html/httpd-example.html | 4 +- doc/html/i18n-example.html | 24 +- doc/html/i18n.html | 4 +- doc/html/index | 1056 +++---- doc/html/layout-example.html | 12 +- doc/html/layout.html | 6 +- doc/html/life-example.html | 2 +- doc/html/lineedits-example.html | 104 +- doc/html/linguist-manual-4.html | 16 +- doc/html/listbox-example.html | 52 +- doc/html/listboxcombo-example.html | 22 +- doc/html/mainclasses.html | 22 +- doc/html/mdi-example.html | 2 +- doc/html/motif-dialog-example.html | 4 +- doc/html/motif-extension.html | 4 +- doc/html/motif-walkthrough-2.html | 2 +- doc/html/motif-walkthrough-4.html | 4 +- doc/html/motif-walkthrough-5.html | 4 +- doc/html/motif-walkthrough-8.html | 4 +- doc/html/movies-example.html | 18 +- doc/html/ntqaccel.html | 6 +- doc/html/ntqapplication.html | 10 +- doc/html/ntqbutton.html | 18 +- doc/html/ntqbuttongroup.html | 4 +- doc/html/ntqcheckbox.html | 302 -- doc/html/ntqcombobox.html | 602 ---- doc/html/ntqdial.html | 352 --- doc/html/ntqdialog.html | 355 --- doc/html/ntqerrormessage.html | 4 +- doc/html/ntqframe.html | 4 +- doc/html/ntqgridview.html | 8 +- doc/html/ntqinputdialog.html | 4 +- doc/html/ntqlcdnumber.html | 332 --- doc/html/ntqlineedit.html | 728 ----- doc/html/ntqlistbox.html | 38 +- doc/html/ntqlistview.html | 48 +- doc/html/ntqmessagebox.html | 14 +- doc/html/ntqprogressdialog.html | 10 +- doc/html/ntqpushbutton.html | 470 ---- doc/html/ntqradiobutton.html | 278 -- doc/html/ntqrangecontrol.html | 14 +- doc/html/ntqscrollbar.html | 382 --- doc/html/ntqscrollview.html | 930 ------- doc/html/ntqslider.html | 368 --- doc/html/ntqspinbox.html | 561 ---- doc/html/ntqt.html | 4 +- doc/html/ntqtabdialog.html | 24 +- doc/html/ntqtable.html | 36 +- doc/html/ntqvalidator.html | 6 +- doc/html/ntqwizard.html | 18 +- doc/html/pictures.html | 10 +- doc/html/popup-example.html | 22 +- doc/html/porting.html | 14 +- doc/html/process-example.html | 8 +- doc/html/progressbar-example.html | 24 +- doc/html/properties.html | 2 +- doc/html/propertydocs | 766 ++--- doc/html/propertyindex | 182 +- doc/html/qcheckbox-h.html | 141 - doc/html/qcheckbox-members.html | 371 --- doc/html/qchecklistitem-members.html | 120 - doc/html/qchecklistitem.html | 256 -- doc/html/qchecktableitem-members.html | 75 - doc/html/qchecktableitem.html | 113 - doc/html/qcombo1-m.png | Bin 229 -> 0 bytes doc/html/qcombo1-w.png | Bin 271 -> 0 bytes doc/html/qcombo2-m.png | Bin 268 -> 0 bytes doc/html/qcombo3-m.png | Bin 250 -> 0 bytes doc/html/qcombobox-h.html | 251 -- doc/html/qcombobox-members.html | 377 --- doc/html/qcombotableitem-members.html | 81 - doc/html/qcombotableitem.html | 179 -- doc/html/qdial-h.html | 198 -- doc/html/qdial-m.png | Bin 453 -> 0 bytes doc/html/qdial-members.html | 375 --- doc/html/qdial-w.png | Bin 484 -> 0 bytes doc/html/qdialog-h.html | 186 -- doc/html/qdialog-members.html | 351 --- doc/html/qerrormessage-h.html | 2 +- doc/html/qerrormessage-members.html | 32 +- doc/html/qfd-example.html | 14 +- doc/html/qgridlayout.html | 2 +- doc/html/qgridview-h.html | 2 +- doc/html/qgridview-members.html | 140 +- doc/html/qinputdialog-h.html | 4 +- doc/html/qinputdialog-members.html | 32 +- doc/html/qintvalidator.html | 4 +- doc/html/qlcdnum-m.png | Bin 254 -> 0 bytes doc/html/qlcdnum-w.png | Bin 254 -> 0 bytes doc/html/qlcdnumber-h.html | 191 -- doc/html/qlcdnumber-members.html | 373 --- doc/html/qlined-m.png | Bin 192 -> 0 bytes doc/html/qlined-w.png | Bin 188 -> 0 bytes doc/html/qlineedit-h.html | 262 -- doc/html/qlineedit-members.html | 414 --- doc/html/qlistbox-h.html | 2 +- doc/html/qlistbox-members.html | 140 +- doc/html/qlistview-h.html | 2 +- doc/html/qlistview-members.html | 126 +- doc/html/qlistviewitem.html | 14 +- doc/html/qmacstyle.html | 4 +- doc/html/qmag-example.html | 40 +- doc/html/qmake-manual-7.html | 6 +- doc/html/qmessagebox-h.html | 2 +- doc/html/qmessagebox-members.html | 32 +- doc/html/qmotifdialog-h.html | 2 +- doc/html/qmotifdialog-members.html | 32 +- doc/html/qmotifdialog.html | 18 +- doc/html/qmultilineedit-members.html | 140 +- doc/html/qprogressdialog-members.html | 32 +- doc/html/qpushbt-m.png | Bin 223 -> 0 bytes doc/html/qpushbt-w.png | Bin 250 -> 0 bytes doc/html/qpushbutton-h.html | 194 -- doc/html/qpushbutton-members.html | 379 --- doc/html/qradiobt-m.png | Bin 391 -> 0 bytes doc/html/qradiobt-w.png | Bin 340 -> 0 bytes doc/html/qradiobutton-h.html | 136 - doc/html/qradiobutton-members.html | 368 --- doc/html/qscrollbar-h.html | 242 -- doc/html/qscrollbar-members.html | 376 --- doc/html/qscrollview-cl.png | Bin 9756 -> 0 bytes doc/html/qscrollview-h.html | 314 --- doc/html/qscrollview-m.png | Bin 420 -> 0 bytes doc/html/qscrollview-members.html | 423 --- doc/html/qscrollview-vp.png | Bin 6980 -> 0 bytes doc/html/qscrollview-vp2.png | Bin 8551 -> 0 bytes doc/html/qscrollview-w.png | Bin 411 -> 0 bytes doc/html/qslider-h.html | 244 -- doc/html/qslider-m.png | Bin 193 -> 0 bytes doc/html/qslider-members.html | 377 --- doc/html/qslider-w.png | Bin 226 -> 0 bytes doc/html/qspinbox-h.html | 217 -- doc/html/qspinbox-m.png | Bin 244 -> 0 bytes doc/html/qspinbox-members.html | 387 --- doc/html/qspinbox-w.png | Bin 236 -> 0 bytes doc/html/qt.dcf | 1110 ++++---- doc/html/qtabdialog-h.html | 2 +- doc/html/qtabdialog-members.html | 32 +- doc/html/qtable-h.html | 2 +- doc/html/qtable-members.html | 130 +- doc/html/qtableitem.html | 40 +- doc/html/qwizard-h.html | 2 +- doc/html/qwizard-members.html | 32 +- doc/html/rangecontrols-example.html | 44 +- doc/html/regexptester-example.html | 72 +- doc/html/richtext-example.html | 10 +- doc/html/rot-example.html | 4 +- doc/html/scribble-example.html | 10 +- doc/html/scrollview-example.html | 52 +- doc/html/showimg-example.html | 4 +- doc/html/signalsandslots.html | 12 +- doc/html/simple-font-demo-example.html | 14 +- doc/html/small-table-example-example.html | 6 +- doc/html/sql-overview-custom1-main-cpp.html | 12 +- doc/html/sql-overview-custom1-main-h.html | 10 +- doc/html/sql-overview-form1-main-cpp.html | 10 +- doc/html/sql-overview-form2-main-h.html | 8 +- doc/html/sql-overview-table3-main-cpp.html | 4 +- doc/html/sql-overview-table3-main-h.html | 4 +- doc/html/sql-overview-table4-main-cpp.html | 4 +- doc/html/sql-overview-table4-main-h.html | 4 +- doc/html/sql.html | 44 +- doc/html/statistics-example.html | 8 +- doc/html/t10-lcdrange-cpp.html | 20 +- doc/html/t10-lcdrange-h.html | 2 +- doc/html/t10-main-cpp.html | 6 +- doc/html/t11-lcdrange-cpp.html | 20 +- doc/html/t11-lcdrange-h.html | 2 +- doc/html/t11-main-cpp.html | 8 +- doc/html/t12-lcdrange-cpp.html | 20 +- doc/html/t12-lcdrange-h.html | 2 +- doc/html/t12-main-cpp.html | 8 +- doc/html/t13-gamebrd-cpp.html | 26 +- doc/html/t13-gamebrd-h.html | 4 +- doc/html/t13-lcdrange-cpp.html | 20 +- doc/html/t13-lcdrange-h.html | 2 +- doc/html/t14-gamebrd-cpp.html | 26 +- doc/html/t14-gamebrd-h.html | 4 +- doc/html/t14-lcdrange-cpp.html | 20 +- doc/html/t14-lcdrange-h.html | 2 +- doc/html/t7-lcdrange-cpp.html | 20 +- doc/html/t7-lcdrange-h.html | 2 +- doc/html/t7-main-cpp.html | 6 +- doc/html/t8-lcdrange-cpp.html | 20 +- doc/html/t8-lcdrange-h.html | 2 +- doc/html/t8-main-cpp.html | 6 +- doc/html/t9-lcdrange-cpp.html | 20 +- doc/html/t9-lcdrange-h.html | 2 +- doc/html/t9-main-cpp.html | 6 +- doc/html/tabdialog-example.html | 22 +- doc/html/table-small-table-demo-main-cpp.html | 6 +- doc/html/table-statistics-statistics-cpp.html | 4 +- doc/html/table.html | 4 +- doc/html/themes-example.html | 72 +- doc/html/threads.html | 2 +- doc/html/tictac-example.html | 28 +- doc/html/titleindex | 86 +- doc/html/toplevel-example.html | 4 +- doc/html/tqasciidict.html | 4 +- doc/html/tqasciidictiterator.html | 6 +- doc/html/tqcanvas-h.html | 2 +- doc/html/tqcanvas.html | 2 +- doc/html/tqcanvasview-members.html | 138 +- doc/html/tqcanvasview.html | 8 +- doc/html/tqcheckbox-h.html | 141 + doc/html/tqcheckbox-members.html | 371 +++ doc/html/tqcheckbox.html | 302 ++ doc/html/tqchecklistitem-members.html | 120 + doc/html/tqchecklistitem.html | 256 ++ doc/html/tqchecktableitem-members.html | 75 + doc/html/tqchecktableitem.html | 113 + doc/html/tqcolordialog-h.html | 2 +- doc/html/tqcolordialog-members.html | 32 +- doc/html/tqcolordialog.html | 2 +- doc/html/tqcombo1-m.png | Bin 0 -> 229 bytes doc/html/tqcombo1-w.png | Bin 0 -> 271 bytes doc/html/tqcombo2-m.png | Bin 0 -> 268 bytes doc/html/tqcombo3-m.png | Bin 0 -> 250 bytes doc/html/tqcombobox-h.html | 251 ++ doc/html/tqcombobox-members.html | 377 +++ doc/html/tqcombobox.html | 602 ++++ doc/html/tqcombotableitem-members.html | 81 + doc/html/tqcombotableitem.html | 179 ++ doc/html/tqdatatable-members.html | 130 +- doc/html/tqdial-h.html | 198 ++ doc/html/tqdial-m.png | Bin 0 -> 453 bytes doc/html/tqdial-members.html | 375 +++ doc/html/tqdial-w.png | Bin 0 -> 484 bytes doc/html/tqdial.html | 352 +++ doc/html/tqdialog-h.html | 186 ++ doc/html/tqdialog-members.html | 351 +++ doc/html/tqdialog.html | 355 +++ doc/html/tqdict.html | 4 +- doc/html/tqdictiterator.html | 6 +- doc/html/tqdir-example.html | 30 +- doc/html/tqeditorfactory.html | 4 +- doc/html/tqfiledialog-h.html | 2 +- doc/html/tqfiledialog-members.html | 32 +- doc/html/tqfiledialog.html | 22 +- doc/html/tqfontdialog-h.html | 2 +- doc/html/tqfontdialog-members.html | 32 +- doc/html/tqfontdialog.html | 2 +- doc/html/tqiconview-h.html | 2 +- doc/html/tqiconview-members.html | 140 +- doc/html/tqiconview.html | 6 +- doc/html/tqintdict.html | 2 +- doc/html/tqintdictiterator.html | 2 +- doc/html/tqlabel.html | 10 +- doc/html/tqlcdnum-m.png | Bin 0 -> 254 bytes doc/html/tqlcdnum-w.png | Bin 0 -> 254 bytes doc/html/tqlcdnumber-h.html | 191 ++ doc/html/tqlcdnumber-members.html | 373 +++ doc/html/tqlcdnumber.html | 332 +++ doc/html/tqlined-m.png | Bin 0 -> 192 bytes doc/html/tqlined-w.png | Bin 0 -> 188 bytes doc/html/tqlineedit-h.html | 262 ++ doc/html/tqlineedit-members.html | 414 +++ doc/html/tqlineedit.html | 728 +++++ doc/html/tqmainwindow.html | 2 +- doc/html/tqmenubar.html | 2 +- doc/html/tqmenudata.html | 2 +- doc/html/tqobject.html | 18 +- doc/html/tqpixmapcache.html | 2 +- doc/html/tqpopupmenu.html | 2 +- doc/html/tqptrdict.html | 18 +- doc/html/tqptrdictiterator.html | 16 +- doc/html/tqpushbt-m.png | Bin 0 -> 223 bytes doc/html/tqpushbt-w.png | Bin 0 -> 250 bytes doc/html/tqpushbutton-h.html | 194 ++ doc/html/tqpushbutton-members.html | 379 +++ doc/html/tqpushbutton.html | 470 ++++ doc/html/tqradiobt-m.png | Bin 0 -> 391 bytes doc/html/tqradiobt-w.png | Bin 0 -> 340 bytes doc/html/tqradiobutton-h.html | 136 + doc/html/tqradiobutton-members.html | 368 +++ doc/html/tqradiobutton.html | 278 ++ doc/html/tqregexpvalidator.html | 4 +- doc/html/tqscrollbar-h.html | 242 ++ doc/html/tqscrollbar-members.html | 376 +++ doc/html/tqscrollbar.html | 382 +++ doc/html/tqscrollview-cl.png | Bin 0 -> 9756 bytes doc/html/tqscrollview-h.html | 314 +++ doc/html/tqscrollview-m.png | Bin 0 -> 420 bytes doc/html/tqscrollview-members.html | 423 +++ doc/html/tqscrollview-vp.png | Bin 0 -> 6980 bytes doc/html/tqscrollview-vp2.png | Bin 0 -> 8551 bytes doc/html/tqscrollview-w.png | Bin 0 -> 411 bytes doc/html/tqscrollview.html | 930 +++++++ doc/html/tqslider-h.html | 244 ++ doc/html/tqslider-m.png | Bin 0 -> 193 bytes doc/html/tqslider-members.html | 377 +++ doc/html/tqslider-w.png | Bin 0 -> 226 bytes doc/html/tqslider.html | 368 +++ doc/html/tqspinbox-h.html | 217 ++ doc/html/tqspinbox-m.png | Bin 0 -> 244 bytes doc/html/tqspinbox-members.html | 387 +++ doc/html/tqspinbox-w.png | Bin 0 -> 236 bytes doc/html/tqspinbox.html | 561 ++++ doc/html/tqsqleditorfactory.html | 4 +- doc/html/tqsqlform.html | 2 +- doc/html/tqsqlpropertymap.html | 22 +- doc/html/tqstyle.html | 76 +- doc/html/tqstyleoption.html | 6 +- doc/html/tqtextbrowser-members.html | 140 +- doc/html/tqtextedit-h.html | 2 +- doc/html/tqtextedit-members.html | 140 +- doc/html/tqtextedit.html | 4 +- doc/html/tqtextview-members.html | 140 +- doc/html/tqtoolbar.html | 2 +- doc/html/tqtoolbutton.html | 4 +- doc/html/tqwidget.html | 48 +- doc/html/tutorial1-01.html | 10 +- doc/html/tutorial1-02.html | 8 +- doc/html/tutorial1-03.html | 8 +- doc/html/tutorial1-04.html | 8 +- doc/html/tutorial1-05.html | 40 +- doc/html/tutorial1-06.html | 26 +- doc/html/tutorial1-07.html | 18 +- doc/html/tutorial1-08.html | 4 +- doc/html/tutorial1-10.html | 2 +- doc/html/tutorial1-11.html | 2 +- doc/html/tutorial1-12.html | 12 +- doc/html/tutorial1-13.html | 24 +- doc/html/tutorial2-05.html | 4 +- doc/html/tutorial2-06.html | 8 +- doc/html/tutorial2-08.html | 42 +- doc/html/tutorial2-09.html | 48 +- doc/html/whatsthis | 32 +- doc/html/wizard-example.html | 56 +- doc/html/wizard-wizard-cpp.html | 52 +- doc/html/wizard-wizard-h.html | 2 +- doc/html/xform-example.html | 112 +- doc/i18n.doc | 4 +- doc/layout.doc | 6 +- doc/man/man3/tqaccel.3qt | 4 +- doc/man/man3/tqapplication.3qt | 6 +- doc/man/man3/tqasciidict.3qt | 8 +- doc/man/man3/tqasciidictiterator.3qt | 10 +- doc/man/man3/tqbutton.3qt | 12 +- doc/man/man3/tqbuttongroup.3qt | 2 +- doc/man/man3/tqcanvas.3qt | 2 +- doc/man/man3/tqcanvasview.3qt | 6 +- doc/man/man3/tqcheckbox.3qt | 36 +- doc/man/man3/tqchecklistitem.3qt | 100 +- doc/man/man3/tqchecktableitem.3qt | 30 +- doc/man/man3/tqcolordialog.3qt | 2 +- doc/man/man3/tqcombobox.3qt | 162 +- doc/man/man3/tqcombotableitem.3qt | 56 +- doc/man/man3/tqdial.3qt | 96 +- doc/man/man3/tqdialog.3qt | 70 +- doc/man/man3/tqdict.3qt | 8 +- doc/man/man3/tqdictiterator.3qt | 10 +- doc/man/man3/tqeditorfactory.3qt | 2 +- doc/man/man3/tqerrormessage.3qt | 4 +- doc/man/man3/tqfiledialog.3qt | 12 +- doc/man/man3/tqfontdialog.3qt | 2 +- doc/man/man3/tqframe.3qt | 4 +- doc/man/man3/tqgridlayout.3qt | 2 +- doc/man/man3/tqgridview.3qt | 6 +- doc/man/man3/tqiconview.3qt | 2 +- doc/man/man3/tqinputdialog.3qt | 10 +- doc/man/man3/tqintdict.3qt | 6 +- doc/man/man3/tqintdictiterator.3qt | 6 +- doc/man/man3/tqintvalidator.3qt | 2 +- doc/man/man3/tqlabel.3qt | 10 +- doc/man/man3/tqlcdnumber.3qt | 98 +- doc/man/man3/tqlineedit.3qt | 170 +- doc/man/man3/tqlistbox.3qt | 4 +- doc/man/man3/tqlistview.3qt | 22 +- doc/man/man3/tqlistviewitem.3qt | 14 +- doc/man/man3/tqmacstyle.3qt | 4 +- doc/man/man3/tqmainwindow.3qt | 2 +- doc/man/man3/tqmenubar.3qt | 2 +- doc/man/man3/tqmenudata.3qt | 2 +- doc/man/man3/tqmessagebox.3qt | 10 +- doc/man/man3/tqmotifdialog.3qt | 20 +- doc/man/man3/tqmotifwidget.3qt | 2 +- doc/man/man3/tqobject.3qt | 14 +- doc/man/man3/tqpixmapcache.3qt | 2 +- doc/man/man3/tqpopupmenu.3qt | 2 +- doc/man/man3/tqprogressdialog.3qt | 12 +- doc/man/man3/tqptrdict.3qt | 6 +- doc/man/man3/tqptrdictiterator.3qt | 8 +- doc/man/man3/tqpushbutton.3qt | 64 +- doc/man/man3/tqradiobutton.3qt | 28 +- doc/man/man3/tqrangecontrol.3qt | 12 +- doc/man/man3/tqregexpvalidator.3qt | 2 +- doc/man/man3/tqscrollbar.3qt | 94 +- doc/man/man3/tqscrollview.3qt | 276 +- doc/man/man3/tqslider.3qt | 90 +- doc/man/man3/tqspinbox.3qt | 142 +- doc/man/man3/tqsqleditorfactory.3qt | 2 +- doc/man/man3/tqsqlform.3qt | 2 +- doc/man/man3/tqsqlpropertymap.3qt | 4 +- doc/man/man3/tqstyle.3qt | 54 +- doc/man/man3/tqstyleoption.3qt | 10 +- doc/man/man3/tqt.3qt | 4 +- doc/man/man3/tqtabdialog.3qt | 10 +- doc/man/man3/tqtable.3qt | 34 +- doc/man/man3/tqtableitem.3qt | 42 +- doc/man/man3/tqtextedit.3qt | 4 +- doc/man/man3/tqtoolbar.3qt | 4 +- doc/man/man3/tqtoolbutton.3qt | 2 +- doc/man/man3/tqvalidator.3qt | 4 +- doc/man/man3/tqwidget.3qt | 42 +- doc/man/man3/tqwizard.3qt | 28 +- doc/object.doc | 2 +- doc/pictures.doc | 16 +- doc/porting3.doc | 34 +- doc/signalsandslots.doc | 18 +- doc/sql.doc | 18 +- doc/table.doc | 4 +- doc/threads.doc | 2 +- doc/tqasciidict.doc | 18 +- doc/tqdict.doc | 18 +- doc/tqintdict.doc | 12 +- doc/tqptrdict.doc | 14 +- doc/tutorial.doc | 66 +- doc/tutorial2.doc | 26 +- examples/README | 24 +- examples/addressbook/centralwidget.cpp | 6 +- examples/buttongroups/buttongroups.cpp | 6 +- examples/chart/chartform.cpp | 6 +- examples/chart/optionsform.cpp | 8 +- examples/chart/optionsform.h | 2 +- examples/chart/setdataform.cpp | 4 +- examples/chart/setdataform.h | 2 +- examples/checklists/checklists.cpp | 2 +- examples/customlayout/main.cpp | 2 +- examples/dclock/dclock.h | 2 +- examples/demo/display.cpp | 8 +- examples/demo/graph.cpp | 4 +- examples/demo/opengl/glworkspace.cpp | 4 +- examples/demo/qasteroids/toplevel.cpp | 4 +- examples/demo/sql/sqlex.ui.h | 6 +- examples/demo/textdrawing/example.html | 10 +- examples/demo/textdrawing/helpwindow.cpp | 4 +- examples/demo/textdrawing/textedit.cpp | 4 +- examples/distributor/distributor.ui.h | 4 +- examples/dragdrop/main.cpp | 2 +- examples/drawdemo/drawdemo.cpp | 4 +- examples/extension/mainform.ui.h | 4 +- examples/fileiconview/mainwindow.cpp | 2 +- examples/fonts/simple-tqfont-demo/viewer.cpp | 2 +- examples/hello/hello.cpp | 2 +- examples/helpdemo/helpdemo.cpp | 6 +- examples/helpsystem/helpsystem.doc | 2 +- examples/helpsystem/whatsthis.cpp | 6 +- examples/helpviewer/helpwindow.cpp | 4 +- examples/i18n/main.cpp | 4 +- examples/i18n/mywidget.cpp | 4 +- examples/layout/layout.cpp | 4 +- examples/life/life.cpp | 2 +- examples/life/lifedlg.cpp | 6 +- examples/lineedits/lineedits.cpp | 4 +- examples/listbox/listbox.cpp | 8 +- examples/listboxcombo/listboxcombo.cpp | 4 +- examples/mdi/application.cpp | 2 +- examples/movies/main.cpp | 2 +- examples/network/clientserver/client/client.cpp | 4 +- examples/network/clientserver/server/server.cpp | 2 +- examples/network/ftpclient/ftpmainwindow.ui.h | 4 +- examples/network/httpd/httpd.cpp | 2 +- .../network/infoprotocol/infoclient/client.cpp | 4 +- .../network/infoprotocol/infoserver/server.cpp | 2 +- .../network/infoprotocol/infourlclient/client.cpp | 2 +- examples/network/mail/composer.cpp | 4 +- examples/network/networkprotocol/view.cpp | 2 +- examples/network/remotecontrol/remotectrlimpl.cpp | 4 +- examples/opengl/box/globjwin.cpp | 4 +- examples/opengl/glpixmap/globjwin.cpp | 4 +- examples/opengl/overlay_x11/README | 2 +- examples/opengl/overlay_x11/overlay_x11.doc | 2 +- examples/opengl/sharedbox/globjwin.cpp | 4 +- examples/opengl/texture/globjwin.cpp | 4 +- examples/popup/popup.h | 4 +- examples/process/process.cpp | 2 +- examples/progressbar/progressbar.cpp | 4 +- examples/qfd/fontdisplayer.cpp | 6 +- examples/qfd/qfd.cpp | 2 +- examples/qmag/qmag.cpp | 4 +- examples/rangecontrols/rangecontrols.cpp | 8 +- examples/regexptester/regexptester.cpp | 6 +- examples/regexptester/regexptester.h | 2 +- examples/richtext/richtext.cpp | 2 +- examples/rot13/rot13.cpp | 2 +- examples/scribble/scribble.cpp | 2 +- examples/scrollview/README | 6 +- examples/scrollview/scrollview.cpp | 4 +- examples/showimg/imagetexteditor.cpp | 6 +- examples/showimg/imagetexteditor.h | 2 +- examples/sql/overview/custom1/main.h | 6 +- examples/sql/overview/form1/main.cpp | 4 +- examples/sql/overview/form2/main.h | 6 +- examples/sql/overview/table3/main.h | 2 +- examples/sql/overview/table4/main.h | 2 +- examples/tabdialog/tabdialog.cpp | 4 +- examples/table/statistics/statistics.cpp | 2 +- examples/table/statistics/statistics.h | 2 +- examples/tablet/scribble.cpp | 2 +- examples/tetrix/README | 2 +- examples/tetrix/qtetrix.h | 4 +- examples/textedit/textedit.cpp | 4 +- examples/themes/metal.cpp | 8 +- examples/themes/wood.cpp | 6 +- examples/thread/prodcons/prodcons.cpp | 4 +- examples/thread/semaphores/main.cpp | 2 +- examples/tictac/tictac.cpp | 4 +- examples/tictac/tictac.h | 2 +- examples/toplevel/toplevel.doc | 2 +- examples/tqdir/tqdir.cpp | 4 +- examples/tqdir/tqdir.h | 2 +- examples/widgets/widgets.cpp | 16 +- examples/wizard/wizard.cpp | 4 +- examples/xform/xform.cpp | 14 +- extensions/nsplugin/examples/grapher/grapher.cpp | 2 +- include/ntqcheckbox.h | 1 - include/ntqcombobox.h | 1 - include/ntqdial.h | 1 - include/ntqdialog.h | 1 - include/ntqlcdnumber.h | 1 - include/ntqlineedit.h | 1 - include/ntqpushbutton.h | 1 - include/ntqradiobutton.h | 1 - include/ntqscrollbar.h | 1 - include/ntqscrollview.h | 1 - include/ntqslider.h | 1 - include/ntqspinbox.h | 1 - include/private/qdialogbuttons_p.h | 1 - include/private/tqdialogbuttons_p.h | 1 + include/tqcheckbox.h | 1 + include/tqcombobox.h | 1 + include/tqdial.h | 1 + include/tqdialog.h | 1 + include/tqlcdnumber.h | 1 + include/tqlineedit.h | 1 + include/tqpushbutton.h | 1 + include/tqradiobutton.h | 1 + include/tqscrollbar.h | 1 + include/tqscrollview.h | 1 + include/tqslider.h | 1 + include/tqspinbox.h | 1 + .../src/accessible/widgets/qaccessiblewidget.cpp | 20 +- qmake/book/qmake-pch.leaf | 2 +- qmake/examples/precompile/main.cpp | 2 +- qmake/examples/precompile/stable.h | 2 +- qmake/examples/tutorial/hello.h | 2 +- src/canvas/tqcanvas.h | 2 +- src/dialogs/ntqdialog.h | 141 - src/dialogs/ntqerrormessage.h | 2 +- src/dialogs/ntqinputdialog.h | 4 +- src/dialogs/ntqmessagebox.h | 2 +- src/dialogs/ntqprintdialog.h | 2 +- src/dialogs/ntqprogressdialog.h | 2 +- src/dialogs/ntqtabdialog.h | 2 +- src/dialogs/ntqwizard.h | 2 +- src/dialogs/qdialog.cpp | 1180 -------- src/dialogs/qerrormessage.cpp | 4 +- src/dialogs/qinputdialog.cpp | 8 +- src/dialogs/qmessagebox.cpp | 2 +- src/dialogs/qprintdialog.cpp | 10 +- src/dialogs/qprogressdialog.cpp | 2 +- src/dialogs/qt_dialogs.pri | 4 +- src/dialogs/qtabdialog.cpp | 2 +- src/dialogs/qwizard.cpp | 2 +- src/dialogs/tqcolordialog.cpp | 4 +- src/dialogs/tqcolordialog.h | 2 +- src/dialogs/tqdialog.cpp | 1180 ++++++++ src/dialogs/tqdialog.h | 141 + src/dialogs/tqfiledialog.cpp | 8 +- src/dialogs/tqfiledialog.h | 2 +- src/dialogs/tqfontdialog.cpp | 8 +- src/dialogs/tqfontdialog.h | 2 +- src/kernel/ntqt.h | 26 +- src/kernel/tqstyle.cpp | 2 +- src/kernel/tqwidget_x11.cpp | 2 +- src/libqt.map | 2 +- src/sql/tqeditorfactory.cpp | 6 +- src/sql/tqsqleditorfactory.cpp | 6 +- src/styles/qcommonstyle.cpp | 18 +- src/styles/qinterlacestyle.cpp | 4 +- src/styles/qmotifplusstyle.cpp | 16 +- src/styles/qmotifstyle.cpp | 8 +- src/styles/qplatinumstyle.cpp | 8 +- src/styles/qsgistyle.cpp | 10 +- src/styles/qwindowsstyle.cpp | 8 +- src/table/ntqtable.h | 2 +- src/table/qtable.cpp | 8 +- src/tools/qfeatures.txt | 4 +- src/widgets/ntqcheckbox.h | 96 - src/widgets/ntqcombobox.h | 206 -- src/widgets/ntqdial.h | 153 - src/widgets/ntqgridview.h | 2 +- src/widgets/ntqlcdnumber.h | 146 - src/widgets/ntqlineedit.h | 218 -- src/widgets/ntqlistbox.h | 2 +- src/widgets/ntqlistview.h | 2 +- src/widgets/ntqpushbutton.h | 149 - src/widgets/ntqradiobutton.h | 91 - src/widgets/ntqscrollbar.h | 197 -- src/widgets/ntqscrollview.h | 269 -- src/widgets/ntqslider.h | 199 -- src/widgets/ntqspinbox.h | 172 -- src/widgets/qbutton.cpp | 4 +- src/widgets/qbuttongroup.cpp | 2 +- src/widgets/qcheckbox.cpp | 364 --- src/widgets/qcombobox.cpp | 2338 ---------------- src/widgets/qdial.cpp | 976 ------- src/widgets/qdialogbuttons.cpp | 462 ---- src/widgets/qdialogbuttons_p.h | 119 - src/widgets/qeffects.cpp | 2 +- src/widgets/qeffects_p.h | 2 +- src/widgets/qgroupbox.cpp | 4 +- src/widgets/qlcdnumber.cpp | 1170 -------- src/widgets/qlineedit.cpp | 2922 -------------------- src/widgets/qlistview.cpp | 2 +- src/widgets/qmultilineedit.cpp | 2 +- src/widgets/qpushbutton.cpp | 762 ----- src/widgets/qradiobutton.cpp | 358 --- src/widgets/qscrollbar.cpp | 1074 ------- src/widgets/qscrollview.cpp | 2847 ------------------- src/widgets/qslider.cpp | 924 ------- src/widgets/qspinbox.cpp | 1116 -------- src/widgets/qspinwidget.cpp | 467 ---- src/widgets/qt_widgets.pri | 50 +- src/widgets/tqaction.cpp | 2 +- src/widgets/tqcheckbox.cpp | 364 +++ src/widgets/tqcheckbox.h | 96 + src/widgets/tqcombobox.cpp | 2338 ++++++++++++++++ src/widgets/tqcombobox.h | 206 ++ src/widgets/tqdial.cpp | 976 +++++++ src/widgets/tqdial.h | 153 + src/widgets/tqdialogbuttons.cpp | 462 ++++ src/widgets/tqdialogbuttons_p.h | 119 + src/widgets/tqiconview.h | 2 +- src/widgets/tqlcdnumber.cpp | 1170 ++++++++ src/widgets/tqlcdnumber.h | 146 + src/widgets/tqlineedit.cpp | 2922 ++++++++++++++++++++ src/widgets/tqlineedit.h | 218 ++ src/widgets/tqmainwindow.cpp | 2 +- src/widgets/tqpushbutton.cpp | 762 +++++ src/widgets/tqpushbutton.h | 149 + src/widgets/tqradiobutton.cpp | 358 +++ src/widgets/tqradiobutton.h | 91 + src/widgets/tqscrollbar.cpp | 1074 +++++++ src/widgets/tqscrollbar.h | 197 ++ src/widgets/tqscrollview.cpp | 2847 +++++++++++++++++++ src/widgets/tqscrollview.h | 269 ++ src/widgets/tqslider.cpp | 924 +++++++ src/widgets/tqslider.h | 199 ++ src/widgets/tqspinbox.cpp | 1116 ++++++++ src/widgets/tqspinbox.h | 172 ++ src/widgets/tqspinwidget.cpp | 467 ++++ src/widgets/tqtextedit.h | 2 +- src/widgets/tqtoolbar.cpp | 2 +- src/widgets/tqtoolbox.cpp | 2 +- src/workspace/tqworkspace.cpp | 2 +- tools/assistant/helpdialogimpl.cpp | 4 +- tools/assistant/mainwindow.ui | 6 +- tools/assistant/settingsdialogimpl.cpp | 6 +- tools/assistant/topicchooserimpl.cpp | 2 +- tools/designer/designer/actioneditorimpl.cpp | 6 +- tools/designer/designer/connectionitems.cpp | 4 +- tools/designer/designer/customwidgeteditorimpl.cpp | 10 +- tools/designer/designer/dbconnectionimpl.cpp | 6 +- tools/designer/designer/dbconnectionsimpl.cpp | 8 +- tools/designer/designer/designer_pch.h | 12 +- tools/designer/designer/editfunctionsimpl.cpp | 8 +- tools/designer/designer/finddialog.ui | 2 +- tools/designer/designer/formsettingsimpl.cpp | 12 +- tools/designer/designer/formwindow.cpp | 4 +- tools/designer/designer/iconvieweditorimpl.cpp | 6 +- tools/designer/designer/listboxeditorimpl.cpp | 6 +- tools/designer/designer/listboxrename.cpp | 2 +- tools/designer/designer/listdnd.h | 2 +- tools/designer/designer/listvieweditorimpl.cpp | 8 +- tools/designer/designer/mainwindow.cpp | 2 +- tools/designer/designer/mainwindowactions.cpp | 6 +- tools/designer/designer/menubareditor.cpp | 2 +- tools/designer/designer/multilineeditorimpl.cpp | 2 +- tools/designer/designer/newformimpl.cpp | 4 +- .../designer/paletteeditoradvancedimpl.cpp | 6 +- tools/designer/designer/paletteeditorimpl.cpp | 6 +- tools/designer/designer/pixmapchooser.cpp | 4 +- tools/designer/designer/pixmapchooser.h | 2 +- tools/designer/designer/popupmenueditor.cpp | 2 +- tools/designer/designer/projectsettingsimpl.cpp | 8 +- tools/designer/designer/propertyeditor.cpp | 8 +- tools/designer/designer/propertyeditor.h | 4 +- tools/designer/designer/qcompletionedit.h | 2 +- tools/designer/designer/replacedialog.ui | 2 +- tools/designer/designer/resource.cpp | 2 +- tools/designer/designer/startdialogimpl.cpp | 6 +- tools/designer/designer/tableeditorimpl.cpp | 6 +- tools/designer/designer/variabledialogimpl.cpp | 4 +- tools/designer/designer/widgetfactory.cpp | 14 +- tools/designer/designer/widgetfactory.h | 6 +- tools/designer/designer/wizardeditorimpl.cpp | 2 +- tools/designer/editor/preferences.ui | 8 +- tools/designer/examples/colortool/mainform.ui | 6 +- tools/designer/examples/credit/creditform.cpp | 4 +- tools/designer/examples/credit/creditformbase.cpp | 6 +- tools/designer/examples/credit/creditformbase.h | 2 +- .../examples/filechooser/widget/filechooser.cpp | 4 +- tools/designer/examples/receiver1/mainform.ui | 2 +- tools/designer/examples/receiver2/mainform.ui | 2 +- tools/designer/examples/receiver2/receiver.cpp | 4 +- tools/designer/examples/receiver2/receiver.h | 2 +- tools/designer/examples/sizeaware/sizeaware.h | 2 +- tools/designer/examples/vcr/vcr.cpp | 2 +- .../cppeditor/sourcetemplateinterfaceimpl.cpp | 2 +- tools/designer/plugins/dlg/dlg2ui.cpp | 4 +- .../designer/plugins/wizards/sqlformwizardimpl.cpp | 10 +- tools/designer/shared/widgetdatabase.cpp | 13 +- tools/designer/uilib/tqwidgetfactory.cpp | 22 +- tools/linguist/book/linguist-programmer.leaf | 28 +- tools/linguist/linguist/finddialog.cpp | 6 +- tools/linguist/linguist/finddialog.h | 2 +- tools/linguist/linguist/msgedit.cpp | 6 +- tools/linguist/linguist/msgedit.h | 2 +- tools/linguist/linguist/phrasebookbox.cpp | 4 +- tools/linguist/linguist/phrasebookbox.h | 2 +- tools/linguist/tutorial/tt1/main.cpp | 2 +- tools/linguist/tutorial/tt2/arrowpad.cpp | 2 +- tools/linguist/tutorial/tt3/printpanel.cpp | 2 +- tools/qtconfig/mainwindow.cpp | 8 +- tools/qtconfig/paletteeditoradvanced.cpp | 6 +- translations/qt_ar.ts | 4 +- translations/qt_ca.ts | 4 +- translations/qt_cs.ts | 4 +- translations/qt_de.ts | 4 +- translations/qt_es.ts | 4 +- translations/qt_fr.ts | 4 +- translations/qt_he.ts | 4 +- translations/qt_it.ts | 4 +- translations/qt_ja.ts | 4 +- translations/qt_nb.ts | 4 +- translations/qt_pt-br.ts | 4 +- translations/qt_pt.ts | 4 +- translations/qt_ru.ts | 6 +- translations/qt_sk.ts | 4 +- translations/qt_tr.ts | 4 +- translations/qt_zh-cn.ts | 4 +- translations/qt_zh-tw.ts | 4 +- translations/template.ts | 4 +- tutorial/t1/main.cpp | 2 +- tutorial/t10/lcdrange.cpp | 4 +- tutorial/t10/main.cpp | 4 +- tutorial/t11/lcdrange.cpp | 4 +- tutorial/t11/main.cpp | 4 +- tutorial/t12/lcdrange.cpp | 4 +- tutorial/t12/main.cpp | 4 +- tutorial/t13/gamebrd.cpp | 4 +- tutorial/t13/lcdrange.cpp | 4 +- tutorial/t14/gamebrd.cpp | 4 +- tutorial/t14/lcdrange.cpp | 4 +- tutorial/t15/main.h | 2 +- tutorial/t2/main.cpp | 2 +- tutorial/t3/main.cpp | 2 +- tutorial/t4/main.cpp | 2 +- tutorial/t5/main.cpp | 6 +- tutorial/t6/main.cpp | 6 +- tutorial/t7/lcdrange.cpp | 4 +- tutorial/t7/main.cpp | 4 +- tutorial/t8/lcdrange.cpp | 4 +- tutorial/t8/main.cpp | 4 +- tutorial/t9/lcdrange.cpp | 4 +- tutorial/t9/main.cpp | 4 +- 811 files changed, 39013 insertions(+), 39012 deletions(-) delete mode 100644 doc/html/ntqcheckbox.html delete mode 100644 doc/html/ntqcombobox.html delete mode 100644 doc/html/ntqdial.html delete mode 100644 doc/html/ntqdialog.html delete mode 100644 doc/html/ntqlcdnumber.html delete mode 100644 doc/html/ntqlineedit.html delete mode 100644 doc/html/ntqpushbutton.html delete mode 100644 doc/html/ntqradiobutton.html delete mode 100644 doc/html/ntqscrollbar.html delete mode 100644 doc/html/ntqscrollview.html delete mode 100644 doc/html/ntqslider.html delete mode 100644 doc/html/ntqspinbox.html delete mode 100644 doc/html/qcheckbox-h.html delete mode 100644 doc/html/qcheckbox-members.html delete mode 100644 doc/html/qchecklistitem-members.html delete mode 100644 doc/html/qchecklistitem.html delete mode 100644 doc/html/qchecktableitem-members.html delete mode 100644 doc/html/qchecktableitem.html delete mode 100644 doc/html/qcombo1-m.png delete mode 100644 doc/html/qcombo1-w.png delete mode 100644 doc/html/qcombo2-m.png delete mode 100644 doc/html/qcombo3-m.png delete mode 100644 doc/html/qcombobox-h.html delete mode 100644 doc/html/qcombobox-members.html delete mode 100644 doc/html/qcombotableitem-members.html delete mode 100644 doc/html/qcombotableitem.html delete mode 100644 doc/html/qdial-h.html delete mode 100644 doc/html/qdial-m.png delete mode 100644 doc/html/qdial-members.html delete mode 100644 doc/html/qdial-w.png delete mode 100644 doc/html/qdialog-h.html delete mode 100644 doc/html/qdialog-members.html delete mode 100644 doc/html/qlcdnum-m.png delete mode 100644 doc/html/qlcdnum-w.png delete mode 100644 doc/html/qlcdnumber-h.html delete mode 100644 doc/html/qlcdnumber-members.html delete mode 100644 doc/html/qlined-m.png delete mode 100644 doc/html/qlined-w.png delete mode 100644 doc/html/qlineedit-h.html delete mode 100644 doc/html/qlineedit-members.html delete mode 100644 doc/html/qpushbt-m.png delete mode 100644 doc/html/qpushbt-w.png delete mode 100644 doc/html/qpushbutton-h.html delete mode 100644 doc/html/qpushbutton-members.html delete mode 100644 doc/html/qradiobt-m.png delete mode 100644 doc/html/qradiobt-w.png delete mode 100644 doc/html/qradiobutton-h.html delete mode 100644 doc/html/qradiobutton-members.html delete mode 100644 doc/html/qscrollbar-h.html delete mode 100644 doc/html/qscrollbar-members.html delete mode 100644 doc/html/qscrollview-cl.png delete mode 100644 doc/html/qscrollview-h.html delete mode 100644 doc/html/qscrollview-m.png delete mode 100644 doc/html/qscrollview-members.html delete mode 100644 doc/html/qscrollview-vp.png delete mode 100644 doc/html/qscrollview-vp2.png delete mode 100644 doc/html/qscrollview-w.png delete mode 100644 doc/html/qslider-h.html delete mode 100644 doc/html/qslider-m.png delete mode 100644 doc/html/qslider-members.html delete mode 100644 doc/html/qslider-w.png delete mode 100644 doc/html/qspinbox-h.html delete mode 100644 doc/html/qspinbox-m.png delete mode 100644 doc/html/qspinbox-members.html delete mode 100644 doc/html/qspinbox-w.png create mode 100644 doc/html/tqcheckbox-h.html create mode 100644 doc/html/tqcheckbox-members.html create mode 100644 doc/html/tqcheckbox.html create mode 100644 doc/html/tqchecklistitem-members.html create mode 100644 doc/html/tqchecklistitem.html create mode 100644 doc/html/tqchecktableitem-members.html create mode 100644 doc/html/tqchecktableitem.html create mode 100644 doc/html/tqcombo1-m.png create mode 100644 doc/html/tqcombo1-w.png create mode 100644 doc/html/tqcombo2-m.png create mode 100644 doc/html/tqcombo3-m.png create mode 100644 doc/html/tqcombobox-h.html create mode 100644 doc/html/tqcombobox-members.html create mode 100644 doc/html/tqcombobox.html create mode 100644 doc/html/tqcombotableitem-members.html create mode 100644 doc/html/tqcombotableitem.html create mode 100644 doc/html/tqdial-h.html create mode 100644 doc/html/tqdial-m.png create mode 100644 doc/html/tqdial-members.html create mode 100644 doc/html/tqdial-w.png create mode 100644 doc/html/tqdial.html create mode 100644 doc/html/tqdialog-h.html create mode 100644 doc/html/tqdialog-members.html create mode 100644 doc/html/tqdialog.html create mode 100644 doc/html/tqlcdnum-m.png create mode 100644 doc/html/tqlcdnum-w.png create mode 100644 doc/html/tqlcdnumber-h.html create mode 100644 doc/html/tqlcdnumber-members.html create mode 100644 doc/html/tqlcdnumber.html create mode 100644 doc/html/tqlined-m.png create mode 100644 doc/html/tqlined-w.png create mode 100644 doc/html/tqlineedit-h.html create mode 100644 doc/html/tqlineedit-members.html create mode 100644 doc/html/tqlineedit.html create mode 100644 doc/html/tqpushbt-m.png create mode 100644 doc/html/tqpushbt-w.png create mode 100644 doc/html/tqpushbutton-h.html create mode 100644 doc/html/tqpushbutton-members.html create mode 100644 doc/html/tqpushbutton.html create mode 100644 doc/html/tqradiobt-m.png create mode 100644 doc/html/tqradiobt-w.png create mode 100644 doc/html/tqradiobutton-h.html create mode 100644 doc/html/tqradiobutton-members.html create mode 100644 doc/html/tqradiobutton.html create mode 100644 doc/html/tqscrollbar-h.html create mode 100644 doc/html/tqscrollbar-members.html create mode 100644 doc/html/tqscrollbar.html create mode 100644 doc/html/tqscrollview-cl.png create mode 100644 doc/html/tqscrollview-h.html create mode 100644 doc/html/tqscrollview-m.png create mode 100644 doc/html/tqscrollview-members.html create mode 100644 doc/html/tqscrollview-vp.png create mode 100644 doc/html/tqscrollview-vp2.png create mode 100644 doc/html/tqscrollview-w.png create mode 100644 doc/html/tqscrollview.html create mode 100644 doc/html/tqslider-h.html create mode 100644 doc/html/tqslider-m.png create mode 100644 doc/html/tqslider-members.html create mode 100644 doc/html/tqslider-w.png create mode 100644 doc/html/tqslider.html create mode 100644 doc/html/tqspinbox-h.html create mode 100644 doc/html/tqspinbox-m.png create mode 100644 doc/html/tqspinbox-members.html create mode 100644 doc/html/tqspinbox-w.png create mode 100644 doc/html/tqspinbox.html delete mode 120000 include/ntqcheckbox.h delete mode 120000 include/ntqcombobox.h delete mode 120000 include/ntqdial.h delete mode 120000 include/ntqdialog.h delete mode 120000 include/ntqlcdnumber.h delete mode 120000 include/ntqlineedit.h delete mode 120000 include/ntqpushbutton.h delete mode 120000 include/ntqradiobutton.h delete mode 120000 include/ntqscrollbar.h delete mode 120000 include/ntqscrollview.h delete mode 120000 include/ntqslider.h delete mode 120000 include/ntqspinbox.h delete mode 120000 include/private/qdialogbuttons_p.h create mode 120000 include/private/tqdialogbuttons_p.h create mode 120000 include/tqcheckbox.h create mode 120000 include/tqcombobox.h create mode 120000 include/tqdial.h create mode 120000 include/tqdialog.h create mode 120000 include/tqlcdnumber.h create mode 120000 include/tqlineedit.h create mode 120000 include/tqpushbutton.h create mode 120000 include/tqradiobutton.h create mode 120000 include/tqscrollbar.h create mode 120000 include/tqscrollview.h create mode 120000 include/tqslider.h create mode 120000 include/tqspinbox.h delete mode 100644 src/dialogs/ntqdialog.h delete mode 100644 src/dialogs/qdialog.cpp create mode 100644 src/dialogs/tqdialog.cpp create mode 100644 src/dialogs/tqdialog.h delete mode 100644 src/widgets/ntqcheckbox.h delete mode 100644 src/widgets/ntqcombobox.h delete mode 100644 src/widgets/ntqdial.h delete mode 100644 src/widgets/ntqlcdnumber.h delete mode 100644 src/widgets/ntqlineedit.h delete mode 100644 src/widgets/ntqpushbutton.h delete mode 100644 src/widgets/ntqradiobutton.h delete mode 100644 src/widgets/ntqscrollbar.h delete mode 100644 src/widgets/ntqscrollview.h delete mode 100644 src/widgets/ntqslider.h delete mode 100644 src/widgets/ntqspinbox.h delete mode 100644 src/widgets/qcheckbox.cpp delete mode 100644 src/widgets/qcombobox.cpp delete mode 100644 src/widgets/qdial.cpp delete mode 100644 src/widgets/qdialogbuttons.cpp delete mode 100644 src/widgets/qdialogbuttons_p.h delete mode 100644 src/widgets/qlcdnumber.cpp delete mode 100644 src/widgets/qlineedit.cpp delete mode 100644 src/widgets/qpushbutton.cpp delete mode 100644 src/widgets/qradiobutton.cpp delete mode 100644 src/widgets/qscrollbar.cpp delete mode 100644 src/widgets/qscrollview.cpp delete mode 100644 src/widgets/qslider.cpp delete mode 100644 src/widgets/qspinbox.cpp delete mode 100644 src/widgets/qspinwidget.cpp create mode 100644 src/widgets/tqcheckbox.cpp create mode 100644 src/widgets/tqcheckbox.h create mode 100644 src/widgets/tqcombobox.cpp create mode 100644 src/widgets/tqcombobox.h create mode 100644 src/widgets/tqdial.cpp create mode 100644 src/widgets/tqdial.h create mode 100644 src/widgets/tqdialogbuttons.cpp create mode 100644 src/widgets/tqdialogbuttons_p.h create mode 100644 src/widgets/tqlcdnumber.cpp create mode 100644 src/widgets/tqlcdnumber.h create mode 100644 src/widgets/tqlineedit.cpp create mode 100644 src/widgets/tqlineedit.h create mode 100644 src/widgets/tqpushbutton.cpp create mode 100644 src/widgets/tqpushbutton.h create mode 100644 src/widgets/tqradiobutton.cpp create mode 100644 src/widgets/tqradiobutton.h create mode 100644 src/widgets/tqscrollbar.cpp create mode 100644 src/widgets/tqscrollbar.h create mode 100644 src/widgets/tqscrollview.cpp create mode 100644 src/widgets/tqscrollview.h create mode 100644 src/widgets/tqslider.cpp create mode 100644 src/widgets/tqslider.h create mode 100644 src/widgets/tqspinbox.cpp create mode 100644 src/widgets/tqspinbox.h create mode 100644 src/widgets/tqspinwidget.cpp diff --git a/doc/classchart.doc b/doc/classchart.doc index c470de051..e5454b012 100644 --- a/doc/classchart.doc +++ b/doc/classchart.doc @@ -141,29 +141,29 @@ - + - - + + - - + + - + - + @@ -175,10 +175,10 @@ - + - - + + @@ -193,21 +193,21 @@ - + - + - + - - + + diff --git a/doc/features.doc b/doc/features.doc index c79c24815..4f37ddd13 100644 --- a/doc/features.doc +++ b/doc/features.doc @@ -174,13 +174,13 @@ The available options are: \i Object canvas (\l TQCanvas) \i TQT_NO_WIDGETS \row \i TQT_NO_DIAL - \i Value control (\l QDial) + \i Value control (\l TQDial) \i TQT_NO_WIDGETS \row \i TQT_NO_WORKSPACE \i MDI (Multiple Document Interface) (\l TQWorkspace) \i TQT_NO_WIDGETS \row \i TQT_NO_LCDNUMBER - \i LCD-like number display (\l QLCDNumber) + \i LCD-like number display (\l TQLCDNumber) \i TQT_NO_WIDGETS \header \i31 GUI Styles diff --git a/doc/html/abstractwidgets.html b/doc/html/abstractwidgets.html index 567d99d69..28bc11a53 100644 --- a/doc/html/abstractwidgets.html +++ b/doc/html/abstractwidgets.html @@ -39,10 +39,10 @@ these classes.

TQButtonThe abstract base class of button widgets, providing functionality common to buttons
TQCanvas2D area that can contain TQCanvasItem objects -
TQDialogThe base class of dialog windows +
TQDialogThe base class of dialog windows
TQFrameThe base class of widgets that can have a frame
TQGridViewAbstract base for fixed-size grids -
TQScrollViewScrolling area with on-demand scroll bars +
TQScrollViewScrolling area with on-demand scroll bars
TQWidgetThe base class of all user interface objects
TQWizardFramework for wizard dialogs
diff --git a/doc/html/addressbook-example.html b/doc/html/addressbook-example.html index 0c6181e81..7d2b9a9dd 100644 --- a/doc/html/addressbook-example.html +++ b/doc/html/addressbook-example.html @@ -256,10 +256,10 @@ protected: TQGridLayout *mainGrid; TQTabWidget *tabWidget; TQListView *listView; - TQPushButton *add, *change, *find; - TQLineEdit *iFirstName, *iLastName, *iAddress, *iEMail, + TQPushButton *add, *change, *find; + TQLineEdit *iFirstName, *iLastName, *iAddress, *iEMail, *sFirstName, *sLastName, *sAddress, *sEMail; - TQCheckBox *cFirstName, *cLastName, *cAddress, *cEMail; + TQCheckBox *cFirstName, *cLastName, *cAddress, *cEMail; }; @@ -285,10 +285,10 @@ protected: #include <ntqlayout.h> #include <tqwidget.h> #include <tqlabel.h> -#include <ntqpushbutton.h> -#include <ntqlineedit.h> +#include <tqpushbutton.h> +#include <tqlineedit.h> #include <tqlabel.h> -#include <ntqcheckbox.h> +#include <tqcheckbox.h> #include <tqfile.h> #include <tqtextstream.h> @@ -368,32 +368,32 @@ void ABCentralWidget::setupTabWidget() liEMail->resize( liEMail->sizeHint() ); grid1->addWidget( liEMail, 0, 3 ); - add = new TQPushButton( "A&dd", input ); + add = new TQPushButton( "A&dd", input ); add->resize( add->sizeHint() ); grid1->addWidget( add, 0, 4 ); connect( add, TQ_SIGNAL( clicked() ), this, TQ_SLOT( addEntry() ) ); - iFirstName = new TQLineEdit( input ); - iFirstName->resize( iFirstName->sizeHint() ); + iFirstName = new TQLineEdit( input ); + iFirstName->resize( iFirstName->sizeHint() ); grid1->addWidget( iFirstName, 1, 0 ); liFirstName->setBuddy( iFirstName ); - iLastName = new TQLineEdit( input ); - iLastName->resize( iLastName->sizeHint() ); + iLastName = new TQLineEdit( input ); + iLastName->resize( iLastName->sizeHint() ); grid1->addWidget( iLastName, 1, 1 ); liLastName->setBuddy( iLastName ); - iAddress = new TQLineEdit( input ); - iAddress->resize( iAddress->sizeHint() ); + iAddress = new TQLineEdit( input ); + iAddress->resize( iAddress->sizeHint() ); grid1->addWidget( iAddress, 1, 2 ); liAddress->setBuddy( iAddress ); - iEMail = new TQLineEdit( input ); - iEMail->resize( iEMail->sizeHint() ); + iEMail = new TQLineEdit( input ); + iEMail->resize( iEMail->sizeHint() ); grid1->addWidget( iEMail, 1, 3 ); liEMail->setBuddy( iEMail ); - change = new TQPushButton( "&Change", input ); + change = new TQPushButton( "&Change", input ); change->resize( change->sizeHint() ); grid1->addWidget( change, 1, 4 ); connect( change, TQ_SIGNAL( clicked() ), this, TQ_SLOT( changeEntry() ) ); @@ -405,48 +405,48 @@ void ABCentralWidget::setupTabWidget() TQWidget *search = new TQWidget( this ); TQGridLayout *grid2 = new TQGridLayout( search, 2, 5, 5, 5 ); - cFirstName = new TQCheckBox( "First &Name", search ); + cFirstName = new TQCheckBox( "First &Name", search ); cFirstName->resize( cFirstName->sizeHint() ); grid2->addWidget( cFirstName, 0, 0 ); connect( cFirstName, TQ_SIGNAL( clicked() ), this, TQ_SLOT( toggleFirstName() ) ); - cLastName = new TQCheckBox( "&Last Name", search ); + cLastName = new TQCheckBox( "&Last Name", search ); cLastName->resize( cLastName->sizeHint() ); grid2->addWidget( cLastName, 0, 1 ); connect( cLastName, TQ_SIGNAL( clicked() ), this, TQ_SLOT( toggleLastName() ) ); - cAddress = new TQCheckBox( "Add&ress", search ); + cAddress = new TQCheckBox( "Add&ress", search ); cAddress->resize( cAddress->sizeHint() ); grid2->addWidget( cAddress, 0, 2 ); connect( cAddress, TQ_SIGNAL( clicked() ), this, TQ_SLOT( toggleAddress() ) ); - cEMail = new TQCheckBox( "&E-Mail", search ); + cEMail = new TQCheckBox( "&E-Mail", search ); cEMail->resize( cEMail->sizeHint() ); grid2->addWidget( cEMail, 0, 3 ); connect( cEMail, TQ_SIGNAL( clicked() ), this, TQ_SLOT( toggleEMail() ) ); - sFirstName = new TQLineEdit( search ); - sFirstName->resize( sFirstName->sizeHint() ); + sFirstName = new TQLineEdit( search ); + sFirstName->resize( sFirstName->sizeHint() ); grid2->addWidget( sFirstName, 1, 0 ); - sLastName = new TQLineEdit( search ); - sLastName->resize( sLastName->sizeHint() ); + sLastName = new TQLineEdit( search ); + sLastName->resize( sLastName->sizeHint() ); grid2->addWidget( sLastName, 1, 1 ); - sAddress = new TQLineEdit( search ); - sAddress->resize( sAddress->sizeHint() ); + sAddress = new TQLineEdit( search ); + sAddress->resize( sAddress->sizeHint() ); grid2->addWidget( sAddress, 1, 2 ); - sEMail = new TQLineEdit( search ); - sEMail->resize( sEMail->sizeHint() ); + sEMail = new TQLineEdit( search ); + sEMail->resize( sEMail->sizeHint() ); grid2->addWidget( sEMail, 1, 3 ); - find = new TQPushButton( "F&ind", search ); + find = new TQPushButton( "F&ind", search ); find->resize( find->sizeHint() ); grid2->addWidget( find, 1, 4 ); connect( find, TQ_SIGNAL( clicked() ), this, TQ_SLOT( findEntries() ) ); - cFirstName->setChecked( TRUE ); + cFirstName->setChecked( TRUE ); sFirstName->setEnabled( TRUE ); sLastName->setEnabled( FALSE ); sAddress->setEnabled( FALSE ); @@ -475,19 +475,19 @@ void ABCentralWidget::setupListView() void ABCentralWidget::addEntry() { - if ( !iFirstName->text().isEmpty() || !iLastName->text().isEmpty() || - !iAddress->text().isEmpty() || !iEMail->text().isEmpty() ) { + if ( !iFirstName->text().isEmpty() || !iLastName->text().isEmpty() || + !iAddress->text().isEmpty() || !iEMail->text().isEmpty() ) { TQListViewItem *item = new TQListViewItem( listView ); - item->setText( 0, iFirstName->text() ); - item->setText( 1, iLastName->text() ); - item->setText( 2, iAddress->text() ); - item->setText( 3, iEMail->text() ); + item->setText( 0, iFirstName->text() ); + item->setText( 1, iLastName->text() ); + item->setText( 2, iAddress->text() ); + item->setText( 3, iEMail->text() ); } - iFirstName->setText( "" ); - iLastName->setText( "" ); - iAddress->setText( "" ); - iEMail->setText( "" ); + iFirstName->setText( "" ); + iLastName->setText( "" ); + iAddress->setText( "" ); + iEMail->setText( "" ); } void ABCentralWidget::changeEntry() @@ -495,21 +495,21 @@ void ABCentralWidget::changeEntry() TQListViewItem *item = listView->currentItem(); if ( item && - ( !iFirstName->text().isEmpty() || !iLastName->text().isEmpty() || - !iAddress->text().isEmpty() || !iEMail->text().isEmpty() ) ) { - item->setText( 0, iFirstName->text() ); - item->setText( 1, iLastName->text() ); - item->setText( 2, iAddress->text() ); - item->setText( 3, iEMail->text() ); + ( !iFirstName->text().isEmpty() || !iLastName->text().isEmpty() || + !iAddress->text().isEmpty() || !iEMail->text().isEmpty() ) ) { + item->setText( 0, iFirstName->text() ); + item->setText( 1, iLastName->text() ); + item->setText( 2, iAddress->text() ); + item->setText( 3, iEMail->text() ); } } void ABCentralWidget::selectionChanged() { - iFirstName->setText( "" ); - iLastName->setText( "" ); - iAddress->setText( "" ); - iEMail->setText( "" ); + iFirstName->setText( "" ); + iLastName->setText( "" ); + iAddress->setText( "" ); + iEMail->setText( "" ); } void ABCentralWidget::itemSelected( TQListViewItem *item ) @@ -519,17 +519,17 @@ void ABCentralWidget::itemSelected( item->setSelected( TRUE ); item->repaint(); - iFirstName->setText( item->text( 0 ) ); - iLastName->setText( item->text( 1 ) ); - iAddress->setText( item->text( 2 ) ); - iEMail->setText( item->text( 3 ) ); + iFirstName->setText( item->text( 0 ) ); + iLastName->setText( item->text( 1 ) ); + iAddress->setText( item->text( 2 ) ); + iEMail->setText( item->text( 3 ) ); } void ABCentralWidget::toggleFirstName() { - sFirstName->setText( "" ); + sFirstName->setText( "" ); - if ( cFirstName->isChecked() ) { + if ( cFirstName->isChecked() ) { sFirstName->setEnabled( TRUE ); sFirstName->setFocus(); } @@ -539,9 +539,9 @@ void ABCentralWidget::toggleFirstName() void ABCentralWidget::toggleLastName() { - sLastName->setText( "" ); + sLastName->setText( "" ); - if ( cLastName->isChecked() ) { + if ( cLastName->isChecked() ) { sLastName->setEnabled( TRUE ); sLastName->setFocus(); } @@ -551,9 +551,9 @@ void ABCentralWidget::toggleLastName() void ABCentralWidget::toggleAddress() { - sAddress->setText( "" ); + sAddress->setText( "" ); - if ( cAddress->isChecked() ) { + if ( cAddress->isChecked() ) { sAddress->setEnabled( TRUE ); sAddress->setFocus(); } @@ -563,9 +563,9 @@ void ABCentralWidget::toggleAddress() void ABCentralWidget::toggleEMail() { - sEMail->setText( "" ); + sEMail->setText( "" ); - if ( cEMail->isChecked() ) { + if ( cEMail->isChecked() ) { sEMail->setEnabled( TRUE ); sEMail->setFocus(); } @@ -575,10 +575,10 @@ void ABCentralWidget::toggleEMail() void ABCentralWidget::findEntries() { - if ( !cFirstName->isChecked() && - !cLastName->isChecked() && - !cAddress->isChecked() && - !cEMail->isChecked() ) { + if ( !cFirstName->isChecked() && + !cLastName->isChecked() && + !cAddress->isChecked() && + !cEMail->isChecked() ) { listView->clearSelection(); return; } @@ -588,26 +588,26 @@ void ABCentralWidget::findEntries() for ( ; it.current(); ++it ) { bool select = TRUE; - if ( cFirstName->isChecked() ) { - if ( select && it.current()->text( 0 ).contains( sFirstName->text() ) ) + if ( cFirstName->isChecked() ) { + if ( select && it.current()->text( 0 ).contains( sFirstName->text() ) ) select = TRUE; else select = FALSE; } - if ( cLastName->isChecked() ) { - if ( select && it.current()->text( 1 ).contains( sLastName->text() ) ) + if ( cLastName->isChecked() ) { + if ( select && it.current()->text( 1 ).contains( sLastName->text() ) ) select = TRUE; else select = FALSE; } - if ( cAddress->isChecked() ) { - if ( select && it.current()->text( 2 ).contains( sAddress->text() ) ) + if ( cAddress->isChecked() ) { + if ( select && it.current()->text( 2 ).contains( sAddress->text() ) ) select = TRUE; else select = FALSE; } - if ( cEMail->isChecked() ) { - if ( select && it.current()->text( 3 ).contains( sEMail->text() ) ) + if ( cEMail->isChecked() ) { + if ( select && it.current()->text( 3 ).contains( sEMail->text() ) ) select = TRUE; else select = FALSE; diff --git a/doc/html/advanced.html b/doc/html/advanced.html index ebcdd8830..13d802ff4 100644 --- a/doc/html/advanced.html +++ b/doc/html/advanced.html @@ -35,9 +35,9 @@ body { background: #ffffff; color: black; }

These classes provide more complex user interface controls (widgets).

-
TQCheckListItemCheckable list view items -
TQCheckTableItemCheckboxes in TQTables -
TQComboTableItemMeans of using comboboxes in TQTables +
TQCheckListItemCheckable list view items +
TQCheckTableItemCheckboxes in TQTables +
TQComboTableItemMeans of using comboboxes in TQTables
TQDateEditDate editor
TQDateTimeEditCombines a TQDateEdit and TQTimeEdit widget into a single widget for editing datetimes
TQDesktopWidgetAccess to screen information on multi-head systems diff --git a/doc/html/annotated.html b/doc/html/annotated.html index 4c28b00de..801d0a422 100644 --- a/doc/html/annotated.html +++ b/doc/html/annotated.html @@ -78,9 +78,9 @@ body { background: #ffffff; color: black; }
TQCanvasViewOn-screen view of a TQCanvas
TQCharLightweight Unicode character
TQCharRefHelper class for TQString -
TQCheckBoxCheckbox with a text label -
TQCheckListItemCheckable list view items -
TQCheckTableItemCheckboxes in TQTables +
TQCheckBoxCheckbox with a text label +
TQCheckListItemCheckable list view items +
TQCheckTableItemCheckboxes in TQTables
TQChildEventEvent parameters for child object events
TQClipboardAccess to the window system clipboard
TQCloseEventParameters that describe a close event @@ -88,8 +88,8 @@ body { background: #ffffff; color: black; }
TQColorDialogDialog widget for specifying colors
TQColorDragDrag and drop object for transferring colors
TQColorGroupGroup of widget colors -
TQComboBoxCombined button and popup list -
TQComboTableItemMeans of using comboboxes in TQTables +
TQComboBoxCombined button and popup list +
TQComboTableItemMeans of using comboboxes in TQTables
TQCommonStyleEncapsulates the common Look and Feel of a GUI
TQConstStringString objects using constant Unicode data
TQContextMenuEventParameters that describe a context menu event @@ -107,8 +107,8 @@ body { background: #ffffff; color: black; }
TQDateTimeEditBaseAbstraction for date and edit editors
TQDeepCopyTemplate class which ensures that implicitly shared and explicitly shared classes reference unique data
TQDesktopWidgetAccess to screen information on multi-head systems -
TQDialRounded range control (like a speedometer or potentiometer) -
TQDialogThe base class of dialog windows +
TQDialRounded range control (like a speedometer or potentiometer) +
TQDialogThe base class of dialog windows
TQDictTemplate class that provides a dictionary based on TQString keys
TQDictIteratorIterator for TQDict collections
TQDirAccess to directory structures and their contents in a platform-independent way @@ -210,13 +210,13 @@ body { background: #ffffff; color: black; }
TQJisCodecConversion to and from JIS character sets
TQKeyEventDescribes a key event
TQKeySequenceEncapsulates a key sequence as used by accelerators -
TQLCDNumberDisplays a number with LCD-like digits +
TQLCDNumberDisplays a number with LCD-like digits
TQLabelText or image display
TQLayoutThe base class of geometry managers
TQLayoutItemAbstract item that a TQLayout manipulates
TQLayoutIteratorIterators over TQLayoutItem
TQLibraryWrapper for handling shared libraries -
TQLineEditOne-line text editor +
TQLineEditOne-line text editor
TQListBoxList of selectable, read-only items
TQListBoxItemThe base class of all list box items
TQListBoxPixmapList box items with a pixmap and optional text @@ -287,8 +287,8 @@ body { background: #ffffff; color: black; }
TQPtrQueueTemplate class that provides a queue
TQPtrStackTemplate class that provides a stack
TQPtrVectorTemplate collection class that provides a vector (array) -
TQPushButtonCommand button -
TQRadioButtonRadio button with a text or pixmap label +
TQPushButtonCommand button +
TQRadioButtonRadio button with a text or pixmap label
TQRangeControlInteger value within a range
TQRectDefines a rectangle in the plane
TQRegExpPattern matching using regular expressions @@ -296,8 +296,8 @@ body { background: #ffffff; color: black; }
TQRegionClip region for a painter
TQResizeEventEvent parameters for resize events
TQSGIStyleSGI/Irix look and feel -
TQScrollBarVertical or horizontal scroll bar -
TQScrollViewScrolling area with on-demand scroll bars +
TQScrollBarVertical or horizontal scroll bar +
TQScrollViewScrolling area with on-demand scroll bars
TQSemaphoreRobust integer semaphore
TQServerSocketTCP-based server
TQSessionManagerAccess to the session manager @@ -310,13 +310,13 @@ body { background: #ffffff; color: black; }
TQSizeGripCorner-grip for resizing a top-level window
TQSizePolicyLayout attribute describing horizontal and vertical resizing policy
TQSjisCodecConversion to and from Shift-JIS -
TQSliderVertical or horizontal slider +
TQSliderVertical or horizontal slider
TQSocketBuffered TCP connection
TQSocketDevicePlatform-independent low-level socket API
TQSocketNotifierSupport for socket callbacks
TQSoundAccess to the platform audio facilities
TQSpacerItemBlank space in a layout -
TQSpinBoxSpin box widget (spin button) +
TQSpinBoxSpin box widget (spin button)
TQSplashScreenSplash screen that can be shown during application startup
TQSplitterImplements a splitter widget
TQSqlNamespace for TQt SQL identifiers that need to be global-like diff --git a/doc/html/basic.html b/doc/html/basic.html index f8497d5e1..8e7e7cfae 100644 --- a/doc/html/basic.html +++ b/doc/html/basic.html @@ -40,19 +40,19 @@ widgets.

@@ -253,7 +253,7 @@ classes, see TQt's Main Classes. @@ -339,9 +339,9 @@ classes, see TQt's Main Classes. @@ -352,7 +352,7 @@ classes, see TQt's Main Classes. @@ -361,7 +361,7 @@ classes, see TQt's Main Classes. @@ -572,7 +572,7 @@ classes, see TQt's Main Classes. @@ -599,7 +599,7 @@ classes, see TQt's Main Classes.
TQActionAbstract user interface action that can appear both in menus and tool bars
TQActionGroupGroups actions together -
TQCheckBoxCheckbox with a text label -
TQComboBoxCombined button and popup list -
TQDialRounded range control (like a speedometer or potentiometer) +
TQCheckBoxCheckbox with a text label +
TQComboBoxCombined button and popup list +
TQDialRounded range control (like a speedometer or potentiometer)
TQLabelText or image display -
TQLCDNumberDisplays a number with LCD-like digits -
TQLineEditOne-line text editor +
TQLCDNumberDisplays a number with LCD-like digits +
TQLineEditOne-line text editor
TQPopupMenuPopup menu widget -
TQPushButtonCommand button -
TQRadioButtonRadio button with a text or pixmap label -
TQScrollBarVertical or horizontal scroll bar +
TQPushButtonCommand button +
TQRadioButtonRadio button with a text or pixmap label +
TQScrollBarVertical or horizontal scroll bar
TQSizeGripCorner-grip for resizing a top-level window -
TQSliderVertical or horizontal slider -
TQSpinBoxSpin box widget (spin button) +
TQSliderVertical or horizontal slider +
TQSpinBoxSpin box widget (spin button)
TQSyntaxHighlighterBase class for implementing TQTextEdit syntax highlighters
TQTextEditPowerful single-page rich text editor
TQToolButtonQuick-access button to commands or options, usually used inside a TQToolBar diff --git a/doc/html/buttongroups-example.html b/doc/html/buttongroups-example.html index c9b50d912..5f9937544 100644 --- a/doc/html/buttongroups-example.html +++ b/doc/html/buttongroups-example.html @@ -63,8 +63,8 @@ public: ButtonsGroups( TQWidget *parent = 0, const char *name = 0 ); protected: - TQCheckBox *state; - TQRadioButton *rb21, *rb22, *rb23; + TQCheckBox *state; + TQRadioButton *rb21, *rb22, *rb23; protected slots: void slotChangeGrp3State(); @@ -91,10 +91,10 @@ protected slots: #include <tqpopupmenu.h> #include <ntqbuttongroup.h> #include <ntqlayout.h> -#include <ntqradiobutton.h> -#include <ntqcheckbox.h> +#include <tqradiobutton.h> +#include <tqcheckbox.h> #include <ntqgroupbox.h> -#include <ntqpushbutton.h> +#include <tqpushbutton.h> /* * Constructor @@ -118,10 +118,10 @@ protected slots: bgrp1->setExclusive( TRUE ); // insert 3 radiobuttons - TQRadioButton *rb11 = new TQRadioButton( "&Radiobutton 1", bgrp1 ); - rb11->setChecked( TRUE ); - (void)new TQRadioButton( "R&adiobutton 2", bgrp1 ); - (void)new TQRadioButton( "Ra&diobutton 3", bgrp1 ); + TQRadioButton *rb11 = new TQRadioButton( "&Radiobutton 1", bgrp1 ); + rb11->setChecked( TRUE ); + (void)new TQRadioButton( "R&adiobutton 2", bgrp1 ); + (void)new TQRadioButton( "Ra&diobutton 3", bgrp1 ); // ------- second group @@ -131,12 +131,12 @@ protected slots: bgrp2->setExclusive( FALSE ); // insert 3 checkboxes - (void)new TQCheckBox( "&Checkbox 1", bgrp2 ); - TQCheckBox *cb12 = new TQCheckBox( "C&heckbox 2", bgrp2 ); - cb12->setChecked( TRUE ); - TQCheckBox *cb13 = new TQCheckBox( "Triple &State Button", bgrp2 ); - cb13->setTristate( TRUE ); - cb13->setChecked( TRUE ); + (void)new TQCheckBox( "&Checkbox 1", bgrp2 ); + TQCheckBox *cb12 = new TQCheckBox( "C&heckbox 2", bgrp2 ); + cb12->setChecked( TRUE ); + TQCheckBox *cb13 = new TQCheckBox( "Triple &State Button", bgrp2 ); + cb13->setTristate( TRUE ); + cb13->setChecked( TRUE ); // ------------ third group @@ -146,14 +146,14 @@ protected slots: bgrp3->setRadioButtonExclusive( TRUE ); // insert three radiobuttons - rb21 = new TQRadioButton( "Rad&iobutton 1", bgrp3 ); - rb22 = new TQRadioButton( "Radi&obutton 2", bgrp3 ); - rb23 = new TQRadioButton( "Radio&button 3", bgrp3 ); - rb23->setChecked( TRUE ); + rb21 = new TQRadioButton( "Rad&iobutton 1", bgrp3 ); + rb22 = new TQRadioButton( "Radi&obutton 2", bgrp3 ); + rb23 = new TQRadioButton( "Radio&button 3", bgrp3 ); + rb23->setChecked( TRUE ); // insert a checkbox... - state = new TQCheckBox( "E&nable Radiobuttons", bgrp3 ); - state->setChecked( TRUE ); + state = new TQCheckBox( "E&nable Radiobuttons", bgrp3 ); + state->setChecked( TRUE ); // ...and connect its TQ_SIGNAL clicked() with the TQ_SLOT slotChangeGrp3State() connect( state, TQ_SIGNAL( clicked() ), this, TQ_SLOT( slotChangeGrp3State() ) ); @@ -164,25 +164,25 @@ protected slots: box2->addWidget( bgrp4 ); // insert four pushbuttons... - (void)new TQPushButton( "&Push Button", bgrp4, "push" ); + (void)new TQPushButton( "&Push Button", bgrp4, "push" ); // now make the second one a toggle button - TQPushButton *tb2 = new TQPushButton( "&Toggle Button", bgrp4, "toggle" ); - tb2->setToggleButton( TRUE ); - tb2->setOn( TRUE ); + TQPushButton *tb2 = new TQPushButton( "&Toggle Button", bgrp4, "toggle" ); + tb2->setToggleButton( TRUE ); + tb2->setOn( TRUE ); // ... and make the third one a flat button - TQPushButton *tb3 = new TQPushButton( "&Flat Button", bgrp4, "flat" ); - tb3->setFlat(TRUE); + TQPushButton *tb3 = new TQPushButton( "&Flat Button", bgrp4, "flat" ); + tb3->setFlat(TRUE); // .. and the fourth a button with a menu - TQPushButton *tb4 = new TQPushButton( "Popup Button", bgrp4, "popup" ); + TQPushButton *tb4 = new TQPushButton( "Popup Button", bgrp4, "popup" ); TQPopupMenu *menu = new TQPopupMenu(tb4); menu->insertItem("Item1", 0); menu->insertItem("Item2", 1); menu->insertItem("Item3", 2); menu->insertItem("Item4", 3); - tb4->setPopup(menu); + tb4->setPopup(menu); } /* @@ -193,9 +193,9 @@ protected slots: void ButtonsGroups::slotChangeGrp3State() { - rb21->setEnabled( state->isChecked() ); - rb22->setEnabled( state->isChecked() ); - rb23->setEnabled( state->isChecked() ); + rb21->setEnabled( state->isChecked() ); + rb22->setEnabled( state->isChecked() ); + rb23->setEnabled( state->isChecked() ); } diff --git a/doc/html/canvas-chart-example.html b/doc/html/canvas-chart-example.html index fd831b302..6696123fa 100644 --- a/doc/html/canvas-chart-example.html +++ b/doc/html/canvas-chart-example.html @@ -251,7 +251,7 @@ private: #include <tqaction.h> #include <ntqapplication.h> -#include <ntqcombobox.h> +#include <tqcombobox.h> #include <tqfile.h> #include <tqfiledialog.h> #include <tqfont.h> @@ -261,9 +261,9 @@ private: #include <tqpixmap.h> #include <tqpopupmenu.h> #include <tqprinter.h> -#include <ntqradiobutton.h> +#include <tqradiobutton.h> #include <tqsettings.h> -#include <ntqspinbox.h> +#include <tqspinbox.h> #include <tqstatusbar.h> #include <tqtoolbar.h> #include <tqtoolbutton.h> @@ -669,7 +669,7 @@ void ChartForm::saveOptions() void ChartForm::optionsSetData() { SetDataForm *setDataForm = new SetDataForm( &m_elements, m_decimalPlaces, this ); - if ( setDataForm->exec() ) { + if ( setDataForm->exec() ) { m_changed = TRUE; drawElements(); } @@ -738,7 +738,7 @@ void ChartForm::optionsSetOptions() break; } optionsForm->decimalPlacesSpinBox->setValue( m_decimalPlaces ); - if ( optionsForm->exec() ) { + if ( optionsForm->exec() ) { setChartType( ChartType( optionsForm->chartTypeComboBox->currentItem()) ); m_font = optionsForm->font(); diff --git a/doc/html/canvas-example.html b/doc/html/canvas-example.html index bc98e34e0..fab7117ff 100644 --- a/doc/html/canvas-example.html +++ b/doc/html/canvas-example.html @@ -291,7 +291,7 @@ void NodeItem::moveBy(double dx, double d { } -void FigureEditor::contentsMousePressEvent(TQMouseEvent* e) +void FigureEditor::contentsMousePressEvent(TQMouseEvent* e) { TQPoint p = inverseWorldMatrix().map(e->pos()); TQCanvasItemList l=canvas()->collisions(p); @@ -318,7 +318,7 @@ void FigureEditor::clear() } } -void FigureEditor::contentsMouseMoveEvent(TQMouseEvent* e) +void FigureEditor::contentsMouseMoveEvent(TQMouseEvent* e) { if ( moving ) { TQPoint p = inverseWorldMatrix().map(e->pos()); diff --git a/doc/html/chart-canvasview-cpp.html b/doc/html/chart-canvasview-cpp.html index e2866885b..3d5759a2c 100644 --- a/doc/html/chart-canvasview-cpp.html +++ b/doc/html/chart-canvasview-cpp.html @@ -41,20 +41,20 @@ body { background: #ffffff; color: black; } #include <tqstatusbar.h> -void CanvasView::contentsContextMenuEvent( TQContextMenuEvent * ) +void CanvasView::contentsContextMenuEvent( TQContextMenuEvent * ) { ((ChartForm*)parent())->optionsMenu->exec( TQCursor::pos() ); } -void CanvasView::viewportResizeEvent( TQResizeEvent *e ) +void CanvasView::viewportResizeEvent( TQResizeEvent *e ) { canvas()->resize( e->size().width(), e->size().height() ); ((ChartForm*)parent())->drawElements(); } -void CanvasView::contentsMousePressEvent( TQMouseEvent *e ) +void CanvasView::contentsMousePressEvent( TQMouseEvent *e ) { TQCanvasItemList list = canvas()->collisions( e->pos() ); for ( TQCanvasItemList::iterator it = list.begin(); it != list.end(); ++it ) @@ -67,7 +67,7 @@ void CanvasView::contentsMo } -void CanvasView::contentsMouseMoveEvent( TQMouseEvent *e ) +void CanvasView::contentsMouseMoveEvent( TQMouseEvent *e ) { if ( m_movingItem ) { TQPoint offset = e->pos() - m_pos; diff --git a/doc/html/chart-chartform-cpp.html b/doc/html/chart-chartform-cpp.html index 1191d01e4..21429cc8b 100644 --- a/doc/html/chart-chartform-cpp.html +++ b/doc/html/chart-chartform-cpp.html @@ -39,7 +39,7 @@ body { background: #ffffff; color: black; } #include <tqaction.h> #include <ntqapplication.h> -#include <ntqcombobox.h> +#include <tqcombobox.h> #include <tqfile.h> #include <tqfiledialog.h> #include <tqfont.h> @@ -49,9 +49,9 @@ body { background: #ffffff; color: black; } #include <tqpixmap.h> #include <tqpopupmenu.h> #include <tqprinter.h> -#include <ntqradiobutton.h> +#include <tqradiobutton.h> #include <tqsettings.h> -#include <ntqspinbox.h> +#include <tqspinbox.h> #include <tqstatusbar.h> #include <tqtoolbar.h> #include <tqtoolbutton.h> @@ -457,7 +457,7 @@ void ChartForm::saveOptions() void ChartForm::optionsSetData() { SetDataForm *setDataForm = new SetDataForm( &m_elements, m_decimalPlaces, this ); - if ( setDataForm->exec() ) { + if ( setDataForm->exec() ) { m_changed = TRUE; drawElements(); } @@ -526,7 +526,7 @@ void ChartForm::optionsSetOptions() break; } optionsForm->decimalPlacesSpinBox->setValue( m_decimalPlaces ); - if ( optionsForm->exec() ) { + if ( optionsForm->exec() ) { setChartType( ChartType( optionsForm->chartTypeComboBox->currentItem()) ); m_font = optionsForm->font(); diff --git a/doc/html/chart-optionsform-cpp.html b/doc/html/chart-optionsform-cpp.html index a38061851..2cbe58572 100644 --- a/doc/html/chart-optionsform-cpp.html +++ b/doc/html/chart-optionsform-cpp.html @@ -35,15 +35,15 @@ body { background: #ffffff; color: black; }
#include "optionsform.h"
 
 #include <ntqbuttongroup.h>
-#include <ntqcombobox.h>
+#include <tqcombobox.h>
 #include <tqfontdialog.h>
 #include <ntqframe.h>
 #include <tqimage.h>
 #include <tqlabel.h>
 #include <ntqlayout.h>
-#include <ntqpushbutton.h>
-#include <ntqradiobutton.h>
-#include <ntqspinbox.h>
+#include <tqpushbutton.h>
+#include <tqradiobutton.h>
+#include <tqspinbox.h>
 
 #include "images/options_horizontalbarchart.xpm"
 #include "images/options_piechart.xpm"
@@ -52,7 +52,7 @@ body { background: #ffffff; color: black; }
 
 OptionsForm::OptionsForm( TQWidget* parent, const char* name,
                           bool modal, WFlags f )
-    : TQDialog( parent, name, modal, f )
+    : TQDialog( parent, name, modal, f )
 {
     setCaption( "Chart -- Options" );
     resize( 320, 290 );
@@ -64,18 +64,18 @@ body { background: #ffffff; color: black; }
     chartTypeTextLabel = new TQLabel( "&Chart Type", this );
     chartTypeLayout->addWidget( chartTypeTextLabel );
 
-    chartTypeComboBox = new TQComboBox( FALSE, this );
-    chartTypeComboBox->insertItem( TQPixmap( options_piechart ), "Pie Chart" );
-    chartTypeComboBox->insertItem( TQPixmap( options_verticalbarchart ),
+    chartTypeComboBox = new TQComboBox( FALSE, this );
+    chartTypeComboBox->insertItem( TQPixmap( options_piechart ), "Pie Chart" );
+    chartTypeComboBox->insertItem( TQPixmap( options_verticalbarchart ),
                                    "Vertical Bar Chart" );
-    chartTypeComboBox->insertItem( TQPixmap( options_horizontalbarchart ),
+    chartTypeComboBox->insertItem( TQPixmap( options_horizontalbarchart ),
                                    "Horizontal Bar Chart" );
     chartTypeLayout->addWidget( chartTypeComboBox );
     optionsFormLayout->addLayout( chartTypeLayout );
 
     fontLayout = new TQHBoxLayout( 0, 0, 6 );
 
-    fontPushButton = new TQPushButton( "&Font...", this );
+    fontPushButton = new TQPushButton( "&Font...", this );
     fontLayout->addWidget( fontPushButton );
     TQSpacerItem* spacer = new TQSpacerItem( 0, 0,
                                            TQSizePolicy::Expanding,
@@ -99,14 +99,14 @@ body { background: #ffffff; color: black; }
                                         addValuesButtonGroup->layout() );
     addValuesButtonGroupLayout->setAlignment( TQt::AlignTop );
 
-    noRadioButton = new TQRadioButton( "&No", addValuesButtonGroup );
-    noRadioButton->setChecked( TRUE );
+    noRadioButton = new TQRadioButton( "&No", addValuesButtonGroup );
+    noRadioButton->setChecked( TRUE );
     addValuesButtonGroupLayout->addWidget( noRadioButton );
 
-    yesRadioButton = new TQRadioButton( "&Yes", addValuesButtonGroup );
+    yesRadioButton = new TQRadioButton( "&Yes", addValuesButtonGroup );
     addValuesButtonGroupLayout->addWidget( yesRadioButton );
 
-    asPercentageRadioButton = new TQRadioButton( "As &Percentage",
+    asPercentageRadioButton = new TQRadioButton( "As &Percentage",
                                                 addValuesButtonGroup );
     addValuesButtonGroupLayout->addWidget( asPercentageRadioButton );
     addValuesFrameLayout->addWidget( addValuesButtonGroup );
@@ -116,9 +116,9 @@ body { background: #ffffff; color: black; }
     decimalPlacesTextLabel = new TQLabel( "&Decimal Places", addValuesFrame );
     decimalPlacesLayout->addWidget( decimalPlacesTextLabel );
 
-    decimalPlacesSpinBox = new TQSpinBox( addValuesFrame );
-    decimalPlacesSpinBox->setMinValue( 0 );
-    decimalPlacesSpinBox->setMaxValue( 9 );
+    decimalPlacesSpinBox = new TQSpinBox( addValuesFrame );
+    decimalPlacesSpinBox->setMinValue( 0 );
+    decimalPlacesSpinBox->setMaxValue( 9 );
     decimalPlacesLayout->addWidget( decimalPlacesSpinBox );
 
     addValuesFrameLayout->addLayout( decimalPlacesLayout );
@@ -130,17 +130,17 @@ body { background: #ffffff; color: black; }
                               TQSizePolicy::Expanding, TQSizePolicy::Minimum );
     buttonsLayout->addItem( spacer );
 
-    okPushButton = new TQPushButton( "OK", this );
-    okPushButton->setDefault( TRUE );
+    okPushButton = new TQPushButton( "OK", this );
+    okPushButton->setDefault( TRUE );
     buttonsLayout->addWidget( okPushButton );
 
-    cancelPushButton = new TQPushButton( "Cancel", this );
+    cancelPushButton = new TQPushButton( "Cancel", this );
     buttonsLayout->addWidget( cancelPushButton );
     optionsFormLayout->addLayout( buttonsLayout );
 
     connect( fontPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( chooseFont() ) );
-    connect( okPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
-    connect( cancelPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
+    connect( okPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
+    connect( cancelPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
 
     chartTypeTextLabel->setBuddy( chartTypeComboBox );
     decimalPlacesTextLabel->setBuddy( decimalPlacesSpinBox );
diff --git a/doc/html/chart-optionsform-h.html b/doc/html/chart-optionsform-h.html
index bec50c913..04cbcc141 100644
--- a/doc/html/chart-optionsform-h.html
+++ b/doc/html/chart-optionsform-h.html
@@ -35,7 +35,7 @@ body { background: #ffffff; color: black; }
 
#ifndef OPTIONSFORM_H
 #define OPTIONSFORM_H
 
-#include <ntqdialog.h>
+#include <tqdialog.h>
 
 class TQButtonGroup;
 class TQComboBox;
@@ -49,7 +49,7 @@ class TQSpinBox;
 class TQVBoxLayout;
 
 
-class OptionsForm : public TQDialog
+class OptionsForm : public TQDialog
 {
     TQ_OBJECT
 public:
@@ -61,18 +61,18 @@ public:
     void setFont( TQFont font );
 
     TQLabel *chartTypeTextLabel;
-    TQComboBox *chartTypeComboBox;
-    TQPushButton *fontPushButton;
+    TQComboBox *chartTypeComboBox;
+    TQPushButton *fontPushButton;
     TQLabel *fontTextLabel;
     TQFrame *addValuesFrame;
     TQButtonGroup *addValuesButtonGroup;
-    TQRadioButton *noRadioButton;
-    TQRadioButton *yesRadioButton;
-    TQRadioButton *asPercentageRadioButton;
+    TQRadioButton *noRadioButton;
+    TQRadioButton *yesRadioButton;
+    TQRadioButton *asPercentageRadioButton;
     TQLabel *decimalPlacesTextLabel;
-    TQSpinBox *decimalPlacesSpinBox;
-    TQPushButton *okPushButton;
-    TQPushButton *cancelPushButton;
+    TQSpinBox *decimalPlacesSpinBox;
+    TQPushButton *okPushButton;
+    TQPushButton *cancelPushButton;
 
 protected slots:
     void chooseFont();
diff --git a/doc/html/chart-setdataform-cpp.html b/doc/html/chart-setdataform-cpp.html
index 186ae6329..c181d80ee 100644
--- a/doc/html/chart-setdataform-cpp.html
+++ b/doc/html/chart-setdataform-cpp.html
@@ -36,10 +36,10 @@ body { background: #ffffff; color: black; }
 #include "chartform.h"
 
 #include <tqcolordialog.h>
-#include <ntqcombobox.h>
+#include <tqcombobox.h>
 #include <ntqlayout.h>
 #include <tqpixmap.h>
-#include <ntqpushbutton.h>
+#include <tqpushbutton.h>
 #include <ntqtable.h>
 
 #include "images/pattern01.xpm"
@@ -63,7 +63,7 @@ const int MAX_PATTERNS = 14;
 SetDataForm::SetDataForm( ElementVector *elements, int decimalPlaces,
                           TQWidget* parent,  const char* name,
                           bool modal, WFlags f )
-    : TQDialog( parent, name, modal, f )
+    : TQDialog( parent, name, modal, f )
 
 {
     m_elements = elements;
@@ -95,7 +95,7 @@ const int MAX_PATTERNS = 14;
 
     buttonBox = new TQHBoxLayout( 0, 0, 6, "button box layout" );
 
-    colorPushButton = new TQPushButton( this, "color button" );
+    colorPushButton = new TQPushButton( this, "color button" );
     colorPushButton->setText( "&Color..." );
     colorPushButton->setEnabled( FALSE );
     buttonBox->addWidget( colorPushButton );
@@ -104,12 +104,12 @@ const int MAX_PATTERNS = 14;
                                                  TQSizePolicy::Minimum );
     buttonBox->addItem( spacer );
 
-    okPushButton = new TQPushButton( this, "ok button" );
+    okPushButton = new TQPushButton( this, "ok button" );
     okPushButton->setText( "OK" );
-    okPushButton->setDefault( TRUE );
+    okPushButton->setDefault( TRUE );
     buttonBox->addWidget( okPushButton );
 
-    cancelPushButton = new TQPushButton( this, "cancel button" );
+    cancelPushButton = new TQPushButton( this, "cancel button" );
     cancelPushButton->setText( "Cancel" );
     cancelPushButton->setAccel( Key_Escape );
     buttonBox->addWidget( cancelPushButton );
@@ -123,8 +123,8 @@ const int MAX_PATTERNS = 14;
     connect( table, TQ_SIGNAL( valueChanged(int,int) ),
              this, TQ_SLOT( valueChanged(int,int) ) );
     connect( colorPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( setColor() ) );
-    connect( okPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
-    connect( cancelPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
+    connect( okPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
+    connect( cancelPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
 
     TQPixmap patterns[MAX_PATTERNS];
     patterns[0]  = TQPixmap( pattern01 );
@@ -159,10 +159,10 @@ const int MAX_PATTERNS = 14;
         table->setPixmap( i, 1, pix );
         table->setText( i, 1, color.name() );
 
-        TQComboBox *combobox = new TQComboBox;
+        TQComboBox *combobox = new TQComboBox;
         for ( int j = 0; j < MAX_PATTERNS; ++j )
-            combobox->insertItem( patterns[j] );
-        combobox->setCurrentItem( element.valuePattern() - 1 );
+            combobox->insertItem( patterns[j] );
+        combobox->setCurrentItem( element.valuePattern() - 1 );
         table->setCellWidget( i, 2, combobox );
 
         table->setText( i, 3, element.label() );
@@ -221,7 +221,7 @@ void SetDataForm::setColor( int row, int col )
 }
 
 
-void SetDataForm::accept()
+void SetDataForm::accept()
 {
     bool ok;
     for ( int i = 0; i < ChartForm::MAX_ELEMENTS; ++i ) {
@@ -238,7 +238,7 @@ void SetDataForm::accept()
         element.setLabelColor( TQColor( table->text( i, 4 ) ) );
     }
 
-    TQDialog::accept();
+    TQDialog::accept();
 }
 


diff --git a/doc/html/chart-setdataform-h.html b/doc/html/chart-setdataform-h.html index 25bdbae66..2d2514814 100644 --- a/doc/html/chart-setdataform-h.html +++ b/doc/html/chart-setdataform-h.html @@ -37,7 +37,7 @@ body { background: #ffffff; color: black; } #include "element.h" -#include <ntqdialog.h> +#include <tqdialog.h> class TQHBoxLayout; class TQPushButton; @@ -45,7 +45,7 @@ class TQTable; class TQVBoxLayout; -class SetDataForm: public TQDialog +class SetDataForm: public TQDialog { TQ_OBJECT public: @@ -65,9 +65,9 @@ protected slots: private: TQTable *table; - TQPushButton *colorPushButton; - TQPushButton *okPushButton; - TQPushButton *cancelPushButton; + TQPushButton *colorPushButton; + TQPushButton *okPushButton; + TQPushButton *cancelPushButton; protected: TQVBoxLayout *tableButtonBox; diff --git a/doc/html/checklists-example.html b/doc/html/checklists-example.html index 8c58cfa8d..40f7db55c 100644 --- a/doc/html/checklists-example.html +++ b/doc/html/checklists-example.html @@ -94,7 +94,7 @@ protected slots: #include <tqlabel.h> #include <tqvaluelist.h> #include <tqstring.h> -#include <ntqpushbutton.h> +#include <tqpushbutton.h> #include <ntqlayout.h> /* @@ -125,10 +125,10 @@ protected slots: // create a list with 4 ListViewItems which will be parent items of other ListViewItems TQValueList<TQListViewItem *> parentList; - parentList.append( new TQCheckListItem( lv1, "Parent Item 1", TQCheckListItem::CheckBoxController ) ); - parentList.append( new TQCheckListItem( lv1, "Parent Item 2", TQCheckListItem::CheckBoxController ) ); - parentList.append( new TQCheckListItem( lv1, "Parent Item 3", TQCheckListItem::CheckBoxController ) ); - parentList.append( new TQCheckListItem( lv1, "Parent Item 4", TQCheckListItem::CheckBoxController ) ); + parentList.append( new TQCheckListItem( lv1, "Parent Item 1", TQCheckListItem::CheckBoxController ) ); + parentList.append( new TQCheckListItem( lv1, "Parent Item 2", TQCheckListItem::CheckBoxController ) ); + parentList.append( new TQCheckListItem( lv1, "Parent Item 3", TQCheckListItem::CheckBoxController ) ); + parentList.append( new TQCheckListItem( lv1, "Parent Item 4", TQCheckListItem::CheckBoxController ) ); TQListViewItem *item = 0; unsigned int num = 1; @@ -138,7 +138,7 @@ protected slots: item = *it; // ...and create 5 checkable child ListViewItems for each parent item for ( unsigned int i = 1; i <= 5; i++ ) - (void)new TQCheckListItem( item, TQString( "%1. Child of Parent %2" ).arg( i ).arg( num ), TQCheckListItem::CheckBox ); + (void)new TQCheckListItem( item, TQString( "%1. Child of Parent %2" ).arg( i ).arg( num ), TQCheckListItem::CheckBox ); } // Create another widget for layouting @@ -146,7 +146,7 @@ protected slots: tmp->setMargin( 5 ); // create a pushbutton - TQPushButton *copy1 = new TQPushButton( " -> ", this ); + TQPushButton *copy1 = new TQPushButton( " -> ", this ); tmp->addWidget( copy1 ); copy1->setMaximumWidth( copy1->sizeHint().width() ); // connect the TQ_SIGNAL clicked() of the pushbutton with the TQ_SLOT copy1to2() @@ -170,7 +170,7 @@ protected slots: tmp->setMargin( 5 ); // create another pushbutton... - TQPushButton *copy2 = new TQPushButton( " -> ", this ); + TQPushButton *copy2 = new TQPushButton( " -> ", this ); lay->addWidget( copy2 ); copy2->setMaximumWidth( copy2->sizeHint().width() ); // ...and connect its clicked() TQ_SIGNAL to the copy2to3() TQ_SLOT @@ -200,7 +200,7 @@ void CheckLists::copy1to2() // Insert first a controller Item into the second ListView. Always if Radio-ListViewItems // are inserted into a Listview, the parent item of these MUST be a controller Item! - TQCheckListItem *item = new TQCheckListItem( lv2, "Controller", TQCheckListItem::Controller ); + TQCheckListItem *item = new TQCheckListItem( lv2, "Controller", TQCheckListItem::Controller ); item->setOpen( TRUE ); // iterate through the first ListView... @@ -210,10 +210,10 @@ void CheckLists::copy1to2() // ...if the item is checked... if ( ( (TQCheckListItem*)it.current() )->isOn() ) // ...insert a Radio-ListViewItem with the same text into the second ListView - (void)new TQCheckListItem( item, it.current()->text( 0 ), TQCheckListItem::RadioButton ); + (void)new TQCheckListItem( item, it.current()->text( 0 ), TQCheckListItem::RadioButton ); if ( item->firstChild() ) - ( ( TQCheckListItem* )item->firstChild() )->setOn( TRUE ); + ( ( TQCheckListItem* )item->firstChild() )->setOn( TRUE ); } /* diff --git a/doc/html/classchart.html b/doc/html/classchart.html index 02b72c770..2fb6c158e 100644 --- a/doc/html/classchart.html +++ b/doc/html/classchart.html @@ -131,29 +131,29 @@ body { background: #ffffff; color: black; } - + - - + + - - + + - + - + @@ -165,10 +165,10 @@ body { background: #ffffff; color: black; } - + - - + + @@ -183,21 +183,21 @@ body { background: #ffffff; color: black; } - + - + - + - - + + diff --git a/doc/html/classes.html b/doc/html/classes.html index 28b51d724..311febd6f 100644 --- a/doc/html/classes.html +++ b/doc/html/classes.html @@ -242,7 +242,7 @@ classes, see TQt's Main Classes.
J TQJisCodec -TQPushButton +TQPushButton TQThreadStorage
R -TQRadioButton +TQRadioButton TQTime
TQDragMoveEvent -TQLCDNumber +TQLCDNumber S -TQScrollBar +TQScrollBar TQToolTipGroup
TQLibrary -TQScrollView +TQScrollView TQTranslator
TQDropEvent -TQLineEdit +TQLineEdit TQSemaphore @@ -506,7 +506,7 @@ classes, see TQt's Main Classes. TQMap -TQSlider +TQSlider TQVariant
TQMessageBox -TQSpinBox +TQSpinBox TQWhatsThis
TQWidget
-TQCheckBox +TQCheckBox G TQGb18030Codec @@ -610,7 +610,7 @@ classes, see TQt's Main Classes. TQWidgetFactory
-TQCheckListItem +TQCheckListItem TQGb2312Codec @@ -621,7 +621,7 @@ classes, see TQt's Main Classes. TQWidgetItem
-TQCheckTableItem +TQCheckTableItem TQGbkCodec @@ -709,7 +709,7 @@ classes, see TQt's Main Classes.
-TQComboBox +TQComboBox TQGLWidget @@ -720,7 +720,7 @@ classes, see TQt's Main Classes.
-TQComboTableItem +TQComboTableItem TQGrid @@ -939,7 +939,7 @@ classes, see TQt's Main Classes.
-TQDial +TQDial TQIconFactory @@ -950,7 +950,7 @@ classes, see TQt's Main Classes.
-TQDialog +TQDialog TQIconSet diff --git a/doc/html/clientserver-example.html b/doc/html/clientserver-example.html index 01b0c33bd..18d58fa49 100644 --- a/doc/html/clientserver-example.html +++ b/doc/html/clientserver-example.html @@ -61,7 +61,7 @@ specified. You can send single lines to the server. #include <ntqvbox.h> #include <tqtextview.h> #include <tqlabel.h> -#include <ntqpushbutton.h> +#include <tqpushbutton.h> #include <tqtextstream.h> #include <stdlib.h> @@ -166,7 +166,7 @@ public: TQLabel *lb = new TQLabel( itext, this ); lb->setAlignment( AlignHCenter ); infoText = new TQTextView( this ); - TQPushButton *quit = new TQPushButton( tr("Quit") , this ); + TQPushButton *quit = new TQPushButton( tr("Quit") , this ); connect( server, TQ_SIGNAL(newConnect(ClientSocket*)), TQ_SLOT(newConnect(ClientSocket*)) ); @@ -227,9 +227,9 @@ int main( int argc, char** argv ) #include <ntqvbox.h> #include <ntqhbox.h> #include <tqtextview.h> -#include <ntqlineedit.h> +#include <tqlineedit.h> #include <tqlabel.h> -#include <ntqpushbutton.h> +#include <tqpushbutton.h> #include <tqtextstream.h> @@ -242,10 +242,10 @@ public: // GUI layout infoText = new TQTextView( this ); TQHBox *hb = new TQHBox( this ); - inputText = new TQLineEdit( hb ); - TQPushButton *send = new TQPushButton( tr("Send") , hb ); - TQPushButton *close = new TQPushButton( tr("Close connection") , this ); - TQPushButton *quit = new TQPushButton( tr("Quit") , this ); + inputText = new TQLineEdit( hb ); + TQPushButton *send = new TQPushButton( tr("Send") , hb ); + TQPushButton *close = new TQPushButton( tr("Close connection") , this ); + TQPushButton *quit = new TQPushButton( tr("Quit") , this ); connect( send, TQ_SIGNAL(clicked()), TQ_SLOT(sendToServer()) ); connect( close, TQ_SIGNAL(clicked()), TQ_SLOT(closeConnection()) ); @@ -289,8 +289,8 @@ private slots: { // write to the server TQTextStream os(socket); - os << inputText->text() << "\n"; - inputText->setText( "" ); + os << inputText->text() << "\n"; + inputText->setText( "" ); } void socketReadyRead() @@ -324,7 +324,7 @@ private slots: private: TQSocket *socket; TQTextView *infoText; - TQLineEdit *inputText; + TQLineEdit *inputText; }; diff --git a/doc/html/customlayout-example.html b/doc/html/customlayout-example.html index 61a72baa6..ca3f3ae53 100644 --- a/doc/html/customlayout-example.html +++ b/doc/html/customlayout-example.html @@ -759,7 +759,7 @@ CardLayout::~CardLayout() #include <tqlabel.h> #include <tqcolor.h> #include <ntqgroupbox.h> -#include <ntqpushbutton.h> +#include <tqpushbutton.h> #include <ntqmultilineedit.h> #include <tqcolor.h> @@ -772,12 +772,12 @@ int main( int argc, char **argv ) SimpleFlow *b1 = new SimpleFlow( gm ); - b1->add( new TQPushButton( "Short", f ) ); - b1->add( new TQPushButton( "Longer", f ) ); - b1->add( new TQPushButton( "Different text", f ) ); - b1->add( new TQPushButton( "More text", f ) ); - b1->add( new TQPushButton( "Even longer button text", f ) ); - TQPushButton* qb = new TQPushButton( "Quit", f ); + b1->add( new TQPushButton( "Short", f ) ); + b1->add( new TQPushButton( "Longer", f ) ); + b1->add( new TQPushButton( "Different text", f ) ); + b1->add( new TQPushButton( "More text", f ) ); + b1->add( new TQPushButton( "Even longer button text", f ) ); + TQPushButton* qb = new TQPushButton( "Quit", f ); a.connect( qb, TQ_SIGNAL( clicked() ), TQ_SLOT( quit() ) ); b1->add( qb ); @@ -785,16 +785,16 @@ int main( int argc, char **argv ) BorderLayout *large = new BorderLayout( wid ); large->setSpacing( 5 ); - large->addWidget( new TQPushButton( "North", wid ), BorderLayout::North ); - large->addWidget( new TQPushButton( "West", wid ), BorderLayout::West ); + large->addWidget( new TQPushButton( "North", wid ), BorderLayout::North ); + large->addWidget( new TQPushButton( "West", wid ), BorderLayout::West ); TQMultiLineEdit* m = new TQMultiLineEdit( wid ); m->setText( "Central\nWidget" ); large->addWidget( m, BorderLayout::Center ); - TQWidget *east1 = new TQPushButton( "East", wid ); + TQWidget *east1 = new TQPushButton( "East", wid ); large->addWidget( east1, BorderLayout::East ); - TQWidget *east2 = new TQPushButton( "East 2", wid ); + TQWidget *east2 = new TQPushButton( "East 2", wid ); large->addWidget( east2 , BorderLayout::East ); - large->addWidget( new TQPushButton( "South", wid ), BorderLayout::South ); + large->addWidget( new TQPushButton( "South", wid ), BorderLayout::South ); //Left-to-right tab order looks better: TQWidget::setTabOrder( east2, east1 ); gm->addWidget( wid ); diff --git a/doc/html/dclock-example.html b/doc/html/dclock-example.html index e33951470..3351f25e1 100644 --- a/doc/html/dclock-example.html +++ b/doc/html/dclock-example.html @@ -50,10 +50,10 @@ and date. #ifndef DCLOCK_H #define DCLOCK_H -#include <ntqlcdnumber.h> +#include <tqlcdnumber.h> -class DigitalClock : public TQLCDNumber // digital clock widget +class DigitalClock : public TQLCDNumber // digital clock widget { TQ_OBJECT public: @@ -100,7 +100,7 @@ private: // internal data // DigitalClock::DigitalClock( TQWidget *parent, const char *name ) - : TQLCDNumber( parent, name ) + : TQLCDNumber( parent, name ) { showingColon = FALSE; setFrameStyle( TQFrame::Panel | TQFrame::Raised ); @@ -150,7 +150,7 @@ void DigitalClock::showDate() TQDate date = TQDate::currentDate(); TQString s; s.sprintf( "%2d %2d", date.month(), date.day() ); - display( s ); // sets the LCD number/text + display( s ); // sets the LCD number/text showDateTimer = startTimer( 2000 ); // keep this state for 2 secs } @@ -177,7 +177,7 @@ void DigitalClock::showTime() s[2] = ' '; if ( s[0] == '0' ) s[0] = ' '; - display( s ); // set LCD number/text + display( s ); // set LCD number/text } diff --git a/doc/html/designer-manual-2.html b/doc/html/designer-manual-2.html index 81a5f8038..a575d8c13 100644 --- a/doc/html/designer-manual-2.html +++ b/doc/html/designer-manual-2.html @@ -95,7 +95,7 @@ body { background: #ffffff; color: black; }

Now we need to relate each of the text labels to the corresponding widget. We do this by creating "buddies".

-

A widget that does not accept focus itself, e.g. a TQLabel, can have an accelerator that will pass the focus to its "buddy", e.g. a TQLineEdit. In TQt Designer, we enable this by setting the first widget's buddy property to the name of the buddy widget.

+

A widget that does not accept focus itself, e.g. a TQLabel, can have an accelerator that will pass the focus to its "buddy", e.g. a TQLineEdit. In TQt Designer, we enable this by setting the first widget's buddy property to the name of the buddy widget.

Using this EditType ensures that the editor created with -createEditor() (by default a TQLineEdit) is always visible. This +createEditor() (by default a TQLineEdit) is always visible. This has implications for the alignment of the content: the default editor aligns everything (even numbers) to the left whilst numerical values in the cell are by default aligned to the right. @@ -191,7 +191,7 @@ in accordance with their EditType as described above. Creates a table item that is a child of table table with no text. The item has the EditType et. -

The table item will use a TQLineEdit for its editor, will not +

The table item will use a TQLineEdit for its editor, will not word-wrap and will occupy a single cell. Insert the table item into a table with TQTable::setItem().

The table takes ownership of the table item, so a table item @@ -201,7 +201,7 @@ should not be inserted into more than one table at a time. Creates a table item that is a child of table table with text text. The item has the EditType et. -

The table item will use a TQLineEdit for its editor, will not +

The table item will use a TQLineEdit for its editor, will not word-wrap and will occupy a single cell. Insert the table item into a table with TQTable::setItem().

The table takes ownership of the table item, so a table item @@ -212,7 +212,7 @@ should not be inserted into more than one table at a time. Creates a table item that is a child of table table with text text and pixmap p. The item has the EditType et.

The table item will display the pixmap to the left of the text. It -will use a TQLineEdit for editing the text, will not word-wrap and +will use a TQLineEdit for editing the text, will not word-wrap and will occupy a single cell. Insert the table item into a table with TQTable::setItem().

The table takes ownership of the table item, so a table item @@ -250,10 +250,10 @@ Returns the column span of the table item, usually 1. This virtual function creates an editor which the user can interact with to edit the cell's contents. The default -implementation creates a TQLineEdit. +implementation creates a TQLineEdit.

If the function returns 0, the cell is read-only.

The returned widget should preferably be invisible, ideally with -TQTable::viewport() as parent. +TQTable::viewport() as parent.

If you reimplement this function you'll almost certainly need to reimplement setContentFromEditor(), and may need to reimplement sizeHint(). @@ -262,7 +262,7 @@ reimplement setContentFromEditor(), and may

    TQWidget *ComboItem::createEditor() const
     {
         // create an editor - a combobox in our case
-        ( (ComboItem*)this )->cb = new TQComboBox( table()->viewport() );
+        ( (ComboItem*)this )->cb = new TQComboBox( table()->viewport() );
         TQObject::connect( cb, TQ_SIGNAL( activated( int ) ), table(), TQ_SLOT( doValueChanged() ) );
         cb->insertItem( "Yes" );
         cb->insertItem( "No" );
@@ -270,7 +270,7 @@ reimplement setContentFromEditor(), and may
         cb->setCurrentItem( text() == "No" ? 1 : 0 );
         return cb;
 
-

See also TQTable::createEditor(), setContentFromEditor(), TQTable::viewport(), and setReplaceable(). +

See also TQTable::createEditor(), setContentFromEditor(), TQTable::viewport(), and setReplaceable().

Example: table/statistics/statistics.cpp.

EditType TQTableItem::editType () const @@ -348,9 +348,9 @@ which for TQTableItems is 0. subclass returns a unique rtti() value. It is advisable to use values greater than 1000, preferably large random numbers, to allow for extensions to this class. -

See also TQCheckTableItem::rtti() and TQComboTableItem::rtti(). +

See also TQCheckTableItem::rtti() and TQComboTableItem::rtti(). -

Reimplemented in TQComboTableItem and TQCheckTableItem. +

Reimplemented in TQComboTableItem and TQCheckTableItem.

void TQTableItem::setCol ( int c ) [virtual]

Sets column c as the table item's column. Usually you will not @@ -366,7 +366,7 @@ Whenever the content of a cell has been edited by the editor w, TQTable calls this virtual function to copy the new values into the TQTableItem.

If you reimplement createEditor() and return something that is not -a TQLineEdit you will need to reimplement this function. +a TQLineEdit you will need to reimplement this function.

    void ComboItem::setContentFromEditor( TQWidget *w )
@@ -394,7 +394,7 @@ Sets pixmap p to be this item's pixmap.
 

Note that setPixmap() does not update the cell the table item belongs to. Use TQTable::updateCell() to repaint the cell's contents. -

For TQComboTableItems and TQCheckTableItems this function +

For TQComboTableItems and TQCheckTableItems this function has no visible effect.

See also TQTable::setPixmap(), pixmap(), and setText(). @@ -469,7 +469,7 @@ text.

  1. if the editMode() is Always, or
  2. if editMode() is not Always but the editor of the cell is -active and the editor is not a TQLineEdit. +active and the editor is not a TQLineEdit.

This means that text() returns the original text value of the item if the editor is a line edit, until the user commits an edit (e.g. diff --git a/doc/html/qwizard-h.html b/doc/html/qwizard-h.html index c72ed832c..defb82e87 100644 --- a/doc/html/qwizard-h.html +++ b/doc/html/qwizard-h.html @@ -79,7 +79,7 @@ body { background: #ffffff; color: black; } #ifndef QT_H -#include "ntqdialog.h" +#include "tqdialog.h" #endif // QT_H #ifndef TQT_NO_WIZARD diff --git a/doc/html/qwizard-members.html b/doc/html/qwizard-members.html index 61a192667..88dd0979d 100644 --- a/doc/html/qwizard-members.html +++ b/doc/html/qwizard-members.html @@ -37,7 +37,7 @@ body { background: #ffffff; color: black; }

diff --git a/doc/html/regexptester-example.html b/doc/html/regexptester-example.html index 0666ff806..c134421d4 100644 --- a/doc/html/regexptester-example.html +++ b/doc/html/regexptester-example.html @@ -48,7 +48,7 @@ comboboxes.

#ifndef REGEXPTESTER_H
 #define REGEXPTESTER_H
 
-#include <ntqdialog.h>
+#include <tqdialog.h>
 
 class TQCheckBox;
 class TQComboBox;
@@ -57,7 +57,7 @@ class TQPushButton;
 class TQStatusBar;
 class TQTable;
 
-class RegexpTester : public TQDialog
+class RegexpTester : public TQDialog
 {
     TQ_OBJECT
 
@@ -66,16 +66,16 @@ public:
                  WFlags f=0);
 
     TQLabel *regexLabel;
-    TQComboBox *regexComboBox;
+    TQComboBox *regexComboBox;
     TQLabel *textLabel;
-    TQComboBox *textComboBox;
-    TQCheckBox *caseSensitiveCheckBox;
-    TQCheckBox *minimalCheckBox;
-    TQCheckBox *wildcardCheckBox;
+    TQComboBox *textComboBox;
+    TQCheckBox *caseSensitiveCheckBox;
+    TQCheckBox *minimalCheckBox;
+    TQCheckBox *wildcardCheckBox;
     TQTable *resultTable;
-    TQPushButton *executePushButton;
-    TQPushButton *copyPushButton;
-    TQPushButton *quitPushButton;
+    TQPushButton *executePushButton;
+    TQPushButton *copyPushButton;
+    TQPushButton *quitPushButton;
     TQStatusBar *statusBar;
 
 public slots:
@@ -92,12 +92,12 @@ private:
 


Implementation:

#include <ntqapplication.h>
-#include <ntqcheckbox.h>
+#include <tqcheckbox.h>
 #include <tqclipboard.h>
-#include <ntqcombobox.h>
+#include <tqcombobox.h>
 #include <tqlabel.h>
 #include <ntqlayout.h>
-#include <ntqpushbutton.h>
+#include <tqpushbutton.h>
 #include <tqregexp.h>
 #include <tqstatusbar.h>
 #include <ntqtable.h>
@@ -107,32 +107,32 @@ private:
 
 RegexpTester::RegexpTester(TQWidget* parent, const char* name, bool modal,
                            WFlags f)
-    : TQDialog(parent, name, modal, f)
+    : TQDialog(parent, name, modal, f)
 {
     regexLabel = new TQLabel(this);
-    regexComboBox = new TQComboBox(this);
-    regexComboBox->setEditable(true);
+    regexComboBox = new TQComboBox(this);
+    regexComboBox->setEditable(true);
     regexComboBox->setSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Preferred);
     regexLabel->setBuddy(regexComboBox);
     textLabel = new TQLabel(this);
-    textComboBox = new TQComboBox(this);
-    textComboBox->setEditable(true);
+    textComboBox = new TQComboBox(this);
+    textComboBox->setEditable(true);
     textComboBox->setSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Preferred);
     textLabel->setBuddy(textComboBox);
-    caseSensitiveCheckBox = new TQCheckBox(this);
-    caseSensitiveCheckBox->setChecked(true);
-    minimalCheckBox = new TQCheckBox(this);
-    wildcardCheckBox = new TQCheckBox(this);
+    caseSensitiveCheckBox = new TQCheckBox(this);
+    caseSensitiveCheckBox->setChecked(true);
+    minimalCheckBox = new TQCheckBox(this);
+    wildcardCheckBox = new TQCheckBox(this);
     resultTable = new TQTable(3, 3, this);
     resultTable->verticalHeader()->hide();
     resultTable->setLeftMargin(0);
     resultTable->horizontalHeader()->hide();
     resultTable->setTopMargin(0);
     resultTable->setReadOnly(true);
-    executePushButton = new TQPushButton(this);
-    executePushButton->setDefault(true);
-    copyPushButton = new TQPushButton(this);
-    quitPushButton = new TQPushButton(this);
+    executePushButton = new TQPushButton(this);
+    executePushButton->setDefault(true);
+    copyPushButton = new TQPushButton(this);
+    quitPushButton = new TQPushButton(this);
     statusBar = new TQStatusBar(this);
 
     TQGridLayout *gridLayout = new TQGridLayout(2, 2, 6);
@@ -165,20 +165,20 @@ private:
 
     connect(copyPushButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(copy()));
     connect(executePushButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(execute()));
-    connect(quitPushButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(accept()));
+    connect(quitPushButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(accept()));
 
     execute();
 }
 
 void RegexpTester::execute()
 {
-    TQString regex = regexComboBox->currentText();
-    TQString text = textComboBox->currentText();
+    TQString regex = regexComboBox->currentText();
+    TQString text = textComboBox->currentText();
     if (!regex.isEmpty() && !text.isEmpty()) {
         TQRegExp re(regex);
-        re.setCaseSensitive(caseSensitiveCheckBox->isChecked());
-        re.setMinimal(minimalCheckBox->isChecked());
-        bool wildcard = wildcardCheckBox->isChecked();
+        re.setCaseSensitive(caseSensitiveCheckBox->isChecked());
+        re.setMinimal(minimalCheckBox->isChecked());
+        bool wildcard = wildcardCheckBox->isChecked();
         re.setWildcard(wildcard);
         if (!re.isValid()) {
             statusBar->message(tr("Invalid regular expression: %1")
@@ -243,7 +243,7 @@ void RegexpTester::execute()
 
 void RegexpTester::copy()
 {
-    TQString escaped = regexComboBox->currentText();
+    TQString escaped = regexComboBox->currentText();
     if (!escaped.isEmpty()) {
         escaped = escaped.replace("\\", "\\\\");
         TQClipboard *cb = TQApplication::clipboard();
@@ -259,9 +259,9 @@ void RegexpTester::languageChange()
 {
     setCaption(tr("Regex Tester"));
     regexLabel->setText(tr("&Regex:"));
-    regexComboBox->insertItem(tr("[A-Z]+=(\\d+):(\\d*)"));
+    regexComboBox->insertItem(tr("[A-Z]+=(\\d+):(\\d*)"));
     textLabel->setText(tr("&Text:"));
-    textComboBox->insertItem(tr("ABC=12:3456"));
+    textComboBox->insertItem(tr("ABC=12:3456"));
     caseSensitiveCheckBox->setText(tr("Case &Sensitive"));
     minimalCheckBox->setText(tr("&Minimal"));
     wildcardCheckBox->setText(tr("&Wildcard"));
@@ -281,7 +281,7 @@ int main(int argc, char **argv)
 {
     TQApplication app(argc, argv);
     RegexpTester form;
-    form.show();
+    form.show();
     app.connect(&app, TQ_SIGNAL(lastWindowClosed()), &app, TQ_SLOT(quit()));
     return app.exec();
 }
diff --git a/doc/html/richtext-example.html b/doc/html/richtext-example.html
index 119aaa472..e7f0867f3 100644
--- a/doc/html/richtext-example.html
+++ b/doc/html/richtext-example.html
@@ -65,7 +65,7 @@ public:
 
 protected:
     TQTextView *view;
-    TQPushButton *bClose, *bNext, *bPrev;
+    TQPushButton *bClose, *bNext, *bPrev;
     int num;
 
 protected slots:
@@ -93,7 +93,7 @@ protected slots:
 
 #include <ntqhbox.h>
 #include <ntqhbox.h>
-#include <ntqpushbutton.h>
+#include <tqpushbutton.h>
 #include <tqtextview.h>
 #include <tqbrush.h>
 #include <ntqapplication.h>
@@ -176,9 +176,9 @@ static const char* sayings[] = {
     TQHBox *buttons = new TQHBox( this );
     buttons->setMargin( 5 );
 
-    bClose = new TQPushButton( "&Close", buttons );
-    bPrev = new TQPushButton( "<< &Prev", buttons );
-    bNext = new TQPushButton( "&Next >>", buttons );
+    bClose = new TQPushButton( "&Close", buttons );
+    bPrev = new TQPushButton( "<< &Prev", buttons );
+    bNext = new TQPushButton( "&Next >>", buttons );
 
     bPrev->setEnabled( FALSE );
 
diff --git a/doc/html/rot-example.html b/doc/html/rot-example.html
index 8d283eaed..dad8dae48 100644
--- a/doc/html/rot-example.html
+++ b/doc/html/rot-example.html
@@ -92,7 +92,7 @@ private:
 #include "rot13.h"
 
 #include <ntqmultilineedit.h>
-#include <ntqpushbutton.h>
+#include <tqpushbutton.h>
 #include <ntqapplication.h>
 #include <ntqlayout.h>
 
@@ -103,7 +103,7 @@ private:
     connect( left, TQ_SIGNAL(textChanged()), this, TQ_SLOT(changeRight()) );
     connect( right, TQ_SIGNAL(textChanged()), this, TQ_SLOT(changeLeft()) );
 
-    TQPushButton * quit = new TQPushButton( "&Quit", this );
+    TQPushButton * quit = new TQPushButton( "&Quit", this );
     quit->setFocusPolicy( NoFocus );
     connect( quit, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) );
 
diff --git a/doc/html/scribble-example.html b/doc/html/scribble-example.html
index 6ea991fb2..232179dc8 100644
--- a/doc/html/scribble-example.html
+++ b/doc/html/scribble-example.html
@@ -113,7 +113,7 @@ public:
 protected:
     Canvas* canvas;
 
-    TQSpinBox *bPWidth;
+    TQSpinBox *bPWidth;
     TQToolButton *bPColor, *bSave, *bClear;
 
 protected slots:
@@ -146,7 +146,7 @@ protected slots:
 #include <tqpainter.h>
 #include <tqtoolbar.h>
 #include <tqtoolbutton.h>
-#include <ntqspinbox.h>
+#include <tqspinbox.h>
 #include <tqtooltip.h>
 #include <tqrect.h>
 #include <tqpoint.h>
@@ -265,10 +265,10 @@ void Canvas::clearScreen()
 
     tools->addSeparator();
 
-    bPWidth = new TQSpinBox( 1, 20, 1, tools );
+    bPWidth = new TQSpinBox( 1, 20, 1, tools );
     TQToolTip::add( bPWidth, "Choose Pen Width" );
-    connect( bPWidth, TQ_SIGNAL( valueChanged( int ) ), this, TQ_SLOT( slotWidth( int ) ) );
-    bPWidth->setValue( 3 );
+    connect( bPWidth, TQ_SIGNAL( valueChanged( int ) ), this, TQ_SLOT( slotWidth( int ) ) );
+    bPWidth->setValue( 3 );
 
     tools->addSeparator();
 
diff --git a/doc/html/scrollview-example.html b/doc/html/scrollview-example.html
index 9437e1d1e..c23b0321c 100644
--- a/doc/html/scrollview-example.html
+++ b/doc/html/scrollview-example.html
@@ -47,11 +47,11 @@ optimized for very large contents.
 **
 *****************************************************************************/
 
-#include <ntqscrollview.h>
+#include <tqscrollview.h>
 #include <ntqapplication.h>
 #include <tqmenubar.h>
 #include <tqpopupmenu.h>
-#include <ntqpushbutton.h>
+#include <tqpushbutton.h>
 #include <tqpainter.h>
 #include <tqpixmap.h>
 #include <ntqmessagebox.h>
@@ -82,7 +82,7 @@ public:
         int b=0;
         for (int y=0; y<2000-h; y+=h+10) {
             if (y == 0) {
-                TQButton* q=new TQPushButton("Quit", this);
+                TQButton* q=new TQPushButton("Quit", this);
                 connect(q, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()));
             } else {
                 TQString str;
@@ -92,7 +92,7 @@ public:
                     str = "I'm shrinking!";
                     ++b;
                 }
-                (new TQPushButton(str, this))->move(y/2,y);
+                (new TQPushButton(str, this))->move(y/2,y);
             }
         }
         resize(1000,2000);
@@ -118,11 +118,11 @@ signals:
     void clicked(int,int);
 };
 
-class BigMatrix : public TQScrollView {
+class BigMatrix : public TQScrollView {
     TQMultiLineEdit *dragging;
 public:
     BigMatrix(TQWidget* parent) :
-        TQScrollView(parent,"matrix", WStaticContents),
+        TQScrollView(parent,"matrix", WStaticContents),
         bg("bg.ppm")
     {
         bg.load("bg.ppm");
@@ -267,24 +267,24 @@ public:
         corn_id = vp_options->insertItem( "cornerWidget" );
 
         if (technique == 1) {
-            vp = new TQScrollView(this);
-            BigShrinker *bs = new BigShrinker(0);//(vp->viewport());
-            vp->addChild(bs);
+            vp = new TQScrollView(this);
+            BigShrinker *bs = new BigShrinker(0);//(vp->viewport());
+            vp->addChild(bs);
             bs->setAcceptDrops(TRUE);
             TQObject::connect(bs, TQ_SIGNAL(clicked(int,int)),
-                            vp, TQ_SLOT(center(int,int)));
+                            vp, TQ_SLOT(center(int,int)));
         } else {
             vp = new BigMatrix(this);
             if ( technique == 3 )
-                vp->enableClipper(TRUE);
+                vp->enableClipper(TRUE);
             srand(1);
             for (int i=0; i<30; i++) {
-                TQMultiLineEdit *l = new TQMultiLineEdit(vp->viewport(),"First");
+                TQMultiLineEdit *l = new TQMultiLineEdit(vp->viewport(),"First");
                 l->setText("Drag out more of these.");
                 l->resize(100,100);
-                vp->addChild(l, rand()%800, rand()%10000);
+                vp->addChild(l, rand()%800, rand()%10000);
             }
-            vp->viewport()->setBackgroundMode(NoBackground);
+            vp->viewport()->setBackgroundMode(NoBackground);
         }
 
         f_options = new TQPopupMenu( menubar );
@@ -355,20 +355,20 @@ private slots:
     void doVPMenuItem(int id)
     {
         if (id == vauto_id ) {
-            vp->setVScrollBarMode(TQScrollView::Auto);
+            vp->setVScrollBarMode(TQScrollView::Auto);
         } else if (id == vaoff_id) {
-            vp->setVScrollBarMode(TQScrollView::AlwaysOff);
+            vp->setVScrollBarMode(TQScrollView::AlwaysOff);
         } else if (id == vaon_id) {
-            vp->setVScrollBarMode(TQScrollView::AlwaysOn);
+            vp->setVScrollBarMode(TQScrollView::AlwaysOn);
         } else if (id == hauto_id) {
-            vp->setHScrollBarMode(TQScrollView::Auto);
+            vp->setHScrollBarMode(TQScrollView::Auto);
         } else if (id == haoff_id) {
-            vp->setHScrollBarMode(TQScrollView::AlwaysOff);
+            vp->setHScrollBarMode(TQScrollView::AlwaysOff);
         } else if (id == haon_id) {
-            vp->setHScrollBarMode(TQScrollView::AlwaysOn);
+            vp->setHScrollBarMode(TQScrollView::AlwaysOn);
         } else if (id == corn_id) {
-            bool corn = !vp->cornerWidget();
-            vp->setCornerWidget(corn ? corner : 0);
+            bool corn = !vp->cornerWidget();
+            vp->setCornerWidget(corn ? corner : 0);
         } else {
             return; // Not for us to process.
         }
@@ -377,17 +377,17 @@ private slots:
 
     void setVPMenuItems()
     {
-        TQScrollView::ScrollBarMode vm = vp->vScrollBarMode();
+        TQScrollView::ScrollBarMode vm = vp->vScrollBarMode();
         vp_options->setItemChecked( vauto_id, vm == TQScrollView::Auto );
         vp_options->setItemChecked( vaoff_id, vm == TQScrollView::AlwaysOff );
         vp_options->setItemChecked( vaon_id, vm == TQScrollView::AlwaysOn );
 
-        TQScrollView::ScrollBarMode hm = vp->hScrollBarMode();
+        TQScrollView::ScrollBarMode hm = vp->hScrollBarMode();
         vp_options->setItemChecked( hauto_id, hm == TQScrollView::Auto );
         vp_options->setItemChecked( haoff_id, hm == TQScrollView::AlwaysOff );
         vp_options->setItemChecked( haon_id, hm == TQScrollView::AlwaysOn );
 
-        vp_options->setItemChecked( corn_id, !!vp->cornerWidget() );
+        vp_options->setItemChecked( corn_id, !!vp->cornerWidget() );
     }
 
     void doFMenuItem(int id)
@@ -444,7 +444,7 @@ private slots:
     }
 
 private:
-    TQScrollView* vp;
+    TQScrollView* vp;
     TQPopupMenu* vp_options;
     TQPopupMenu* f_options;
     TQPopupMenu* lw_options;
diff --git a/doc/html/showimg-example.html b/doc/html/showimg-example.html
index ef2124b97..658556656 100644
--- a/doc/html/showimg-example.html
+++ b/doc/html/showimg-example.html
@@ -690,7 +690,7 @@ void ImageViewer::giveHelp()
         helpmsg = new TQMessageBox( "Help", helptext,
             TQMessageBox::Information, TQMessageBox::Ok, 0, 0, 0, 0, FALSE );
     }
-    helpmsg->show();
+    helpmsg->show();
     helpmsg->raise();
 }
 
@@ -784,7 +784,7 @@ void ImageViewer::setImage(const TQIma
 void ImageViewer::editText()
 {
     ImageTextEditor editor(image,this);
-    editor.exec();
+    editor.exec();
 }
 
 void ImageViewer::to1Bit()
diff --git a/doc/html/signalsandslots.html b/doc/html/signalsandslots.html
index 19e238065..116cd27b1 100644
--- a/doc/html/signalsandslots.html
+++ b/doc/html/signalsandslots.html
@@ -201,7 +201,7 @@ is emitted.
 and must not be implemented in the .cpp file. They can never have
 return types (i.e. use void).
 

A note about arguments. Our experience shows that signals and slots -are more reusable if they do not use special types. If TQScrollBar::valueChanged() were to use a special type such as the +are more reusable if they do not use special types. If TQScrollBar::valueChanged() were to use a special type such as the hypothetical TQRangeControl::Range, it could only be connected to slots designed specifically for TQRangeControl. Something as simple as the program in Tutorial #1 part 5 @@ -270,7 +270,7 @@ doesn't TQt use templates for signals and slots?.)

A Real Example

-

Here is a simple commented example (code fragments from ntqlcdnumber.h ). +

Here is a simple commented example (code fragments from tqlcdnumber.h ).

     #include "ntqframe.h"
     #include "tqbitarray.h"
@@ -278,7 +278,7 @@ doesn't TQt use templates for signals and slots?.)
     class TQLCDNumber : public TQFrame
 
-

TQLCDNumber inherits TQObject, which has most of the signal/slot +

TQLCDNumber inherits TQObject, which has most of the signal/slot knowledge, via TQFrame and TQWidget, and #include's the relevant declarations.

@@ -293,7 +293,7 @@ you have probably forgotten to run the moc or to
 include the moc output in the link command.
 

     public:
-        TQLCDNumber( TQWidget *parent=0, const char *name=0 );
+        TQLCDNumber( TQWidget *parent=0, const char *name=0 );
         TQLCDNumber( uint numDigits, TQWidget *parent=0, const char *name=0 );
 
@@ -308,7 +308,7 @@ ignores member functions. void overflow();
-

TQLCDNumber emits a signal when it is asked to show an impossible +

TQLCDNumber emits a signal when it is asked to show an impossible value.

If you don't care about overflow, or you know that overflow cannot occur, you can ignore the overflow() signal, i.e. don't connect it to @@ -334,7 +334,7 @@ indicates, to set the displayed number. Since display() is part of the class's interface with the rest of the program, the slot is public.

Several of the example programs connect the newValue() signal of a -TQScrollBar to the display() slot, so the LCD number continuously shows +TQScrollBar to the display() slot, so the LCD number continuously shows the value of the scroll bar.

Note that display() is overloaded; TQt will select the appropriate version when you connect a signal to the slot. With callbacks, you'd have to find diff --git a/doc/html/simple-font-demo-example.html b/doc/html/simple-font-demo-example.html index 4dc4addac..572a4d512 100644 --- a/doc/html/simple-font-demo-example.html +++ b/doc/html/simple-font-demo-example.html @@ -69,9 +69,9 @@ private: TQTextView * greetings; TQTextView * fontInfo; - TQPushButton * defaultButton; - TQPushButton * sansSerifButton; - TQPushButton * italicsButton; + TQPushButton * defaultButton; + TQPushButton * sansSerifButton; + TQPushButton * italicsButton; }; #endif @@ -85,7 +85,7 @@ private: #include <tqstring.h> #include <tqstringlist.h> #include <tqtextview.h> -#include <ntqpushbutton.h> +#include <tqpushbutton.h> #include <ntqlayout.h> Viewer::Viewer() @@ -107,19 +107,19 @@ private: setDefault(); - defaultButton = new TQPushButton( "Default", this, + defaultButton = new TQPushButton( "Default", this, "pushbutton1" ); defaultButton->setFont( TQFont( "times" ) ); connect( defaultButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( setDefault() ) ); - sansSerifButton = new TQPushButton( "Sans Serif", this, + sansSerifButton = new TQPushButton( "Sans Serif", this, "pushbutton2" ); sansSerifButton->setFont( TQFont( "Helvetica", 12 ) ); connect( sansSerifButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( setSansSerif() ) ); - italicsButton = new TQPushButton( "Italics", this, + italicsButton = new TQPushButton( "Italics", this, "pushbutton3" ); italicsButton->setFont( TQFont( "lucida", 12, TQFont::Bold, TRUE ) ); connect( italicsButton, TQ_SIGNAL( clicked() ), diff --git a/doc/html/small-table-example-example.html b/doc/html/small-table-example-example.html index a1d66d5bf..0ac7ce43a 100644 --- a/doc/html/small-table-example-example.html +++ b/doc/html/small-table-example-example.html @@ -83,12 +83,12 @@ int main( int argc, char **argv ) comboEntries << "one" << "two" << "three" << "four"; for ( int i = 0; i < numRows; ++i ){ - TQComboTableItem * item = new TQComboTableItem( &table, comboEntries, FALSE ); - item->setCurrentItem( i % 4 ); + TQComboTableItem * item = new TQComboTableItem( &table, comboEntries, FALSE ); + item->setCurrentItem( i % 4 ); table.setItem( i, 5, item ); } for ( int j = 0; j < numRows; ++j ) - table.setItem( j, 1, new TQCheckTableItem( &table, "Check me" ) ); + table.setItem( j, 1, new TQCheckTableItem( &table, "Check me" ) ); app.setMainWidget( &table ); table.show(); diff --git a/doc/html/sql-overview-custom1-main-cpp.html b/doc/html/sql-overview-custom1-main-cpp.html index 13961bb5f..6ae9969cf 100644 --- a/doc/html/sql-overview-custom1-main-cpp.html +++ b/doc/html/sql-overview-custom1-main-cpp.html @@ -46,9 +46,9 @@ body { background: #ffffff; color: black; } CustomEdit::CustomEdit( TQWidget *parent, const char *name ) : - TQLineEdit( parent, name ) + TQLineEdit( parent, name ) { - connect( this, TQ_SIGNAL(textChanged(const TQString &)), + connect( this, TQ_SIGNAL(textChanged(const TQString &)), this, TQ_SLOT(changed(const TQString &)) ); } @@ -79,9 +79,9 @@ TQString CustomEdit::upperLine() const TQLabel *surnameLabel = new TQLabel( "Surname:", this ); CustomEdit *surnameEdit = new CustomEdit( this ); TQLabel *salaryLabel = new TQLabel( "Salary:", this ); - TQLineEdit *salaryEdit = new TQLineEdit( this ); - salaryEdit->setAlignment( TQt::AlignRight ); - TQPushButton *saveButton = new TQPushButton( "&Save", this ); + TQLineEdit *salaryEdit = new TQLineEdit( this ); + salaryEdit->setAlignment( TQt::AlignRight ); + TQPushButton *saveButton = new TQPushButton( "&Save", this ); connect( saveButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(save()) ); TQGridLayout *grid = new TQGridLayout( this ); @@ -137,7 +137,7 @@ int main( int argc, char *argv[] ) return 1; FormDialog *formDialog = new FormDialog(); - formDialog->show(); + formDialog->show(); app.setMainWidget( formDialog ); return app.exec(); diff --git a/doc/html/sql-overview-custom1-main-h.html b/doc/html/sql-overview-custom1-main-h.html index 9087e3fd3..ecb617167 100644 --- a/doc/html/sql-overview-custom1-main-h.html +++ b/doc/html/sql-overview-custom1-main-h.html @@ -43,18 +43,18 @@ body { background: #ffffff; color: black; } *****************************************************************************/ #include <ntqapplication.h> -#include <ntqdialog.h> +#include <tqdialog.h> #include <tqlabel.h> #include <ntqlayout.h> -#include <ntqlineedit.h> -#include <ntqpushbutton.h> +#include <tqlineedit.h> +#include <tqpushbutton.h> #include <tqsqldatabase.h> #include <tqsqlcursor.h> #include <tqsqlform.h> #include <tqsqlpropertymap.h> #include "../connection.h" -class CustomEdit : public TQLineEdit +class CustomEdit : public TQLineEdit { TQ_OBJECT TQ_PROPERTY( TQString upperLine READ upperLine WRITE setUpperLine ) @@ -69,7 +69,7 @@ class CustomEdit : public TQLineEdit }; -class FormDialog : public TQDialog +class FormDialog : public TQDialog { TQ_OBJECT public: diff --git a/doc/html/sql-overview-form1-main-cpp.html b/doc/html/sql-overview-form1-main-cpp.html index 8f8dd8c91..122ced96f 100644 --- a/doc/html/sql-overview-form1-main-cpp.html +++ b/doc/html/sql-overview-form1-main-cpp.html @@ -43,16 +43,16 @@ body { background: #ffffff; color: black; } *****************************************************************************/ #include <ntqapplication.h> -#include <ntqdialog.h> +#include <tqdialog.h> #include <tqlabel.h> #include <ntqlayout.h> -#include <ntqlineedit.h> +#include <tqlineedit.h> #include <tqsqldatabase.h> #include <tqsqlcursor.h> #include <tqsqlform.h> #include "../connection.h" -class FormDialog : public TQDialog +class FormDialog : public TQDialog { public: FormDialog(); @@ -66,7 +66,7 @@ class FormDialog : public TQDialog TQLabel *surnameLabel = new TQLabel( "Surname:", this ); TQLabel *surnameDisplay = new TQLabel( this ); TQLabel *salaryLabel = new TQLabel( "Salary:", this ); - TQLineEdit *salaryEdit = new TQLineEdit( this ); + TQLineEdit *salaryEdit = new TQLineEdit( this ); TQGridLayout *grid = new TQGridLayout( this ); grid->addWidget( forenameLabel, 0, 0 ); @@ -97,7 +97,7 @@ int main( int argc, char *argv[] ) if ( ! createConnections() ) return 1; FormDialog *formDialog = new FormDialog(); - formDialog->show(); + formDialog->show(); app.setMainWidget( formDialog ); return app.exec(); diff --git a/doc/html/sql-overview-form2-main-h.html b/doc/html/sql-overview-form2-main-h.html index 7c235e3ae..fbc20a1fb 100644 --- a/doc/html/sql-overview-form2-main-h.html +++ b/doc/html/sql-overview-form2-main-h.html @@ -43,17 +43,17 @@ body { background: #ffffff; color: black; } *****************************************************************************/ #include <ntqapplication.h> -#include <ntqdialog.h> +#include <tqdialog.h> #include <tqlabel.h> #include <ntqlayout.h> -#include <ntqlineedit.h> -#include <ntqpushbutton.h> +#include <tqlineedit.h> +#include <tqpushbutton.h> #include <tqsqldatabase.h> #include <tqsqlcursor.h> #include <tqsqlform.h> #include "../connection.h" -class FormDialog : public TQDialog +class FormDialog : public TQDialog { TQ_OBJECT public: diff --git a/doc/html/sql-overview-table3-main-cpp.html b/doc/html/sql-overview-table3-main-cpp.html index 987f6ff0c..338d908e2 100644 --- a/doc/html/sql-overview-table3-main-cpp.html +++ b/doc/html/sql-overview-table3-main-cpp.html @@ -46,14 +46,14 @@ body { background: #ffffff; color: black; } #include <tqdatatable.h> StatusPicker::StatusPicker( TQWidget *parent, const char *name ) - : TQComboBox( parent, name ) + : TQComboBox( parent, name ) { TQSqlCursor cur( "status" ); cur.select( cur.index( "name" ) ); int i = 0; while ( cur.next() ) { - insertItem( cur.value( "name" ).toString(), i ); + insertItem( cur.value( "name" ).toString(), i ); index2id[i] = cur.value( "id" ).toInt(); i++; } diff --git a/doc/html/sql-overview-table3-main-h.html b/doc/html/sql-overview-table3-main-h.html index 352004991..cc5891653 100644 --- a/doc/html/sql-overview-table3-main-h.html +++ b/doc/html/sql-overview-table3-main-h.html @@ -43,7 +43,7 @@ body { background: #ffffff; color: black; } *****************************************************************************/ #include <ntqapplication.h> -#include <ntqcombobox.h> +#include <tqcombobox.h> #include <tqmap.h> #include <tqsqldatabase.h> #include <tqsqlcursor.h> @@ -51,7 +51,7 @@ body { background: #ffffff; color: black; } #include <tqsqlpropertymap.h> #include "../connection.h" -class StatusPicker : public TQComboBox +class StatusPicker : public TQComboBox { TQ_OBJECT TQ_PROPERTY( int statusid READ statusId WRITE setStatusId ) diff --git a/doc/html/sql-overview-table4-main-cpp.html b/doc/html/sql-overview-table4-main-cpp.html index dc5ab08f6..79acf6461 100644 --- a/doc/html/sql-overview-table4-main-cpp.html +++ b/doc/html/sql-overview-table4-main-cpp.html @@ -46,14 +46,14 @@ body { background: #ffffff; color: black; } StatusPicker::StatusPicker( TQWidget *parent, const char *name ) - : TQComboBox( parent, name ) + : TQComboBox( parent, name ) { TQSqlCursor cur( "status" ); cur.select( cur.index( "name" ) ); int i = 0; while ( cur.next() ) { - insertItem( cur.value( "name" ).toString(), i ); + insertItem( cur.value( "name" ).toString(), i ); index2id[i] = cur.value( "id" ).toInt(); i++; } diff --git a/doc/html/sql-overview-table4-main-h.html b/doc/html/sql-overview-table4-main-h.html index f0c934f02..4f72e6b8d 100644 --- a/doc/html/sql-overview-table4-main-h.html +++ b/doc/html/sql-overview-table4-main-h.html @@ -43,7 +43,7 @@ body { background: #ffffff; color: black; } *****************************************************************************/ #include <ntqapplication.h> -#include <ntqcombobox.h> +#include <tqcombobox.h> #include <tqmap.h> #include <tqpainter.h> #include <tqsqldatabase.h> @@ -53,7 +53,7 @@ body { background: #ffffff; color: black; } #include <tqdatatable.h> #include "../connection.h" -class StatusPicker : public TQComboBox +class StatusPicker : public TQComboBox { TQ_OBJECT TQ_PROPERTY( int statusid READ statusId WRITE setStatusId ) diff --git a/doc/html/sql.html b/doc/html/sql.html index 4b170081f..a88b8cbf7 100644 --- a/doc/html/sql.html +++ b/doc/html/sql.html @@ -1024,16 +1024,16 @@ the code below can be automatically generated by

    #include <ntqapplication.h>
-    #include <ntqdialog.h>
+    #include <tqdialog.h>
     #include <tqlabel.h>
     #include <ntqlayout.h>
-    #include <ntqlineedit.h>
+    #include <tqlineedit.h>
     #include <tqsqldatabase.h>
     #include <tqsqlcursor.h>
     #include <tqsqlform.h>
     #include "../connection.h"
 
-    class FormDialog : public TQDialog
+    class FormDialog : public TQDialog
     {
         public:
             FormDialog();
@@ -1046,7 +1046,7 @@ the code below can be automatically generated by 
         TQLabel *surnameLabel    = new TQLabel( "Surname:", this );
         TQLabel *surnameDisplay  = new TQLabel( this );
         TQLabel *salaryLabel     = new TQLabel( "Salary:", this );
-        TQLineEdit *salaryEdit   = new TQLineEdit( this );
+        TQLineEdit *salaryEdit   = new TQLineEdit( this );
 
         TQGridLayout *grid = new TQGridLayout( this );
         grid->addWidget( forenameLabel,     0, 0 );
@@ -1076,7 +1076,7 @@ the code below can be automatically generated by 
         if ( ! createConnections() ) return 1;
 
         FormDialog *formDialog = new FormDialog();
-        formDialog->show();
+        formDialog->show();
         app.setMainWidget( formDialog );
 
         return app.exec();
@@ -1086,8 +1086,8 @@ the code below can be automatically generated by 
 

We include the header files for the widgets that we need. We also include tqsqldatabase.h and tqsqlcursor.h as usual, but we now add tqsqlform.h. -

The form will be presented as a dialog so we subclass TQDialog with -our own FormDialog class. We use a TQLineEdit for the salary so that +

The form will be presented as a dialog so we subclass TQDialog with +our own FormDialog class. We use a TQLineEdit for the salary so that the user can change it. All the widgets are laid out using a grid.

We create a cursor on the staff table, select all records and move to the first record. @@ -1115,7 +1115,7 @@ view of a record: differences.

-

    class FormDialog : public TQDialog
+
    class FormDialog : public TQDialog
     {
         TQ_OBJECT
         public:
@@ -1142,15 +1142,15 @@ confirm their update. We also hold pointers to the TQ
 right pad the fields are removed when the fields are retrieved.
 

Properties that we might wish to apply to fields, such as alignment and validation are achieved in the conventional way, for example, by -calling TQLineEdit::setAlignment() and TQLineEdit::setValidator(). -

        TQLineEdit   *forenameEdit  = new TQLineEdit( this );
+calling TQLineEdit::setAlignment() and TQLineEdit::setValidator().
+

        TQLineEdit   *forenameEdit  = new TQLineEdit( this );
 
-

        TQPushButton *saveButton    = new TQPushButton( "&Save", this );
+

        TQPushButton *saveButton    = new TQPushButton( "&Save", this );
         connect( saveButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(save()) );
 

The FormDialog constructor is similar to the one in the previous example. We have changed the forename and surname widgets to -TQLineEdits to make them editable and have added a TQPushButton +TQLineEdits to make them editable and have added a TQPushButton the user can click to save their updates.

        grid->addWidget( saveButton,    3, 0 );
 
@@ -1171,7 +1171,7 @@ cursor's update buffer. sqlForm->insert( salaryEdit, "salary" ); sqlForm->readFields();
-

Now we link the buffer's fields to the TQLineEdit controls. (In the +

Now we link the buffer's fields to the TQLineEdit controls. (In the previous example we linked the cursor's fields.) The edit controls are populated by the readFields() call as before.

    FormDialog::~FormDialog()
@@ -1214,7 +1214,7 @@ data.
 we will only cover the differences here. The full source is in sql/overview/custom1/main.h and sql/overview/custom1/main.cpp
 

-

    class CustomEdit : public TQLineEdit
+
    class CustomEdit : public TQLineEdit
     {
         TQ_OBJECT
         TQ_PROPERTY( TQString upperLine READ upperLine WRITE setUpperLine )
@@ -1228,7 +1228,7 @@ we will only cover the differences here. The full source is in TQString upperLineText;
     };
 
-

We've created a simple subclass of TQLineEdit and added a property, +

We've created a simple subclass of TQLineEdit and added a property, upperLineText, which will hold an uppercase version of the text. We also created a slot, changed().

            TQSqlPropertyMap *propMap;
@@ -1238,9 +1238,9 @@ to our FormDialog's private data.
 

    CustomEdit::CustomEdit( TQWidget *parent, const char *name ) :
-        TQLineEdit( parent, name )
+        TQLineEdit( parent, name )
     {
-        connect( this, TQ_SIGNAL(textChanged(const TQString &)),
+        connect( this, TQ_SIGNAL(textChanged(const TQString &)),
                  this, TQ_SLOT(changed(const TQString &)) );
     }
 
@@ -1268,7 +1268,7 @@ CustomEdit instances directly to database fields.

        CustomEdit  *surnameEdit    = new CustomEdit( this );
 

We use the same FormDialog as we did before, but this time replace two -of the TQLineEdit widgets with our own CustomEdit widgets. +of the TQLineEdit widgets with our own CustomEdit widgets.

Laying out the grid and setting up the cursor is the same as before.

        propMap = new TQSqlPropertyMap;
         propMap->insert( forenameEdit->className(), "upperLine" );
@@ -1291,11 +1291,11 @@ our CustomEdit widget.
 
 

We must reimpliment TQSqlEditorFactory to use custom editor widgets in tables. In the following example we will create a custom editor based -on TQComboBox and a TQSqlEditorFactory subclass to show how a TQDataTable +on TQComboBox and a TQSqlEditorFactory subclass to show how a TQDataTable can use a custom editor.

-

    class StatusPicker : public TQComboBox
+
    class StatusPicker : public TQComboBox
     {
         TQ_OBJECT
         TQ_PROPERTY( int statusid READ statusId WRITE setStatusId )
@@ -1324,14 +1324,14 @@ function since that is the only function we need to reimplement.
 

    StatusPicker::StatusPicker( TQWidget *parent, const char *name )
-        : TQComboBox( parent, name )
+        : TQComboBox( parent, name )
     {
         TQSqlCursor cur( "status" );
         cur.select( cur.index( "name" ) );
 
         int i = 0;
         while ( cur.next() ) {
-            insertItem( cur.value( "name" ).toString(), i );
+            insertItem( cur.value( "name" ).toString(), i );
             index2id[i] = cur.value( "id" ).toInt();
             i++;
         }
diff --git a/doc/html/statistics-example.html b/doc/html/statistics-example.html
index 92b04e059..3a032d538 100644
--- a/doc/html/statistics-example.html
+++ b/doc/html/statistics-example.html
@@ -50,7 +50,7 @@ Another TQTable example.
 #define STATISTICS_H
 
 #include <ntqtable.h>
-#include <ntqcombobox.h>
+#include <tqcombobox.h>
 
 class TableItem : public TQTableItem
 {
@@ -68,7 +68,7 @@ public:
     void setText( const TQString &s );
 
 private:
-    TQComboBox *cb;
+    TQComboBox *cb;
 
 };
 
@@ -108,7 +108,7 @@ private:
 #include <tqdir.h>
 #include <tqstringlist.h>
 #include <ntqheader.h>
-#include <ntqcombobox.h>
+#include <tqcombobox.h>
 #include <stdlib.h>
 
 const char* dirs[] = {
@@ -235,7 +235,7 @@ void Table::recalcSum( int, int col )
 TQWidget *ComboItem::createEditor() const
 {
     // create an editor - a combobox in our case
-    ( (ComboItem*)this )->cb = new TQComboBox( table()->viewport() );
+    ( (ComboItem*)this )->cb = new TQComboBox( table()->viewport() );
     TQObject::connect( cb, TQ_SIGNAL( activated( int ) ), table(), TQ_SLOT( doValueChanged() ) );
     cb->insertItem( "Yes" );
     cb->insertItem( "No" );
diff --git a/doc/html/t10-lcdrange-cpp.html b/doc/html/t10-lcdrange-cpp.html
index 0364aa5f4..364ef44fe 100644
--- a/doc/html/t10-lcdrange-cpp.html
+++ b/doc/html/t10-lcdrange-cpp.html
@@ -40,19 +40,19 @@ body { background: #ffffff; color: black; }
 
 #include "lcdrange.h"
 
-#include <ntqslider.h>
-#include <ntqlcdnumber.h>
+#include <tqslider.h>
+#include <tqlcdnumber.h>
 
 LCDRange::LCDRange( TQWidget *parent, const char *name )
         : TQVBox( parent, name )
 {
-    TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
-    slider = new TQSlider( Horizontal, this, "slider" );
+    TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
+    slider = new TQSlider( Horizontal, this, "slider" );
     slider->setRange( 0, 99 );
-    slider->setValue( 0 );
-    connect( slider, TQ_SIGNAL(valueChanged(int)),
-             lcd, TQ_SLOT(display(int)) );
-    connect( slider, TQ_SIGNAL(valueChanged(int)),
+    slider->setValue( 0 );
+    connect( slider, TQ_SIGNAL(valueChanged(int)),
+             lcd, TQ_SLOT(display(int)) );
+    connect( slider, TQ_SIGNAL(valueChanged(int)),
              TQ_SIGNAL(valueChanged(int)) );
 
     setFocusProxy( slider );
@@ -60,12 +60,12 @@ body { background: #ffffff; color: black; }
 
 int LCDRange::value() const
 {
-    return slider->value();
+    return slider->value();
 }
 
 void LCDRange::setValue( int value )
 {
-    slider->setValue( value );
+    slider->setValue( value );
 }
 
 void LCDRange::setRange( int minVal, int maxVal )
diff --git a/doc/html/t10-lcdrange-h.html b/doc/html/t10-lcdrange-h.html
index b9b27fea7..ecd052817 100644
--- a/doc/html/t10-lcdrange-h.html
+++ b/doc/html/t10-lcdrange-h.html
@@ -62,7 +62,7 @@ signals:
     void valueChanged( int );
 
 private:
-    TQSlider  *slider;
+    TQSlider  *slider;
 };
 
 
diff --git a/doc/html/t10-main-cpp.html b/doc/html/t10-main-cpp.html
index 55f66b0fe..82b82d5cc 100644
--- a/doc/html/t10-main-cpp.html
+++ b/doc/html/t10-main-cpp.html
@@ -39,8 +39,8 @@ body { background: #ffffff; color: black; }
 ****************************************************************/
 
 #include <ntqapplication.h>
-#include <ntqpushbutton.h>
-#include <ntqlcdnumber.h>
+#include <tqpushbutton.h>
+#include <tqlcdnumber.h>
 #include <tqfont.h>
 #include <ntqlayout.h>
 
@@ -58,7 +58,7 @@ public:
 MyWidget::MyWidget( TQWidget *parent, const char *name )
         : TQWidget( parent, name )
 {
-    TQPushButton *quit = new TQPushButton( "&Quit", this, "quit" );
+    TQPushButton *quit = new TQPushButton( "&Quit", this, "quit" );
     quit->setFont( TQFont( "Times", 18, TQFont::Bold ) );
 
     connect( quit, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) );
diff --git a/doc/html/t11-lcdrange-cpp.html b/doc/html/t11-lcdrange-cpp.html
index 4a2e92976..9e2327595 100644
--- a/doc/html/t11-lcdrange-cpp.html
+++ b/doc/html/t11-lcdrange-cpp.html
@@ -40,19 +40,19 @@ body { background: #ffffff; color: black; }
 
 #include "lcdrange.h"
 
-#include <ntqslider.h>
-#include <ntqlcdnumber.h>
+#include <tqslider.h>
+#include <tqlcdnumber.h>
 
 LCDRange::LCDRange( TQWidget *parent, const char *name )
         : TQVBox( parent, name )
 {
-    TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
-    slider = new TQSlider( Horizontal, this, "slider" );
+    TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
+    slider = new TQSlider( Horizontal, this, "slider" );
     slider->setRange( 0, 99 );
-    slider->setValue( 0 );
-    connect( slider, TQ_SIGNAL(valueChanged(int)),
-             lcd, TQ_SLOT(display(int)) );
-    connect( slider, TQ_SIGNAL(valueChanged(int)),
+    slider->setValue( 0 );
+    connect( slider, TQ_SIGNAL(valueChanged(int)),
+             lcd, TQ_SLOT(display(int)) );
+    connect( slider, TQ_SIGNAL(valueChanged(int)),
              TQ_SIGNAL(valueChanged(int)) );
 
     setFocusProxy( slider );
@@ -60,12 +60,12 @@ body { background: #ffffff; color: black; }
 
 int LCDRange::value() const
 {
-    return slider->value();
+    return slider->value();
 }
 
 void LCDRange::setValue( int value )
 {
-    slider->setValue( value );
+    slider->setValue( value );
 }
 
 void LCDRange::setRange( int minVal, int maxVal )
diff --git a/doc/html/t11-lcdrange-h.html b/doc/html/t11-lcdrange-h.html
index d382fde58..6e02b61e2 100644
--- a/doc/html/t11-lcdrange-h.html
+++ b/doc/html/t11-lcdrange-h.html
@@ -62,7 +62,7 @@ signals:
     void valueChanged( int );
 
 private:
-    TQSlider  *slider;
+    TQSlider  *slider;
 };
 
 
diff --git a/doc/html/t11-main-cpp.html b/doc/html/t11-main-cpp.html
index a05267f03..ce49957aa 100644
--- a/doc/html/t11-main-cpp.html
+++ b/doc/html/t11-main-cpp.html
@@ -39,8 +39,8 @@ body { background: #ffffff; color: black; }
 ****************************************************************/
 
 #include <ntqapplication.h>
-#include <ntqpushbutton.h>
-#include <ntqlcdnumber.h>
+#include <tqpushbutton.h>
+#include <tqlcdnumber.h>
 #include <tqfont.h>
 #include <ntqlayout.h>
 
@@ -58,7 +58,7 @@ public:
 MyWidget::MyWidget( TQWidget *parent, const char *name )
         : TQWidget( parent, name )
 {
-    TQPushButton *quit = new TQPushButton( "&Quit", this, "quit" );
+    TQPushButton *quit = new TQPushButton( "&Quit", this, "quit" );
     quit->setFont( TQFont( "Times", 18, TQFont::Bold ) );
 
     connect( quit, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) );
@@ -81,7 +81,7 @@ public:
     connect( cannonField, TQ_SIGNAL(forceChanged(int)),
              force, TQ_SLOT(setValue(int)) );
 
-    TQPushButton *shoot = new TQPushButton( "&Shoot", this, "shoot" );
+    TQPushButton *shoot = new TQPushButton( "&Shoot", this, "shoot" );
     shoot->setFont( TQFont( "Times", 18, TQFont::Bold ) );
 
     connect( shoot, TQ_SIGNAL(clicked()), cannonField, TQ_SLOT(shoot()) );
diff --git a/doc/html/t12-lcdrange-cpp.html b/doc/html/t12-lcdrange-cpp.html
index 288d23ec2..32bc0135e 100644
--- a/doc/html/t12-lcdrange-cpp.html
+++ b/doc/html/t12-lcdrange-cpp.html
@@ -40,8 +40,8 @@ body { background: #ffffff; color: black; }
 
 #include "lcdrange.h"
 
-#include <ntqslider.h>
-#include <ntqlcdnumber.h>
+#include <tqslider.h>
+#include <tqlcdnumber.h>
 #include <tqlabel.h>
 
 
@@ -63,17 +63,17 @@ LCDRange::LCDRange( const char *s, TQWidget *parent,
 
 void LCDRange::init()
 {
-    TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
-    slider = new TQSlider( Horizontal, this, "slider" );
+    TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
+    slider = new TQSlider( Horizontal, this, "slider" );
     slider->setRange( 0, 99 );
-    slider->setValue( 0 );
+    slider->setValue( 0 );
 
     label = new TQLabel( " ", this, "label"  );
     label->setAlignment( AlignCenter );
 
-    connect( slider, TQ_SIGNAL(valueChanged(int)),
-             lcd, TQ_SLOT(display(int)) );
-    connect( slider, TQ_SIGNAL(valueChanged(int)),
+    connect( slider, TQ_SIGNAL(valueChanged(int)),
+             lcd, TQ_SLOT(display(int)) );
+    connect( slider, TQ_SIGNAL(valueChanged(int)),
              TQ_SIGNAL(valueChanged(int)) );
 
     setFocusProxy( slider );
@@ -82,7 +82,7 @@ void LCDRange::init()
 
 int LCDRange::value() const
 {
-    return slider->value();
+    return slider->value();
 }
 
 
@@ -94,7 +94,7 @@ const char *LCDRange::text() const
 
 void LCDRange::setValue( int value )
 {
-    slider->setValue( value );
+    slider->setValue( value );
 }
 
 
diff --git a/doc/html/t12-lcdrange-h.html b/doc/html/t12-lcdrange-h.html
index 62f57870d..fdc0bc425 100644
--- a/doc/html/t12-lcdrange-h.html
+++ b/doc/html/t12-lcdrange-h.html
@@ -69,7 +69,7 @@ signals:
 private:
     void init();
 
-    TQSlider     *slider;
+    TQSlider     *slider;
     TQLabel      *label;
 };
 
diff --git a/doc/html/t12-main-cpp.html b/doc/html/t12-main-cpp.html
index f49b697c2..8abd2c9c2 100644
--- a/doc/html/t12-main-cpp.html
+++ b/doc/html/t12-main-cpp.html
@@ -39,8 +39,8 @@ body { background: #ffffff; color: black; }
 ****************************************************************/
 
 #include <ntqapplication.h>
-#include <ntqpushbutton.h>
-#include <ntqlcdnumber.h>
+#include <tqpushbutton.h>
+#include <tqlcdnumber.h>
 #include <tqfont.h>
 #include <ntqlayout.h>
 
@@ -58,7 +58,7 @@ public:
 MyWidget::MyWidget( TQWidget *parent, const char *name )
         : TQWidget( parent, name )
 {
-    TQPushButton *quit = new TQPushButton( "&Quit", this, "quit" );
+    TQPushButton *quit = new TQPushButton( "&Quit", this, "quit" );
     quit->setFont( TQFont( "Times", 18, TQFont::Bold ) );
 
     connect( quit, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) );
@@ -81,7 +81,7 @@ public:
     connect( cannonField, TQ_SIGNAL(forceChanged(int)),
              force, TQ_SLOT(setValue(int)) );
 
-    TQPushButton *shoot = new TQPushButton( "&Shoot", this, "shoot" );
+    TQPushButton *shoot = new TQPushButton( "&Shoot", this, "shoot" );
     shoot->setFont( TQFont( "Times", 18, TQFont::Bold ) );
 
     connect( shoot, TQ_SIGNAL(clicked()), cannonField, TQ_SLOT(shoot()) );
diff --git a/doc/html/t13-gamebrd-cpp.html b/doc/html/t13-gamebrd-cpp.html
index d1140eb88..34186e59b 100644
--- a/doc/html/t13-gamebrd-cpp.html
+++ b/doc/html/t13-gamebrd-cpp.html
@@ -43,8 +43,8 @@ body { background: #ffffff; color: black; }
 #include <tqfont.h>
 #include <ntqapplication.h>
 #include <tqlabel.h>
-#include <ntqpushbutton.h>
-#include <ntqlcdnumber.h>
+#include <tqpushbutton.h>
+#include <tqlcdnumber.h>
 #include <ntqlayout.h>
 
 #include "lcdrange.h"
@@ -53,7 +53,7 @@ body { background: #ffffff; color: black; }
 GameBoard::GameBoard( TQWidget *parent, const char *name )
         : TQWidget( parent, name )
 {
-    TQPushButton *quit = new TQPushButton( "&Quit", this, "quit" );
+    TQPushButton *quit = new TQPushButton( "&Quit", this, "quit" );
     quit->setFont( TQFont( "Times", 18, TQFont::Bold ) );
 
     connect( quit, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) );
@@ -81,7 +81,7 @@ body { background: #ffffff; color: black; }
     connect( cannonField, TQ_SIGNAL(missed()),
              this, TQ_SLOT(missed()) );
 
-    TQPushButton *shoot = new TQPushButton( "&Shoot", this, "shoot" );
+    TQPushButton *shoot = new TQPushButton( "&Shoot", this, "shoot" );
     shoot->setFont( TQFont( "Times", 18, TQFont::Bold ) );
 
     connect( shoot, TQ_SIGNAL(clicked()), TQ_SLOT(fire()) );
@@ -89,13 +89,13 @@ body { background: #ffffff; color: black; }
              shoot, TQ_SLOT(setEnabled(bool)) );
 
     TQPushButton *restart
-        = new TQPushButton( "&New Game", this, "newgame" );
+        = new TQPushButton( "&New Game", this, "newgame" );
     restart->setFont( TQFont( "Times", 18, TQFont::Bold ) );
 
     connect( restart, TQ_SIGNAL(clicked()), this, TQ_SLOT(newGame()) );
 
-    hits = new TQLCDNumber( 2, this, "hits" );
-    shotsLeft = new TQLCDNumber( 2, this, "shotsleft" );
+    hits = new TQLCDNumber( 2, this, "hits" );
+    shotsLeft = new TQLCDNumber( 2, this, "shotsleft" );
     TQLabel *hitsL = new TQLabel( "HITS", this, "hitsLabel" );
     TQLabel *shotsLeftL
         = new TQLabel( "SHOTS LEFT", this, "shotsleftLabel" );
@@ -132,15 +132,15 @@ void GameBoard::fire()
 {
     if ( cannonField->gameOver() || cannonField->isShooting() )
         return;
-    shotsLeft->display( shotsLeft->intValue() - 1 );
+    shotsLeft->display( shotsLeft->intValue() - 1 );
     cannonField->shoot();
 }
 
 
 void GameBoard::hit()
 {
-    hits->display( hits->intValue() + 1 );
-    if ( shotsLeft->intValue() == 0 )
+    hits->display( hits->intValue() + 1 );
+    if ( shotsLeft->intValue() == 0 )
         cannonField->setGameOver();
     else
         cannonField->newTarget();
@@ -149,15 +149,15 @@ void GameBoard::hit()
 
 void GameBoard::missed()
 {
-    if ( shotsLeft->intValue() == 0 )
+    if ( shotsLeft->intValue() == 0 )
         cannonField->setGameOver();
 }
 
 
 void GameBoard::newGame()
 {
-    shotsLeft->display( 15 );
-    hits->display( 0 );
+    shotsLeft->display( 15 );
+    hits->display( 0 );
     cannonField->restartGame();
     cannonField->newTarget();
 }
diff --git a/doc/html/t13-gamebrd-h.html b/doc/html/t13-gamebrd-h.html
index 802b87d31..c7cb68900 100644
--- a/doc/html/t13-gamebrd-h.html
+++ b/doc/html/t13-gamebrd-h.html
@@ -65,8 +65,8 @@ protected slots:
     void  newGame();
 
 private:
-    TQLCDNumber  *hits;
-    TQLCDNumber  *shotsLeft;
+    TQLCDNumber  *hits;
+    TQLCDNumber  *shotsLeft;
     CannonField *cannonField;
 };
 
diff --git a/doc/html/t13-lcdrange-cpp.html b/doc/html/t13-lcdrange-cpp.html
index 40abeb305..edb1ae1ce 100644
--- a/doc/html/t13-lcdrange-cpp.html
+++ b/doc/html/t13-lcdrange-cpp.html
@@ -40,8 +40,8 @@ body { background: #ffffff; color: black; }
 
 #include "lcdrange.h"
 
-#include <ntqslider.h>
-#include <ntqlcdnumber.h>
+#include <tqslider.h>
+#include <tqlcdnumber.h>
 #include <tqlabel.h>
 #include <ntqlayout.h>
 
@@ -63,17 +63,17 @@ LCDRange::LCDRange( const char *s, TQWidget *parent, const char *name )
 
 void LCDRange::init()
 {
-    TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
-    slider = new TQSlider( Horizontal, this, "slider" );
+    TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
+    slider = new TQSlider( Horizontal, this, "slider" );
     slider->setRange( 0, 99 );
-    slider->setValue( 0 );
+    slider->setValue( 0 );
 
     label = new TQLabel( " ", this, "label"  );
     label->setAlignment( AlignCenter );
 
-    connect( slider, TQ_SIGNAL(valueChanged(int)),
-             lcd, TQ_SLOT(display(int)) );
-    connect( slider, TQ_SIGNAL(valueChanged(int)),
+    connect( slider, TQ_SIGNAL(valueChanged(int)),
+             lcd, TQ_SLOT(display(int)) );
+    connect( slider, TQ_SIGNAL(valueChanged(int)),
              TQ_SIGNAL(valueChanged(int)) );
 
     setFocusProxy( slider );
@@ -87,7 +87,7 @@ void LCDRange::init()
 
 int LCDRange::value() const
 {
-    return slider->value();
+    return slider->value();
 }
 
 
@@ -99,7 +99,7 @@ const char *LCDRange::text() const
 
 void LCDRange::setValue( int value )
 {
-    slider->setValue( value );
+    slider->setValue( value );
 }
 
 
diff --git a/doc/html/t13-lcdrange-h.html b/doc/html/t13-lcdrange-h.html
index c47150867..92ba046e4 100644
--- a/doc/html/t13-lcdrange-h.html
+++ b/doc/html/t13-lcdrange-h.html
@@ -68,7 +68,7 @@ signals:
 private:
     void init();
 
-    TQSlider     *slider;
+    TQSlider     *slider;
     TQLabel      *label;
 };
 
diff --git a/doc/html/t14-gamebrd-cpp.html b/doc/html/t14-gamebrd-cpp.html
index 9ebd6d3ae..4b42ca9ba 100644
--- a/doc/html/t14-gamebrd-cpp.html
+++ b/doc/html/t14-gamebrd-cpp.html
@@ -44,8 +44,8 @@ body { background: #ffffff; color: black; }
 #include <ntqapplication.h>
 #include <tqlabel.h>
 #include <ntqaccel.h>
-#include <ntqpushbutton.h>
-#include <ntqlcdnumber.h>
+#include <tqpushbutton.h>
+#include <tqlcdnumber.h>
 #include <ntqlayout.h>
 #include <ntqvbox.h>
 
@@ -55,7 +55,7 @@ body { background: #ffffff; color: black; }
 GameBoard::GameBoard( TQWidget *parent, const char *name )
         : TQWidget( parent, name )
 {
-    TQPushButton *quit = new TQPushButton( "&Quit", this, "quit" );
+    TQPushButton *quit = new TQPushButton( "&Quit", this, "quit" );
     quit->setFont( TQFont( "Times", 18, TQFont::Bold ) );
 
     connect( quit, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) );
@@ -86,7 +86,7 @@ body { background: #ffffff; color: black; }
     connect( cannonField, TQ_SIGNAL(missed()),
              this, TQ_SLOT(missed()) );
 
-    TQPushButton *shoot = new TQPushButton( "&Shoot", this, "shoot" );
+    TQPushButton *shoot = new TQPushButton( "&Shoot", this, "shoot" );
     shoot->setFont( TQFont( "Times", 18, TQFont::Bold ) );
 
     connect( shoot, TQ_SIGNAL(clicked()), TQ_SLOT(fire()) );
@@ -95,13 +95,13 @@ body { background: #ffffff; color: black; }
              shoot, TQ_SLOT(setEnabled(bool)) );
 
     TQPushButton *restart
-        = new TQPushButton( "&New Game", this, "newgame" );
+        = new TQPushButton( "&New Game", this, "newgame" );
     restart->setFont( TQFont( "Times", 18, TQFont::Bold ) );
 
     connect( restart, TQ_SIGNAL(clicked()), this, TQ_SLOT(newGame()) );
 
-    hits = new TQLCDNumber( 2, this, "hits" );
-    shotsLeft = new TQLCDNumber( 2, this, "shotsleft" );
+    hits = new TQLCDNumber( 2, this, "hits" );
+    shotsLeft = new TQLCDNumber( 2, this, "shotsleft" );
     TQLabel *hitsL = new TQLabel( "HITS", this, "hitsLabel" );
     TQLabel *shotsLeftL
         = new TQLabel( "SHOTS LEFT", this, "shotsleftLabel" );
@@ -146,15 +146,15 @@ void GameBoard::fire()
 {
     if ( cannonField->gameOver() || cannonField->isShooting() )
         return;
-    shotsLeft->display( shotsLeft->intValue() - 1 );
+    shotsLeft->display( shotsLeft->intValue() - 1 );
     cannonField->shoot();
 }
 
 
 void GameBoard::hit()
 {
-    hits->display( hits->intValue() + 1 );
-    if ( shotsLeft->intValue() == 0 )
+    hits->display( hits->intValue() + 1 );
+    if ( shotsLeft->intValue() == 0 )
         cannonField->setGameOver();
     else
         cannonField->newTarget();
@@ -163,15 +163,15 @@ void GameBoard::hit()
 
 void GameBoard::missed()
 {
-    if ( shotsLeft->intValue() == 0 )
+    if ( shotsLeft->intValue() == 0 )
         cannonField->setGameOver();
 }
 
 
 void GameBoard::newGame()
 {
-    shotsLeft->display( 15 );
-    hits->display( 0 );
+    shotsLeft->display( 15 );
+    hits->display( 0 );
     cannonField->restartGame();
     cannonField->newTarget();
 }
diff --git a/doc/html/t14-gamebrd-h.html b/doc/html/t14-gamebrd-h.html
index b102175cd..d513bd9cd 100644
--- a/doc/html/t14-gamebrd-h.html
+++ b/doc/html/t14-gamebrd-h.html
@@ -65,8 +65,8 @@ protected slots:
     void  newGame();
 
 private:
-    TQLCDNumber  *hits;
-    TQLCDNumber  *shotsLeft;
+    TQLCDNumber  *hits;
+    TQLCDNumber  *shotsLeft;
     CannonField *cannonField;
 };
 
diff --git a/doc/html/t14-lcdrange-cpp.html b/doc/html/t14-lcdrange-cpp.html
index 90935592d..6206f4573 100644
--- a/doc/html/t14-lcdrange-cpp.html
+++ b/doc/html/t14-lcdrange-cpp.html
@@ -40,8 +40,8 @@ body { background: #ffffff; color: black; }
 
 #include "lcdrange.h"
 
-#include <ntqslider.h>
-#include <ntqlcdnumber.h>
+#include <tqslider.h>
+#include <tqlcdnumber.h>
 #include <tqlabel.h>
 #include <ntqlayout.h>
 
@@ -63,17 +63,17 @@ LCDRange::LCDRange( const char *s, TQWidget *parent, const char *name )
 
 void LCDRange::init()
 {
-    TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
-    slider = new TQSlider( Horizontal, this, "slider" );
+    TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
+    slider = new TQSlider( Horizontal, this, "slider" );
     slider->setRange( 0, 99 );
-    slider->setValue( 0 );
+    slider->setValue( 0 );
 
     label = new TQLabel( " ", this, "label"  );
     label->setAlignment( AlignCenter );
 
-    connect( slider, TQ_SIGNAL(valueChanged(int)),
-             lcd, TQ_SLOT(display(int)) );
-    connect( slider, TQ_SIGNAL(valueChanged(int)),
+    connect( slider, TQ_SIGNAL(valueChanged(int)),
+             lcd, TQ_SLOT(display(int)) );
+    connect( slider, TQ_SIGNAL(valueChanged(int)),
              TQ_SIGNAL(valueChanged(int)) );
 
     setFocusProxy( slider );
@@ -87,7 +87,7 @@ void LCDRange::init()
 
 int LCDRange::value() const
 {
-    return slider->value();
+    return slider->value();
 }
 
 
@@ -99,7 +99,7 @@ const char *LCDRange::text() const
 
 void LCDRange::setValue( int value )
 {
-    slider->setValue( value );
+    slider->setValue( value );
 }
 
 
diff --git a/doc/html/t14-lcdrange-h.html b/doc/html/t14-lcdrange-h.html
index 245c1318c..0f73d432f 100644
--- a/doc/html/t14-lcdrange-h.html
+++ b/doc/html/t14-lcdrange-h.html
@@ -68,7 +68,7 @@ signals:
 private:
     void init();
 
-    TQSlider     *slider;
+    TQSlider     *slider;
     TQLabel      *label;
 };
 
diff --git a/doc/html/t7-lcdrange-cpp.html b/doc/html/t7-lcdrange-cpp.html
index 306140321..97b8f38ea 100644
--- a/doc/html/t7-lcdrange-cpp.html
+++ b/doc/html/t7-lcdrange-cpp.html
@@ -40,30 +40,30 @@ body { background: #ffffff; color: black; }
 
 #include "lcdrange.h"
 
-#include <ntqslider.h>
-#include <ntqlcdnumber.h>
+#include <tqslider.h>
+#include <tqlcdnumber.h>
 
 LCDRange::LCDRange( TQWidget *parent, const char *name )
         : TQVBox( parent, name )
 {
-    TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
-    slider = new TQSlider( Horizontal, this, "slider" );
+    TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
+    slider = new TQSlider( Horizontal, this, "slider" );
     slider->setRange( 0, 99 );
-    slider->setValue( 0 );
-    connect( slider, TQ_SIGNAL(valueChanged(int)),
-             lcd, TQ_SLOT(display(int)) );
-    connect( slider, TQ_SIGNAL(valueChanged(int)),
+    slider->setValue( 0 );
+    connect( slider, TQ_SIGNAL(valueChanged(int)),
+             lcd, TQ_SLOT(display(int)) );
+    connect( slider, TQ_SIGNAL(valueChanged(int)),
              TQ_SIGNAL(valueChanged(int)) );
 }
 
 int LCDRange::value() const
 {
-    return slider->value();
+    return slider->value();
 }
 
 void LCDRange::setValue( int value )
 {
-    slider->setValue( value );
+    slider->setValue( value );
 }
 


diff --git a/doc/html/t7-lcdrange-h.html b/doc/html/t7-lcdrange-h.html index f99f30c70..3a3de6701 100644 --- a/doc/html/t7-lcdrange-h.html +++ b/doc/html/t7-lcdrange-h.html @@ -61,7 +61,7 @@ signals: void valueChanged( int ); private: - TQSlider *slider; + TQSlider *slider; }; diff --git a/doc/html/t7-main-cpp.html b/doc/html/t7-main-cpp.html index cc1816a6b..fa319e90f 100644 --- a/doc/html/t7-main-cpp.html +++ b/doc/html/t7-main-cpp.html @@ -39,8 +39,8 @@ body { background: #ffffff; color: black; } ****************************************************************/ #include <ntqapplication.h> -#include <ntqpushbutton.h> -#include <ntqlcdnumber.h> +#include <tqpushbutton.h> +#include <tqlcdnumber.h> #include <tqfont.h> #include <ntqvbox.h> #include <ntqgrid.h> @@ -58,7 +58,7 @@ public: MyWidget::MyWidget( TQWidget *parent, const char *name ) : TQVBox( parent, name ) { - TQPushButton *quit = new TQPushButton( "Quit", this, "quit" ); + TQPushButton *quit = new TQPushButton( "Quit", this, "quit" ); quit->setFont( TQFont( "Times", 18, TQFont::Bold ) ); connect( quit, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) ); diff --git a/doc/html/t8-lcdrange-cpp.html b/doc/html/t8-lcdrange-cpp.html index fe6ad8cd6..faf86517c 100644 --- a/doc/html/t8-lcdrange-cpp.html +++ b/doc/html/t8-lcdrange-cpp.html @@ -40,19 +40,19 @@ body { background: #ffffff; color: black; } #include "lcdrange.h" -#include <ntqslider.h> -#include <ntqlcdnumber.h> +#include <tqslider.h> +#include <tqlcdnumber.h> LCDRange::LCDRange( TQWidget *parent, const char *name ) : TQVBox( parent, name ) { - TQLCDNumber *lcd = new TQLCDNumber( 2, this, "lcd" ); - slider = new TQSlider( Horizontal, this, "slider" ); + TQLCDNumber *lcd = new TQLCDNumber( 2, this, "lcd" ); + slider = new TQSlider( Horizontal, this, "slider" ); slider->setRange( 0, 99 ); - slider->setValue( 0 ); - connect( slider, TQ_SIGNAL(valueChanged(int)), - lcd, TQ_SLOT(display(int)) ); - connect( slider, TQ_SIGNAL(valueChanged(int)), + slider->setValue( 0 ); + connect( slider, TQ_SIGNAL(valueChanged(int)), + lcd, TQ_SLOT(display(int)) ); + connect( slider, TQ_SIGNAL(valueChanged(int)), TQ_SIGNAL(valueChanged(int)) ); setFocusProxy( slider ); @@ -60,12 +60,12 @@ body { background: #ffffff; color: black; } int LCDRange::value() const { - return slider->value(); + return slider->value(); } void LCDRange::setValue( int value ) { - slider->setValue( value ); + slider->setValue( value ); } void LCDRange::setRange( int minVal, int maxVal ) diff --git a/doc/html/t8-lcdrange-h.html b/doc/html/t8-lcdrange-h.html index 224f2e9e1..45cd1fdd8 100644 --- a/doc/html/t8-lcdrange-h.html +++ b/doc/html/t8-lcdrange-h.html @@ -62,7 +62,7 @@ signals: void valueChanged( int ); private: - TQSlider *slider; + TQSlider *slider; }; diff --git a/doc/html/t8-main-cpp.html b/doc/html/t8-main-cpp.html index a137a6e2d..c07aae999 100644 --- a/doc/html/t8-main-cpp.html +++ b/doc/html/t8-main-cpp.html @@ -39,8 +39,8 @@ body { background: #ffffff; color: black; } ****************************************************************/ #include <ntqapplication.h> -#include <ntqpushbutton.h> -#include <ntqlcdnumber.h> +#include <tqpushbutton.h> +#include <tqlcdnumber.h> #include <tqfont.h> #include <ntqlayout.h> @@ -58,7 +58,7 @@ public: MyWidget::MyWidget( TQWidget *parent, const char *name ) : TQWidget( parent, name ) { - TQPushButton *quit = new TQPushButton( "Quit", this, "quit" ); + TQPushButton *quit = new TQPushButton( "Quit", this, "quit" ); quit->setFont( TQFont( "Times", 18, TQFont::Bold ) ); connect( quit, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) ); diff --git a/doc/html/t9-lcdrange-cpp.html b/doc/html/t9-lcdrange-cpp.html index bf732969e..ce72af615 100644 --- a/doc/html/t9-lcdrange-cpp.html +++ b/doc/html/t9-lcdrange-cpp.html @@ -40,19 +40,19 @@ body { background: #ffffff; color: black; } #include "lcdrange.h" -#include <ntqslider.h> -#include <ntqlcdnumber.h> +#include <tqslider.h> +#include <tqlcdnumber.h> LCDRange::LCDRange( TQWidget *parent, const char *name ) : TQVBox( parent, name ) { - TQLCDNumber *lcd = new TQLCDNumber( 2, this, "lcd" ); - slider = new TQSlider( Horizontal, this, "slider" ); + TQLCDNumber *lcd = new TQLCDNumber( 2, this, "lcd" ); + slider = new TQSlider( Horizontal, this, "slider" ); slider->setRange( 0, 99 ); - slider->setValue( 0 ); - connect( slider, TQ_SIGNAL(valueChanged(int)), - lcd, TQ_SLOT(display(int)) ); - connect( slider, TQ_SIGNAL(valueChanged(int)), + slider->setValue( 0 ); + connect( slider, TQ_SIGNAL(valueChanged(int)), + lcd, TQ_SLOT(display(int)) ); + connect( slider, TQ_SIGNAL(valueChanged(int)), TQ_SIGNAL(valueChanged(int)) ); setFocusProxy( slider ); @@ -60,12 +60,12 @@ body { background: #ffffff; color: black; } int LCDRange::value() const { - return slider->value(); + return slider->value(); } void LCDRange::setValue( int value ) { - slider->setValue( value ); + slider->setValue( value ); } void LCDRange::setRange( int minVal, int maxVal ) diff --git a/doc/html/t9-lcdrange-h.html b/doc/html/t9-lcdrange-h.html index b9d579d88..92dc87f9c 100644 --- a/doc/html/t9-lcdrange-h.html +++ b/doc/html/t9-lcdrange-h.html @@ -62,7 +62,7 @@ signals: void valueChanged( int ); private: - TQSlider *slider; + TQSlider *slider; }; diff --git a/doc/html/t9-main-cpp.html b/doc/html/t9-main-cpp.html index f90f8fb30..8a09b066d 100644 --- a/doc/html/t9-main-cpp.html +++ b/doc/html/t9-main-cpp.html @@ -39,8 +39,8 @@ body { background: #ffffff; color: black; } ****************************************************************/ #include <ntqapplication.h> -#include <ntqpushbutton.h> -#include <ntqlcdnumber.h> +#include <tqpushbutton.h> +#include <tqlcdnumber.h> #include <tqfont.h> #include <ntqlayout.h> @@ -58,7 +58,7 @@ public: MyWidget::MyWidget( TQWidget *parent, const char *name ) : TQWidget( parent, name ) { - TQPushButton *quit = new TQPushButton( "&Quit", this, "quit" ); + TQPushButton *quit = new TQPushButton( "&Quit", this, "quit" ); quit->setFont( TQFont( "Times", 18, TQFont::Bold ) ); connect( quit, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) ); diff --git a/doc/html/tabdialog-example.html b/doc/html/tabdialog-example.html index fa33e954d..22ef50441 100644 --- a/doc/html/tabdialog-example.html +++ b/doc/html/tabdialog-example.html @@ -92,10 +92,10 @@ protected: #include <ntqvbox.h> #include <tqlabel.h> -#include <ntqlineedit.h> +#include <tqlineedit.h> #include <tqdatetime.h> #include <ntqbuttongroup.h> -#include <ntqcheckbox.h> +#include <tqcheckbox.h> #include <ntqlistbox.h> #include <ntqapplication.h> @@ -115,7 +115,7 @@ void TabDialog::setupTab1() tab1->setMargin( 5 ); (void)new TQLabel( "Filename:", tab1 ); - TQLineEdit *fname = new TQLineEdit( filename, tab1 ); + TQLineEdit *fname = new TQLineEdit( filename, tab1 ); fname->setFocus(); (void)new TQLabel( "Path:", tab1 ); @@ -145,17 +145,17 @@ void TabDialog::setupTab2() TQButtonGroup *bg = new TQButtonGroup( 1, TQGroupBox::Horizontal, "Permissions", tab2 ); - TQCheckBox *readable = new TQCheckBox( "Readable", bg ); + TQCheckBox *readable = new TQCheckBox( "Readable", bg ); if ( fileinfo.isReadable() ) - readable->setChecked( TRUE ); + readable->setChecked( TRUE ); - TQCheckBox *writable = new TQCheckBox( "Writeable", bg ); + TQCheckBox *writable = new TQCheckBox( "Writeable", bg ); if ( fileinfo.isWritable() ) - writable->setChecked( TRUE ); + writable->setChecked( TRUE ); - TQCheckBox *executable = new TQCheckBox( "Executable", bg ); + TQCheckBox *executable = new TQCheckBox( "Executable", bg ); if ( fileinfo.isExecutable() ) - executable->setChecked( TRUE ); + executable->setChecked( TRUE ); TQButtonGroup *bg2 = new TQButtonGroup( 2, TQGroupBox::Horizontal, "Owner", tab2 ); @@ -185,7 +185,7 @@ void TabDialog::setupTab3() } prgs->setCurrentItem( 3 ); - (void)new TQCheckBox( TQString( "Open files with the extension '%1' always with this application" ).arg( fileinfo.extension() ), tab3 ); + (void)new TQCheckBox( TQString( "Open files with the extension '%1' always with this application" ).arg( fileinfo.extension() ), tab3 ); addTab( tab3, "Applications" ); } @@ -216,7 +216,7 @@ int main( int argc, char **argv ) tabdialog.resize( 450, 350 ); tabdialog.setCaption( "TQt Example - Tabbed Dialog" ); a.setMainWidget( &tabdialog ); - tabdialog.show(); + tabdialog.show(); return a.exec(); } diff --git a/doc/html/table-small-table-demo-main-cpp.html b/doc/html/table-small-table-demo-main-cpp.html index fce5b599d..7d224c51f 100644 --- a/doc/html/table-small-table-demo-main-cpp.html +++ b/doc/html/table-small-table-demo-main-cpp.html @@ -79,12 +79,12 @@ int main( int argc, char **argv ) comboEntries << "one" << "two" << "three" << "four"; for ( int i = 0; i < numRows; ++i ){ - TQComboTableItem * item = new TQComboTableItem( &table, comboEntries, FALSE ); - item->setCurrentItem( i % 4 ); + TQComboTableItem * item = new TQComboTableItem( &table, comboEntries, FALSE ); + item->setCurrentItem( i % 4 ); table.setItem( i, 5, item ); } for ( int j = 0; j < numRows; ++j ) - table.setItem( j, 1, new TQCheckTableItem( &table, "Check me" ) ); + table.setItem( j, 1, new TQCheckTableItem( &table, "Check me" ) ); app.setMainWidget( &table ); table.show(); diff --git a/doc/html/table-statistics-statistics-cpp.html b/doc/html/table-statistics-statistics-cpp.html index 595ebc003..71ca318d1 100644 --- a/doc/html/table-statistics-statistics-cpp.html +++ b/doc/html/table-statistics-statistics-cpp.html @@ -47,7 +47,7 @@ body { background: #ffffff; color: black; } #include <tqdir.h> #include <tqstringlist.h> #include <ntqheader.h> -#include <ntqcombobox.h> +#include <tqcombobox.h> #include <stdlib.h> const char* dirs[] = { @@ -174,7 +174,7 @@ void Table::recalcSum( int, int col ) TQWidget *ComboItem::createEditor() const { // create an editor - a combobox in our case - ( (ComboItem*)this )->cb = new TQComboBox( table()->viewport() ); + ( (ComboItem*)this )->cb = new TQComboBox( table()->viewport() ); TQObject::connect( cb, TQ_SIGNAL( activated( int ) ), table(), TQ_SLOT( doValueChanged() ) ); cb->insertItem( "Yes" ); cb->insertItem( "No" ); diff --git a/doc/html/table.html b/doc/html/table.html index 7c16a7183..97732ae1b 100644 --- a/doc/html/table.html +++ b/doc/html/table.html @@ -45,8 +45,8 @@ provide your users with the ability to display and edit tabular data such as spreadsheet or database data.
  • TQTableItem objects are used to populate a TQTable with data with each table item holding the contents of a cell. -
  • The TQComboTableItem class provides memory-efficient combobox items for TQTables. -
  • The TQCheckTableItem class provides memory-efficient checkbox items for TQTables. +
  • The TQComboTableItem class provides memory-efficient combobox items for TQTables. +
  • The TQCheckTableItem class provides memory-efficient checkbox items for TQTables.
  • TQTableSelection provides access to selections of cells in a TQTable.
  • TQHeader provides access to the table's horizontal header (column headers) and vertical header (row headers). diff --git a/doc/html/themes-example.html b/doc/html/themes-example.html index d598910fc..b74b3029c 100644 --- a/doc/html/themes-example.html +++ b/doc/html/themes-example.html @@ -149,7 +149,7 @@ private: #ifndef TQT_NO_STYLE_WINDOWS #include "ntqapplication.h" -#include "ntqcombobox.h" +#include "tqcombobox.h" #include "tqpainter.h" #include "ntqdrawutil.h" // for now #include "tqpixmap.h" // for now @@ -157,10 +157,10 @@ private: #include "tqwidget.h" #include "tqlabel.h" #include "tqimage.h" -#include "ntqpushbutton.h" +#include "tqpushbutton.h" #include "tqwidget.h" #include "ntqrangecontrol.h" -#include "ntqscrollbar.h" +#include "tqscrollbar.h" #include <limits.h> #include "tqstylefactory.h" @@ -1133,8 +1133,8 @@ void NorwegianWoodStyle::unPolish( TQPushButton *btn; - btn = ( const TQPushButton * )widget; + const TQPushButton *btn; + btn = ( const TQPushButton * )widget; TQColorGroup myCg( cg ); SFlags flags = Style_Default; if ( btn->isOn() ) @@ -1143,9 +1143,9 @@ void NorwegianWoodStyle::unPolish( isOn() || btn->isDown() ) flags |= Style_Sunken; - if ( btn->isDefault() ) + if ( btn->isDefault() ) flags |= Style_Default; - if ( ! btn->isFlat() && !(flags & Style_Down) ) + if ( ! btn->isFlat() && !(flags & Style_Down) ) flags |= Style_Raised; int x1, y1, x2, y2; @@ -1163,7 +1163,7 @@ void NorwegianWoodStyle::unPolish( brush( TQColorGroup::Button ); myCg.setBrush( TQColorGroup::Mid, fill ); - if ( btn->isDefault() ) { + if ( btn->isDefault() ) { x1 += 2; y1 += 2; x2 -= 2; @@ -1174,7 +1174,7 @@ void NorwegianWoodStyle::unPolish( isDefault() ) { + if ( btn->isDefault() ) { TQPen pen( TQt::black, 4 ); pen.setCapStyle( TQt::RoundCap ); pen.setJoinStyle( TQt::RoundJoin ); @@ -1182,7 +1182,7 @@ void NorwegianWoodStyle::unPolish( if ( btn->isMenuButton() ) { + if ( btn->isMenuButton() ) { int dx = ( y1 - y2 - 4 ) / 3; // reset the flags @@ -1200,8 +1200,8 @@ void NorwegianWoodStyle::unPolish( TQPushButton *btn; - btn = (const TQPushButton*)widget; + const TQPushButton *btn; + btn = (const TQPushButton*)widget; int x, y, w, h; r.rect( &x, &y, &w, &h ); @@ -1209,7 +1209,7 @@ void NorwegianWoodStyle::unPolish( coords( &x1, &y1, &x2, &y2 ); int dx = 0; int dy = 0; - if ( btn->isMenuButton() ) + if ( btn->isMenuButton() ) dx = ( y2 - y1 ) / 3; if ( dx || dy ) p->translate( dx, dy ); @@ -1268,8 +1268,8 @@ void NorwegianWoodStyle::unPolish( TQComboBox *cmb; - cmb = (const TQComboBox*)widget; + const TQComboBox *cmb; + cmb = (const TQComboBox*)widget; int awh, ax, ay, sh, sy, dh, ew; get_combo_parameters( subRect(SR_PushButtonContents, widget), @@ -1292,7 +1292,7 @@ void NorwegianWoodStyle::unPolish( drawLine( ax + awh - 1, sy + 1, ax + awh - 1, sy + sh - 1 ); p->setPen( oldPen ); - if ( cmb->editable() ) { + if ( cmb->editable() ) { TQRect r( querySubControlMetrics(CC_ComboBox, widget, SC_ComboBoxEditField, opt) ); qDrawShadePanel( p, r, cg, TRUE, 1, @@ -1356,9 +1356,9 @@ void NorwegianWoodStyle::unPolish( TQScrollBar* sb; - sb = (const TQScrollBar*)widget; - bool horz = sb->orientation() == TQScrollBar::Horizontal; + const TQScrollBar* sb; + sb = (const TQScrollBar*)widget; + bool horz = sb->orientation() == TQScrollBar::Horizontal; int b = 2; int w = horz ? sb->height() : sb->width(); @@ -1394,8 +1394,8 @@ void NorwegianWoodStyle::unPolish( TQPushButton *btn; - btn = (const TQPushButton*)widget; + const TQPushButton *btn; + btn = (const TQPushButton*)widget; r = btn->rect(); int d = TQMIN( r.width(), r.height() ) / 2; int b = buttonthickness( d ); @@ -1645,7 +1645,7 @@ private: #ifndef TQT_NO_STYLE_WINDOWS #include "ntqapplication.h" -#include "ntqcombobox.h" +#include "tqcombobox.h" #include "tqpainter.h" #include "ntqdrawutil.h" // for now #include "tqpixmap.h" // for now @@ -1653,11 +1653,11 @@ private: #include "tqwidget.h" #include "tqlabel.h" #include "tqimage.h" -#include "ntqpushbutton.h" +#include "tqpushbutton.h" #include "tqwidget.h" #include "ntqrangecontrol.h" -#include "ntqscrollbar.h" -#include "ntqslider.h" +#include "tqscrollbar.h" +#include "tqslider.h" #include <limits.h> @@ -1834,8 +1834,8 @@ void MetalStyle::unPolish( TQPushButton *btn; - btn = (const TQPushButton*)widget; + const TQPushButton *btn; + btn = (const TQPushButton*)widget; int x1, y1, x2, y2; r.coords( &x1, &y1, &x2, &y2 ); @@ -1852,7 +1852,7 @@ void MetalStyle::unPolish( brush( TQColorGroup::Button ); - if ( btn->isDefault() ) { + if ( btn->isDefault() ) { TQPointArray a; a.setPoints( 9, x1, y1, x2, y1, x2, y2, x1, y2, x1, y1+1, @@ -1869,13 +1869,13 @@ void MetalStyle::unPolish( isDown() ) flags |= Style_Down; - if ( !btn->isFlat() && !btn->isDown() ) + if ( !btn->isFlat() && !btn->isDown() ) flags |= Style_Raised; drawPrimitive( PE_ButtonCommand, p, TQRect( x1, y1, x2 - x1 + 1, y2 - y1 + 1), cg, flags, opt ); - if ( btn->isMenuButton() ) { + if ( btn->isMenuButton() ) { flags = Style_Default; if ( btn->isEnabled() ) flags |= Style_Enabled; @@ -1891,8 +1891,8 @@ void MetalStyle::unPolish( TQPushButton *btn; - btn = (const TQPushButton*)widget; + const TQPushButton *btn; + btn = (const TQPushButton*)widget; int x, y, w, h; r.rect( &x, &y, &w, &h ); @@ -1900,7 +1900,7 @@ void MetalStyle::unPolish( coords( &x1, &y1, &x2, &y2 ); int dx = 0; int dy = 0; - if ( btn->isMenuButton() ) + if ( btn->isMenuButton() ) dx = ( y2 - y1 ) / 3; if ( btn->isOn() || btn->isDown() ) { dx--; @@ -1939,7 +1939,7 @@ void MetalStyle::unPolish( TQSlider *slider = ( const TQSlider* ) widget; + const TQSlider *slider = ( const TQSlider* ) widget; TQRect handle = querySubControlMetrics( CC_Slider, widget, SC_SliderHandle, opt); if ( sub & SC_SliderGroove ) @@ -1948,13 +1948,13 @@ void MetalStyle::unPolish( if ( (sub & SC_SliderHandle) && handle.isValid() ) drawMetalButton( p, handle.x(), handle.y(), handle.width(), handle.height(), FALSE, - slider->orientation() == TQSlider::Horizontal); + slider->orientation() == TQSlider::Horizontal); break; } case CC_ComboBox: { // not exactly correct... - const TQComboBox *cmb = ( const TQComboBox* ) widget; + const TQComboBox *cmb = ( const TQComboBox* ) widget; qDrawWinPanel( p, r.x(), r.y(), r.width(), r.height(), cg, TRUE, cmb->isEnabled() ? &cg.brush( TQColorGroup::Base ) : diff --git a/doc/html/threads.html b/doc/html/threads.html index f52ad6d3e..b3fb0f3b4 100644 --- a/doc/html/threads.html +++ b/doc/html/threads.html @@ -232,7 +232,7 @@ system functions. This mutex is locked while the event loop is running (e.g. during event delivery) and unlocked when the eventloop goes to sleep. Note: The TQt event loop is recursive, and the library mutex is not unlocked when re-entering the event loop (e.g. when -executing a modal dialog with TQDialog::exec()). +executing a modal dialog with TQDialog::exec()).

    If another thread locks the TQt library mutex, then the event loop will stop processing events, and the locking thread may do simple GUI operations. Operations such as creating a TQPainter and drawing a line diff --git a/doc/html/tictac-example.html b/doc/html/tictac-example.html index efd2b2f59..fae1bdba3 100644 --- a/doc/html/tictac-example.html +++ b/doc/html/tictac-example.html @@ -54,7 +54,7 @@ widget. #define TICTAC_H -#include <ntqpushbutton.h> +#include <tqpushbutton.h> #include <tqptrvector.h> class TQComboBox; @@ -65,7 +65,7 @@ class TQLabel; // TicTacButton implements a single tic-tac-toe button // -class TicTacButton : public TQPushButton +class TicTacButton : public TQPushButton { TQ_OBJECT public: @@ -139,9 +139,9 @@ private slots: void gameOver(); private: void newState(); - TQComboBox *whoStarts; - TQPushButton *newGame; - TQPushButton *quit; + TQComboBox *whoStarts; + TQPushButton *newGame; + TQPushButton *quit; TQLabel *message; TicTacGameBoard *board; }; @@ -166,8 +166,8 @@ private: #include <ntqapplication.h> #include <tqpainter.h> #include <ntqdrawutil.h> -#include <ntqcombobox.h> -#include <ntqcheckbox.h> +#include <tqcombobox.h> +#include <tqcheckbox.h> #include <tqlabel.h> #include <ntqlayout.h> #include <stdlib.h> // rand() function @@ -182,7 +182,7 @@ private: // Creates a TicTacButton // -TicTacButton::TicTacButton( TQWidget *parent ) : TQPushButton( parent ) +TicTacButton::TicTacButton( TQWidget *parent ) : TQPushButton( parent ) { t = Blank; // initial type } @@ -468,17 +468,17 @@ void TicTacGameBoard::computerMove() // Create the combo box for deciding who should start, and // connect its clicked() signals to the buttonClicked() slot - whoStarts = new TQComboBox( this ); - whoStarts->insertItem( "Computer starts" ); - whoStarts->insertItem( "Human starts" ); + whoStarts = new TQComboBox( this ); + whoStarts->insertItem( "Computer starts" ); + whoStarts->insertItem( "Human starts" ); l->addWidget( whoStarts ); // Create the push buttons and connect their clicked() signals // to this right slots. - newGame = new TQPushButton( "Play!", this ); + newGame = new TQPushButton( "Play!", this ); connect( newGame, TQ_SIGNAL(clicked()), TQ_SLOT(newGameClicked()) ); - quit = new TQPushButton( "Quit", this ); + quit = new TQPushButton( "Quit", this ); connect( quit, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) ); TQHBoxLayout * b = new TQHBoxLayout; l->addLayout( b ); @@ -497,7 +497,7 @@ void TicTacGameBoard::computerMove() void TicTacToe::newGameClicked() { - board->computerStarts( whoStarts->currentItem() == 0 ); + board->computerStarts( whoStarts->currentItem() == 0 ); board->newGame(); newState(); } diff --git a/doc/html/titleindex b/doc/html/titleindex index 67b80a7e1..67112607c 100644 --- a/doc/html/titleindex +++ b/doc/html/titleindex @@ -222,12 +222,12 @@ TQChar Class | tqchar.html TQChar Member List | tqchar-members.html TQCharRef Class | tqcharref.html TQCharRef Member List | tqcharref-members.html -QCheckBox Class | ntqcheckbox.html -QCheckBox Member List | qcheckbox-members.html -QCheckListItem Class | qchecklistitem.html -QCheckListItem Member List | qchecklistitem-members.html -QCheckTableItem Class | qchecktableitem.html -QCheckTableItem Member List | qchecktableitem-members.html +TQCheckBox Class | tqcheckbox.html +TQCheckBox Member List | tqcheckbox-members.html +TQCheckListItem Class | tqchecklistitem.html +TQCheckListItem Member List | tqchecklistitem-members.html +TQCheckTableItem Class | tqchecktableitem.html +TQCheckTableItem Member List | tqchecktableitem-members.html QChildEvent Class | qchildevent.html QChildEvent Member List | qchildevent-members.html TQClipboard Class | tqclipboard.html @@ -242,10 +242,10 @@ TQColorDrag Class | tqcolordrag.html TQColorDrag Member List | tqcolordrag-members.html TQColorGroup Class | tqcolorgroup.html TQColorGroup Member List | tqcolorgroup-members.html -QComboBox Class | ntqcombobox.html -QComboBox Member List | qcombobox-members.html -QComboTableItem Class | qcombotableitem.html -QComboTableItem Member List | qcombotableitem-members.html +TQComboBox Class | tqcombobox.html +TQComboBox Member List | tqcombobox-members.html +TQComboTableItem Class | tqcombotableitem.html +TQComboTableItem Member List | tqcombotableitem-members.html QCommonStyle Class | ntqcommonstyle.html QCommonStyle Member List | qcommonstyle-members.html TQConstString Class | tqconststring.html @@ -286,10 +286,10 @@ TQDeepCopy Class | tqdeepcopy.html TQDeepCopy Member List | tqdeepcopy-members.html TQDesktopWidget Class | tqdesktopwidget.html TQDesktopWidget Member List | tqdesktopwidget-members.html -QDial Class | ntqdial.html -QDial Member List | qdial-members.html -QDialog Class | ntqdialog.html -QDialog Member List | qdialog-members.html +TQDial Class | tqdial.html +TQDial Member List | tqdial-members.html +TQDialog Class | tqdialog.html +TQDialog Member List | tqdialog-members.html TQDict Class | tqdict.html TQDict Member List | tqdict-members.html TQDictIterator Class | tqdictiterator.html @@ -499,8 +499,8 @@ QKeyEvent Class | qkeyevent.html QKeyEvent Member List | qkeyevent-members.html QKeySequence Class | ntqkeysequence.html QKeySequence Member List | qkeysequence-members.html -QLCDNumber Class | ntqlcdnumber.html -QLCDNumber Member List | qlcdnumber-members.html +TQLCDNumber Class | tqlcdnumber.html +TQLCDNumber Member List | tqlcdnumber-members.html TQLabel Class | tqlabel.html TQLabel Member List | tqlabel-members.html QLayout Class | ntqlayout.html @@ -511,8 +511,8 @@ QLayoutIterator Class | qlayoutiterator.html QLayoutIterator Member List | qlayoutiterator-members.html QLibrary Class | ntqlibrary.html QLibrary Member List | qlibrary-members.html -QLineEdit Class | ntqlineedit.html -QLineEdit Member List | qlineedit-members.html +TQLineEdit Class | tqlineedit.html +TQLineEdit Member List | tqlineedit-members.html QListBox Class | ntqlistbox.html QListBox Member List | qlistbox-members.html QListBoxItem Class | qlistboxitem.html @@ -658,10 +658,10 @@ TQPtrStack Class | tqptrstack.html TQPtrStack Member List | tqptrstack-members.html TQPtrVector Class | tqptrvector.html TQPtrVector Member List | tqptrvector-members.html -QPushButton Class | ntqpushbutton.html -QPushButton Member List | qpushbutton-members.html -QRadioButton Class | ntqradiobutton.html -QRadioButton Member List | qradiobutton-members.html +TQPushButton Class | tqpushbutton.html +TQPushButton Member List | tqpushbutton-members.html +TQRadioButton Class | tqradiobutton.html +TQRadioButton Member List | tqradiobutton-members.html QRangeControl Class | ntqrangecontrol.html QRangeControl Member List | qrangecontrol-members.html TQRect Class | tqrect.html @@ -676,10 +676,10 @@ QResizeEvent Class | qresizeevent.html QResizeEvent Member List | qresizeevent-members.html QSGIStyle Class | ntqsgistyle.html QSGIStyle Member List | qsgistyle-members.html -QScrollBar Class | ntqscrollbar.html -QScrollBar Member List | qscrollbar-members.html -QScrollView Class | ntqscrollview.html -QScrollView Member List | qscrollview-members.html +TQScrollBar Class | tqscrollbar.html +TQScrollBar Member List | tqscrollbar-members.html +TQScrollView Class | tqscrollview.html +TQScrollView Member List | tqscrollview-members.html TQSemaphore Class | tqsemaphore.html TQSemaphore Member List | tqsemaphore-members.html TQServerSocket Class | tqserversocket.html @@ -704,8 +704,8 @@ TQSizePolicy Class | tqsizepolicy.html TQSizePolicy Member List | tqsizepolicy-members.html TQSjisCodec Class | tqsjiscodec.html TQSjisCodec Member List | tqsjiscodec-members.html -QSlider Class | ntqslider.html -QSlider Member List | qslider-members.html +TQSlider Class | tqslider.html +TQSlider Member List | tqslider-members.html TQSocket Class | tqsocket.html TQSocket Member List | tqsocket-members.html TQSocketDevice Class | tqsocketdevice.html @@ -716,8 +716,8 @@ QSound Class | ntqsound.html QSound Member List | qsound-members.html QSpacerItem Class | qspaceritem.html QSpacerItem Member List | qspaceritem-members.html -QSpinBox Class | ntqspinbox.html -QSpinBox Member List | qspinbox-members.html +TQSpinBox Class | tqspinbox.html +TQSpinBox Member List | tqspinbox-members.html QSplashScreen Class | ntqsplashscreen.html QSplashScreen Member List | qsplashscreen-members.html QSplitter Class | ntqsplitter.html @@ -1032,7 +1032,7 @@ Transformed Graphics Demo | xform-example.html Trivial Example | trivial-nsplugin-example.html Tutorial #2 | tutorial2.html User Interface Compiler (uic) | uic.html -Using Custom QDialogs | motif-walkthrough-4.html +Using Custom TQDialogs | motif-walkthrough-4.html Using Existing Dialogs with QMotifDialog | motif-walkthrough-5.html Using TQt Main Window Classes | motif-walkthrough-6.html Using TQt Standard Dialogs | motif-walkthrough-3.html @@ -1090,11 +1090,11 @@ ntqbuttongroup.h Include File | qbuttongroup-h.html tqcache.h Include File | tqcache-h.html tqcanvas.h Include File | tqcanvas-h.html ntqcdestyle.h Include File | qcdestyle-h.html -ntqcheckbox.h Include File | qcheckbox-h.html +tqcheckbox.h Include File | tqcheckbox-h.html tqclipboard.h Include File | tqclipboard-h.html tqcolor.h Include File | tqcolor-h.html tqcolordialog.h Include File | tqcolordialog-h.html -ntqcombobox.h Include File | qcombobox-h.html +tqcombobox.h Include File | tqcombobox-h.html ntqcommonstyle.h Include File | qcommonstyle-h.html tqcstring.h Include File | tqcstring-h.html ntqcursor.h Include File | qcursor-h.html @@ -1106,8 +1106,8 @@ tqdatetime.h Include File | tqdatetime-h.html tqdatetimeedit.h Include File | tqdatetimeedit-h.html tqdeepcopy.h Include File | tqdeepcopy-h.html tqdesktopwidget.h Include File | tqdesktopwidget-h.html -ntqdial.h Include File | qdial-h.html -ntqdialog.h Include File | qdialog-h.html +tqdial.h Include File | tqdial-h.html +tqdialog.h Include File | tqdialog-h.html tqdict.h Include File | tqdict-h.html tqdir.h Include File | tqdir-h.html tqdns.h Include File | tqdns-h.html @@ -1159,9 +1159,9 @@ tqiodevice.h Include File | tqiodevice-h.html tqjiscodec.h Include File | tqjiscodec-h.html tqlabel.h Include File | tqlabel-h.html ntqlayout.h Include File | qlayout-h.html -ntqlcdnumber.h Include File | qlcdnumber-h.html +tqlcdnumber.h Include File | tqlcdnumber-h.html ntqlibrary.h Include File | qlibrary-h.html -ntqlineedit.h Include File | qlineedit-h.html +tqlineedit.h Include File | tqlineedit-h.html ntqlistbox.h Include File | qlistbox-h.html ntqlistview.h Include File | qlistview-h.html tqlocale.h Include File | tqlocale-h.html @@ -1214,15 +1214,15 @@ tqptrlist.h Include File | tqptrlist-h.html tqptrqueue.h Include File | tqptrqueue-h.html tqptrstack.h Include File | tqptrstack-h.html tqptrvector.h Include File | tqptrvector-h.html -ntqpushbutton.h Include File | qpushbutton-h.html -ntqradiobutton.h Include File | qradiobutton-h.html +tqpushbutton.h Include File | tqpushbutton-h.html +tqradiobutton.h Include File | tqradiobutton-h.html ntqrangecontrol.h Include File | qrangecontrol-h.html tqrect.h Include File | tqrect-h.html tqregexp.h Include File | tqregexp-h.html tqregion.h Include File | tqregion-h.html tqhebrewcodec.h Include File | tqhebrewcodec-h.html -ntqscrollbar.h Include File | qscrollbar-h.html -ntqscrollview.h Include File | qscrollview-h.html +tqscrollbar.h Include File | tqscrollbar-h.html +tqscrollview.h Include File | tqscrollview-h.html tqsemaphore.h Include File | tqsemaphore-h.html tqserversocket.h Include File | tqserversocket-h.html tqsessionmanager.h Include File | tqsessionmanager-h.html @@ -1235,12 +1235,12 @@ tqsize.h Include File | tqsize-h.html tqsizegrip.h Include File | tqsizegrip-h.html tqsizepolicy.h Include File | tqsizepolicy-h.html tqsjiscodec.h Include File | tqsjiscodec-h.html -ntqslider.h Include File | qslider-h.html +tqslider.h Include File | tqslider-h.html tqsocket.h Include File | tqsocket-h.html tqsocketdevice.h Include File | tqsocketdevice-h.html tqsocketnotifier.h Include File | tqsocketnotifier-h.html ntqsound.h Include File | qsound-h.html -ntqspinbox.h Include File | qspinbox-h.html +tqspinbox.h Include File | tqspinbox-h.html ntqsplashscreen.h Include File | qsplashscreen-h.html ntqsplitter.h Include File | qsplitter-h.html tqsql.h Include File | tqsql-h.html diff --git a/doc/html/toplevel-example.html b/doc/html/toplevel-example.html index 376ee1563..7b0791999 100644 --- a/doc/html/toplevel-example.html +++ b/doc/html/toplevel-example.html @@ -166,7 +166,7 @@ automatically. Popup menus are a typical example for such widgets. }

  • A modal widget blocks input to other toplevel widgets, unless those are in a different modal group (see WGroupLeader). -Dialogs are often modal, and the TQDialog class provides an easy API +Dialogs are often modal, and the TQDialog class provides an easy API to create and display them without the need to explicitly use this flag.

            if ( cbBehaviorTool->isChecked() ) {
    @@ -187,7 +187,7 @@ modeless dialogs.
                 TQLabel *label = new TQLabel(flagList.join("&nbsp;| "), widget);
                 label->setTextFormat(RichText);
                 label->setAlignment(WordBreak);
    -            TQPushButton *okButton = new TQPushButton( "Close", widget );
    +            TQPushButton *okButton = new TQPushButton( "Close", widget );
                 connect( okButton, TQ_SIGNAL(clicked()), widget, TQ_SLOT(close()) );
                 widget->move( pos() );
     
    The widget is created if it has not been created yet, or if it was diff --git a/doc/html/tqasciidict.html b/doc/html/tqasciidict.html index 3dce4794b..1f5cadc19 100644 --- a/doc/html/tqasciidict.html +++ b/doc/html/tqasciidict.html @@ -84,8 +84,8 @@ performace as a TQAsciiDict.

    Example:

         TQAsciiDict<TQLineEdit> fields; // char* keys, TQLineEdit* values
    -    fields.insert( "forename", new TQLineEdit( this ) );
    -    fields.insert( "surname", new TQLineEdit( this ) );
    +    fields.insert( "forename", new TQLineEdit( this ) );
    +    fields.insert( "surname", new TQLineEdit( this ) );
     
         fields["forename"]->setText( "Homer" );
         fields["surname"]->setText( "Simpson" );
    diff --git a/doc/html/tqasciidictiterator.html b/doc/html/tqasciidictiterator.html
    index 7de74f80a..817ebd45d 100644
    --- a/doc/html/tqasciidictiterator.html
    +++ b/doc/html/tqasciidictiterator.html
    @@ -61,9 +61,9 @@ iterator that operates on TQAsciiDict<X> (dictionary of X*).
     

    Example:

         TQAsciiDict<TQLineEdit> fields;
    -    fields.insert( "forename", new TQLineEdit( this ) );
    -    fields.insert( "surname", new TQLineEdit( this ) );
    -    fields.insert( "age", new TQLineEdit( this ) );
    +    fields.insert( "forename", new TQLineEdit( this ) );
    +    fields.insert( "surname", new TQLineEdit( this ) );
    +    fields.insert( "age", new TQLineEdit( this ) );
     
         fields["forename"]->setText( "Homer" );
         fields["surname"]->setText( "Simpson" );
    diff --git a/doc/html/tqcanvas-h.html b/doc/html/tqcanvas-h.html
    index a244fd266..049a27bf9 100644
    --- a/doc/html/tqcanvas-h.html
    +++ b/doc/html/tqcanvas-h.html
    @@ -78,7 +78,7 @@ body { background: #ffffff; color: black; }
     #define TQCANVAS_H
     
     #ifndef QT_H
    -#include "ntqscrollview.h"
    +#include "tqscrollview.h"
     #include "tqpixmap.h"
     #include "tqptrlist.h"
     #include "tqbrush.h"
    diff --git a/doc/html/tqcanvas.html b/doc/html/tqcanvas.html
    index fb85f60e8..c32af75ff 100644
    --- a/doc/html/tqcanvas.html
    +++ b/doc/html/tqcanvas.html
    @@ -108,7 +108,7 @@ provide multiple views of the same canvas.
     

    The canvas is optimized for large numbers of items, particularly where only a small percentage of the items change at any one time. If the entire display changes very frequently, you should -consider using your own custom TQScrollView subclass. +consider using your own custom TQScrollView subclass.

    TQt provides a rich set of canvas item classes, e.g. TQCanvasEllipse, TQCanvasLine, TQCanvasPolygon, TQCanvasPolygonalItem, TQCanvasRectangle, TQCanvasSpline, diff --git a/doc/html/tqcanvasview-members.html b/doc/html/tqcanvasview-members.html index c703fd711..c3b973c8a 100644 --- a/doc/html/tqcanvasview-members.html +++ b/doc/html/tqcanvasview-members.html @@ -38,7 +38,7 @@ body { background: #ffffff; color: black; }

  • TQCanvasView()
  • ~TQCanvasView()
  • acceptDrops() -
  • addChild() +
  • addChild()
  • adjustSize()
  • autoMask()
  • backgroundBrush() @@ -48,17 +48,17 @@ body { background: #ffffff; color: black; }
  • backgroundPixmap()
  • baseSize()
  • blockSignals() -
  • bottomMargin() +
  • bottomMargin()
  • canvas()
  • caption() -
  • center() +
  • center()
  • checkConnectArgs()
  • child()
  • childAt()
  • childEvent() -
  • childIsVisible() -
  • childX() -
  • childY() +
  • childIsVisible() +
  • childX() +
  • childY()
  • children()
  • childrenRect()
  • childrenRegion() @@ -67,7 +67,7 @@ body { background: #ffffff; color: black; }
  • clearMask()
  • clearWFlags()
  • clipRegion() -
  • clipper() +
  • clipper()
  • close()
  • closeEvent()
  • cmd() @@ -75,25 +75,25 @@ body { background: #ffffff; color: black; }
  • connect()
  • connectNotify()
  • constPolish() -
  • contentsContextMenuEvent() -
  • contentsDragEnterEvent() -
  • contentsDragLeaveEvent() -
  • contentsDragMoveEvent() -
  • contentsDropEvent() -
  • contentsHeight() -
  • contentsMouseDoubleClickEvent() -
  • contentsMouseMoveEvent() -
  • contentsMousePressEvent() -
  • contentsMouseReleaseEvent() -
  • contentsMoving() +
  • contentsContextMenuEvent() +
  • contentsDragEnterEvent() +
  • contentsDragLeaveEvent() +
  • contentsDragMoveEvent() +
  • contentsDropEvent() +
  • contentsHeight() +
  • contentsMouseDoubleClickEvent() +
  • contentsMouseMoveEvent() +
  • contentsMousePressEvent() +
  • contentsMouseReleaseEvent() +
  • contentsMoving()
  • contentsRect() -
  • contentsToViewport() -
  • contentsWheelEvent() -
  • contentsWidth() -
  • contentsX() -
  • contentsY() +
  • contentsToViewport() +
  • contentsWheelEvent() +
  • contentsWidth() +
  • contentsX() +
  • contentsY()
  • contextMenuEvent() -
  • cornerWidget() +
  • cornerWidget()
  • create()
  • cursor()
  • customEvent() @@ -103,26 +103,26 @@ body { background: #ffffff; color: black; }
  • destroyed()
  • disconnect()
  • disconnectNotify() -
  • dragAutoScroll() +
  • dragAutoScroll()
  • dragEnterEvent()
  • dragLeaveEvent()
  • dragMoveEvent()
  • drawContents() -
  • drawContentsOffset() +
  • drawContentsOffset()
  • drawFrame()
  • drawText()
  • dropEvent()
  • dumpObjectInfo()
  • dumpObjectTree() -
  • enableClipper() +
  • enableClipper()
  • enabledChange() -
  • ensureVisible() +
  • ensureVisible()
  • enterEvent()
  • erase()
  • eraseColor()
  • erasePixmap()
  • event() -
  • eventFilter() +
  • eventFilter()
  • find()
  • focusData()
  • focusInEvent() @@ -148,20 +148,20 @@ body { background: #ffffff; color: black; }
  • getWFlags()
  • grabKeyboard()
  • grabMouse() -
  • hScrollBarMode() +
  • hScrollBarMode()
  • handle()
  • hasFocus()
  • hasMouse()
  • hasMouseTracking() -
  • hasStaticBackground() +
  • hasStaticBackground()
  • height()
  • heightForWidth()
  • hide()
  • hideEvent()
  • highPriority() -
  • horizontalScrollBar() -
  • horizontalSliderPressed() -
  • horizontalSliderReleased() +
  • horizontalScrollBar() +
  • horizontalSliderPressed() +
  • horizontalSliderReleased()
  • icon()
  • iconText()
  • iconify() @@ -183,7 +183,7 @@ body { background: #ffffff; color: black; }
  • isFocusEnabled()
  • isFullScreen()
  • isHidden() -
  • isHorizontalSliderPressed() +
  • isHorizontalSliderPressed()
  • isInputMethodEnabled()
  • isMaximized()
  • isMinimized() @@ -192,7 +192,7 @@ body { background: #ffffff; color: black; }
  • isShown()
  • isTopLevel()
  • isUpdatesEnabled() -
  • isVerticalSliderPressed() +
  • isVerticalSliderPressed()
  • isVisible()
  • isVisibleTo()
  • isVisibleToTLW() @@ -204,7 +204,7 @@ body { background: #ffffff; color: black; }
  • killTimers()
  • layout()
  • leaveEvent() -
  • leftMargin() +
  • leftMargin()
  • lineWidth()
  • lower()
  • macEvent() @@ -232,7 +232,7 @@ body { background: #ffffff; color: black; }
  • mousePressEvent()
  • mouseReleaseEvent()
  • move() -
  • moveChild() +
  • moveChild()
  • moveEvent()
  • name()
  • normalizeSignalSlot() @@ -258,19 +258,19 @@ body { background: #ffffff; color: black; }
  • rect()
  • releaseKeyboard()
  • releaseMouse() -
  • removeChild() +
  • removeChild()
  • removeEventFilter()
  • repaint() -
  • repaintContents() +
  • repaintContents()
  • reparent()
  • resetInputContext()
  • resize() -
  • resizeContents() +
  • resizeContents()
  • resizeEvent() -
  • resizePolicy() -
  • rightMargin() +
  • resizePolicy() +
  • rightMargin()
  • scroll() -
  • scrollBy() +
  • scrollBy()
  • sender()
  • setAcceptDrops()
  • setActiveWindow() @@ -282,11 +282,11 @@ body { background: #ffffff; color: black; }
  • setBaseSize()
  • setCanvas()
  • setCaption() -
  • setContentsPos() -
  • setCornerWidget() +
  • setContentsPos() +
  • setCornerWidget()
  • setCursor()
  • setDisabled() -
  • setDragAutoScroll() +
  • setDragAutoScroll()
  • setEnabled()
  • setEraseColor()
  • setErasePixmap() @@ -302,8 +302,8 @@ body { background: #ffffff; color: black; }
  • setFrameShape()
  • setFrameStyle()
  • setGeometry() -
  • setHBarGeometry() -
  • setHScrollBarMode() +
  • setHBarGeometry() +
  • setHScrollBarMode()
  • setHidden()
  • setIcon()
  • setIconText() @@ -311,7 +311,7 @@ body { background: #ffffff; color: black; }
  • setKeyCompression()
  • setLineWidth()
  • setMargin() -
  • setMargins() +
  • setMargins()
  • setMask()
  • setMaximumHeight()
  • setMaximumSize() @@ -328,22 +328,22 @@ body { background: #ffffff; color: black; }
  • setPaletteBackgroundPixmap()
  • setPaletteForegroundColor()
  • setProperty() -
  • setResizePolicy() +
  • setResizePolicy()
  • setShown()
  • setSizeIncrement()
  • setSizePolicy() -
  • setStaticBackground() +
  • setStaticBackground()
  • setStyle()
  • setTabOrder()
  • setUpdatesEnabled() -
  • setVBarGeometry() -
  • setVScrollBarMode() +
  • setVBarGeometry() +
  • setVScrollBarMode()
  • setWFlags()
  • setWindowOpacity()
  • setWindowState()
  • setWorldMatrix()
  • show() -
  • showChild() +
  • showChild()
  • showEvent()
  • showFullScreen()
  • showMaximized() @@ -362,29 +362,29 @@ body { background: #ffffff; color: black; }
  • testWFlags()
  • timerEvent()
  • topLevelWidget() -
  • topMargin() +
  • topMargin()
  • tr()
  • trUtf8()
  • unsetCursor()
  • unsetFont()
  • unsetPalette()
  • update() -
  • updateContents() +
  • updateContents()
  • updateGeometry()
  • updateMask() -
  • updateScrollBars() -
  • vScrollBarMode() -
  • verticalScrollBar() -
  • verticalSliderPressed() -
  • verticalSliderReleased() -
  • viewport() -
  • viewportPaintEvent() -
  • viewportResizeEvent() -
  • viewportSize() -
  • viewportToContents() -
  • visibleHeight() +
  • updateScrollBars() +
  • vScrollBarMode() +
  • verticalScrollBar() +
  • verticalSliderPressed() +
  • verticalSliderReleased() +
  • viewport() +
  • viewportPaintEvent() +
  • viewportResizeEvent() +
  • viewportSize() +
  • viewportToContents() +
  • visibleHeight()
  • visibleRect() -
  • visibleWidth() +
  • visibleWidth()
  • wheelEvent()
  • width()
  • winEvent() diff --git a/doc/html/tqcanvasview.html b/doc/html/tqcanvasview.html index 740635351..97d7d5b6c 100644 --- a/doc/html/tqcanvasview.html +++ b/doc/html/tqcanvasview.html @@ -34,7 +34,7 @@ body { background: #ffffff; color: black; }

    The TQCanvasView class provides an on-screen view of a TQCanvas. More...

    #include <tqcanvas.h> -

    Inherits TQScrollView. +

    Inherits TQScrollView.

    List of all member functions.

    Public Members

  • @@ -810,7 +810,7 @@ See the "showHiddenFiles" p Returns the URL of the current working directory in the file dialog.

    See also setUrl(). -

    Example: network/networkprotocol/view.cpp. +

    Example: network/networkprotocol/view.cpp.

    ViewMode TQFileDialog::viewMode () const

    Returns the file dialog's view mode. See the "viewMode" property for details. diff --git a/doc/html/tqfontdialog-h.html b/doc/html/tqfontdialog-h.html index 850067045..46f07fa14 100644 --- a/doc/html/tqfontdialog-h.html +++ b/doc/html/tqfontdialog-h.html @@ -92,7 +92,7 @@ body { background: #ffffff; color: black; } // #ifndef QT_H -#include "ntqdialog.h" +#include "tqdialog.h" #include "tqfont.h" #endif // QT_H diff --git a/doc/html/tqfontdialog-members.html b/doc/html/tqfontdialog-members.html index 15cc9d0f7..4bcde0cbb 100644 --- a/doc/html/tqfontdialog-members.html +++ b/doc/html/tqfontdialog-members.html @@ -35,7 +35,7 @@ body { background: #ffffff; color: black; } TQFontDialog, including inherited members.

    Unused.  
    Style_HasFocus Set if the spinwidget has input focus. -
    CC_ComboBox(const TQComboBox *) +
    CC_ComboBox(const TQComboBox *) Style_Enabled Set if the combobox is enabled. Unused.  
    Style_HasFocus Set if the combobox has input focus. -
    CC_ScrollBar(const TQScrollBar *) +
    CC_ScrollBar(const TQScrollBar *) Style_Enabled Set if the scrollbar is enabled. Unused.  
    Style_HasFocus Set if the scrollbar has input focus. -
    CC_Slider(const TQSlider *) +
    CC_Slider(const TQSlider *) Style_Enabled Set if the slider is enabled. Unused.   @@ -764,9 +764,9 @@ the appropriate widget and opt usage: Notes Options Notes -
    CE_PushButton(const TQPushButton *) +
    CE_PushButton(const TQPushButton *)

    and -

    CE_PushButtonLabel(const TQPushButton *) +

    CE_PushButtonLabel(const TQPushButton *)

    Style_Enabled Set if the button is enabled. Unused.   @@ -776,9 +776,9 @@ the appropriate widget and opt usage:
    Style_Down Set if the button is down (i.e., the mouse button or space bar is pressed on the button).
    Style_ButtonDefault Set if the button is a default button. -
    CE_CheckBox(const TQCheckBox *) +
    CE_CheckBox(const TQCheckBox *)

    and -

    CE_CheckBoxLabel(const TQCheckBox *) +

    CE_CheckBoxLabel(const TQCheckBox *)

    Style_Enabled Set if the checkbox is enabled. Unused.   @@ -788,7 +788,7 @@ space bar is pressed on the button).
    Style_NoChange Set if the checkbox is in the NoChange state.
    Style_Down Set if the checkbox is down (i.e., the mouse button or space bar is pressed on the button). -
    CE_RadioButton(const TQRadioButton *) +
    CE_RadioButton(const TQRadioButton *)

    and

    CE_RadioButtonLabel(const TQRadioButton *)

    Style_Enabled Set if the radiobutton is enabled. @@ -986,10 +986,10 @@ of widget. See the table below for the appropriate widget casts:

    PixelMetric Widget Cast -
    PM_SliderControlThickness (const TQSlider *) -
    PM_SliderLength (const TQSlider *) -
    PM_SliderTickmarkOffset (const TQSlider *) -
    PM_SliderSpaceAvailable (const TQSlider *) +
    PM_SliderControlThickness (const TQSlider *) +
    PM_SliderLength (const TQSlider *) +
    PM_SliderTickmarkOffset (const TQSlider *) +
    PM_SliderSpaceAvailable (const TQSlider *)
    PM_TabBarTabOverlap (const TQTabBar *)
    PM_TabBarTabHSpace (const TQTabBar *)
    PM_TabBarTabVSpace (const TQTabBar *) @@ -1086,11 +1086,11 @@ can make use of the extra options. See the table below for the appropriate widget and opt usage:

    ContentsType Widget Cast Options Notes -
    CT_PushButton (const TQPushButton *) Unused.   -
    CT_CheckBox (const TQCheckBox *) Unused.   -
    CT_RadioButton (const TQRadioButton *) Unused.   +
    CT_PushButton (const TQPushButton *) Unused.   +
    CT_CheckBox (const TQCheckBox *) Unused.   +
    CT_RadioButton (const TQRadioButton *) Unused.  
    CT_ToolButton (const TQToolButton *) Unused.   -
    CT_ComboBox (const TQComboBox *) Unused.   +
    CT_ComboBox (const TQComboBox *) Unused.  
    CT_Splitter (const TQSplitter *) Unused.  
    CT_DockWindow (const TQDockWindow *) Unused.  
    CT_ProgressBar (const TQProgressBar *) Unused.   @@ -1145,15 +1145,15 @@ on the value of subrect. See the table below for the appropriate widget casts:

    SubRect Widget Cast -
    SR_PushButtonContents (const TQPushButton *) -
    SR_PushButtonFocusRect (const TQPushButton *) -
    SR_CheckBoxIndicator (const TQCheckBox *) -
    SR_CheckBoxContents (const TQCheckBox *) -
    SR_CheckBoxFocusRect (const TQCheckBox *) -
    SR_RadioButtonIndicator (const TQRadioButton *) -
    SR_RadioButtonContents (const TQRadioButton *) -
    SR_RadioButtonFocusRect (const TQRadioButton *) -
    SR_ComboBoxFocusRect (const TQComboBox *) +
    SR_PushButtonContents (const TQPushButton *) +
    SR_PushButtonFocusRect (const TQPushButton *) +
    SR_CheckBoxIndicator (const TQCheckBox *) +
    SR_CheckBoxContents (const TQCheckBox *) +
    SR_CheckBoxFocusRect (const TQCheckBox *) +
    SR_RadioButtonIndicator (const TQRadioButton *) +
    SR_RadioButtonContents (const TQRadioButton *) +
    SR_RadioButtonFocusRect (const TQRadioButton *) +
    SR_ComboBoxFocusRect (const TQComboBox *)
    SR_DockWindowHandleRect (const TQWidget *)
    SR_ProgressBarGroove (const TQProgressBar *)
    SR_ProgressBarContents (const TQProgressBar *) diff --git a/doc/html/tqstyleoption.html b/doc/html/tqstyleoption.html index 2c99c2519..5b4697054 100644 --- a/doc/html/tqstyleoption.html +++ b/doc/html/tqstyleoption.html @@ -161,10 +161,10 @@ midlinewidth.

    Pass a TQListViewItem, i. -

    TQStyleOption::TQStyleOption ( TQCheckListItem * i ) +

    TQStyleOption::TQStyleOption ( TQCheckListItem * i )

    -

    Pass a TQCheckListItem, i. +

    Pass a TQCheckListItem, i.

    TQStyleOption::TQStyleOption ( TQt::ArrowType a )

    @@ -187,7 +187,7 @@ midlinewidth.

    Returns an arrow type if the appropriate constructor was called; otherwise the return value is undefined. -

    TQCheckListItem * TQStyleOption::checkListItem () const +

    TQCheckListItem * TQStyleOption::checkListItem () const

    Returns a check list item if the appropriate constructor was diff --git a/doc/html/tqtextbrowser-members.html b/doc/html/tqtextbrowser-members.html index ceea0d3a9..9276b002b 100644 --- a/doc/html/tqtextbrowser-members.html +++ b/doc/html/tqtextbrowser-members.html @@ -37,7 +37,7 @@ body { background: #ffffff; color: black; }

    • TQTextBrowser()
    • acceptDrops() -
    • addChild() +
    • addChild()
    • adjustSize()
    • alignment()
    • anchorAt() @@ -55,17 +55,17 @@ body { background: #ffffff; color: black; }
    • baseSize()
    • blockSignals()
    • bold() -
    • bottomMargin() +
    • bottomMargin()
    • caption() -
    • center() +
    • center()
    • charAt()
    • checkConnectArgs()
    • child()
    • childAt()
    • childEvent() -
    • childIsVisible() -
    • childX() -
    • childY() +
    • childIsVisible() +
    • childX() +
    • childY()
    • children()
    • childrenRect()
    • childrenRegion() @@ -77,7 +77,7 @@ body { background: #ffffff; color: black; }
    • clearWFlags()
    • clicked()
    • clipRegion() -
    • clipper() +
    • clipper()
    • close()
    • closeEvent()
    • cmd() @@ -86,28 +86,28 @@ body { background: #ffffff; color: black; }
    • connect()
    • connectNotify()
    • constPolish() -
    • contentsContextMenuEvent() -
    • contentsDragEnterEvent() -
    • contentsDragLeaveEvent() -
    • contentsDragMoveEvent() -
    • contentsDropEvent() -
    • contentsHeight() -
    • contentsMouseDoubleClickEvent() -
    • contentsMouseMoveEvent() -
    • contentsMousePressEvent() -
    • contentsMouseReleaseEvent() -
    • contentsMoving() +
    • contentsContextMenuEvent() +
    • contentsDragEnterEvent() +
    • contentsDragLeaveEvent() +
    • contentsDragMoveEvent() +
    • contentsDropEvent() +
    • contentsHeight() +
    • contentsMouseDoubleClickEvent() +
    • contentsMouseMoveEvent() +
    • contentsMousePressEvent() +
    • contentsMouseReleaseEvent() +
    • contentsMoving()
    • contentsRect() -
    • contentsToViewport() -
    • contentsWheelEvent() -
    • contentsWidth() -
    • contentsX() -
    • contentsY() +
    • contentsToViewport() +
    • contentsWheelEvent() +
    • contentsWidth() +
    • contentsX() +
    • contentsY()
    • context()
    • contextMenuEvent()
    • copy()
    • copyAvailable() -
    • cornerWidget() +
    • cornerWidget()
    • create()
    • createPopupMenu()
    • currentAlignmentChanged() @@ -129,27 +129,27 @@ body { background: #ffffff; color: black; }
    • doKeyboardAction()
    • documentTitle()
    • doubleClicked() -
    • dragAutoScroll() +
    • dragAutoScroll()
    • dragEnterEvent()
    • dragLeaveEvent()
    • dragMoveEvent() -
    • drawContents() -
    • drawContentsOffset() +
    • drawContents() +
    • drawContentsOffset()
    • drawFrame()
    • drawText()
    • dropEvent()
    • dumpObjectInfo()
    • dumpObjectTree() -
    • enableClipper() +
    • enableClipper()
    • enabledChange()
    • ensureCursorVisible() -
    • ensureVisible() +
    • ensureVisible()
    • enterEvent()
    • erase()
    • eraseColor()
    • erasePixmap()
    • event() -
    • eventFilter() +
    • eventFilter()
    • family()
    • find()
    • focusData() @@ -180,13 +180,13 @@ body { background: #ffffff; color: black; }
    • getWFlags()
    • grabKeyboard()
    • grabMouse() -
    • hScrollBarMode() +
    • hScrollBarMode()
    • handle()
    • hasFocus()
    • hasMouse()
    • hasMouseTracking()
    • hasSelectedText() -
    • hasStaticBackground() +
    • hasStaticBackground()
    • height()
    • heightForWidth()
    • hide() @@ -194,9 +194,9 @@ body { background: #ffffff; color: black; }
    • highPriority()
    • highlighted()
    • home() -
    • horizontalScrollBar() -
    • horizontalSliderPressed() -
    • horizontalSliderReleased() +
    • horizontalScrollBar() +
    • horizontalSliderPressed() +
    • horizontalSliderReleased()
    • icon()
    • iconText()
    • iconify() @@ -220,7 +220,7 @@ body { background: #ffffff; color: black; }
    • isFocusEnabled()
    • isFullScreen()
    • isHidden() -
    • isHorizontalSliderPressed() +
    • isHorizontalSliderPressed()
    • isInputMethodEnabled()
    • isMaximized()
    • isMinimized() @@ -235,7 +235,7 @@ body { background: #ffffff; color: black; }
    • isUndoAvailable()
    • isUndoRedoEnabled()
    • isUpdatesEnabled() -
    • isVerticalSliderPressed() +
    • isVerticalSliderPressed()
    • isVisible()
    • isVisibleTo()
    • isVisibleToTLW() @@ -248,7 +248,7 @@ body { background: #ffffff; color: black; }
    • killTimers()
    • layout()
    • leaveEvent() -
    • leftMargin() +
    • leftMargin()
    • length()
    • lineOfChar()
    • lineWidth() @@ -285,7 +285,7 @@ body { background: #ffffff; color: black; }
    • mousePressEvent()
    • mouseReleaseEvent()
    • move() -
    • moveChild() +
    • moveChild()
    • moveCursor()
    • moveEvent()
    • name() @@ -325,24 +325,24 @@ body { background: #ffffff; color: black; }
    • releaseKeyboard()
    • releaseMouse()
    • reload() -
    • removeChild() +
    • removeChild()
    • removeEventFilter()
    • removeParagraph()
    • removeSelectedText()
    • removeSelection()
    • repaint()
    • repaintChanged() -
    • repaintContents() +
    • repaintContents()
    • reparent()
    • resetInputContext()
    • resize() -
    • resizeContents() +
    • resizeContents()
    • resizeEvent() -
    • resizePolicy() +
    • resizePolicy()
    • returnPressed() -
    • rightMargin() +
    • rightMargin()
    • scroll() -
    • scrollBy() +
    • scrollBy()
    • scrollToAnchor()
    • scrollToBottom()
    • selectAll() @@ -362,13 +362,13 @@ body { background: #ffffff; color: black; }
    • setBold()
    • setCaption()
    • setColor() -
    • setContentsPos() -
    • setCornerWidget() +
    • setContentsPos() +
    • setCornerWidget()
    • setCurrentFont()
    • setCursor()
    • setCursorPosition()
    • setDisabled() -
    • setDragAutoScroll() +
    • setDragAutoScroll()
    • setEnabled()
    • setEraseColor()
    • setErasePixmap() @@ -385,8 +385,8 @@ body { background: #ffffff; color: black; }
    • setFrameShape()
    • setFrameStyle()
    • setGeometry() -
    • setHBarGeometry() -
    • setHScrollBarMode() +
    • setHBarGeometry() +
    • setHScrollBarMode()
    • setHidden()
    • setIcon()
    • setIconText() @@ -396,7 +396,7 @@ body { background: #ffffff; color: black; }
    • setLineWidth()
    • setLinkUnderline()
    • setMargin() -
    • setMargins() +
    • setMargins()
    • setMask()
    • setMaxLogLines()
    • setMaximumHeight() @@ -421,14 +421,14 @@ body { background: #ffffff; color: black; }
    • setPointSize()
    • setProperty()
    • setReadOnly() -
    • setResizePolicy() +
    • setResizePolicy()
    • setSelection()
    • setSelectionAttributes()
    • setShown()
    • setSizeIncrement()
    • setSizePolicy()
    • setSource() -
    • setStaticBackground() +
    • setStaticBackground()
    • setStyle()
    • setStyleSheet()
    • setTabChangesFocus() @@ -440,8 +440,8 @@ body { background: #ffffff; color: black; }
    • setUndoDepth()
    • setUndoRedoEnabled()
    • setUpdatesEnabled() -
    • setVBarGeometry() -
    • setVScrollBarMode() +
    • setVBarGeometry() +
    • setVScrollBarMode()
    • setVerticalAlignment()
    • setWFlags()
    • setWindowOpacity() @@ -450,7 +450,7 @@ body { background: #ffffff; color: black; }
    • setWrapColumnOrWidth()
    • setWrapPolicy()
    • show() -
    • showChild() +
    • showChild()
    • showEvent()
    • showFullScreen()
    • showMaximized() @@ -480,7 +480,7 @@ body { background: #ffffff; color: black; }
    • textFormat()
    • timerEvent()
    • topLevelWidget() -
    • topMargin() +
    • topMargin()
    • tr()
    • trUtf8()
    • underline() @@ -491,22 +491,22 @@ body { background: #ffffff; color: black; }
    • unsetFont()
    • unsetPalette()
    • update() -
    • updateContents() +
    • updateContents()
    • updateGeometry()
    • updateMask() -
    • updateScrollBars() -
    • vScrollBarMode() -
    • verticalScrollBar() -
    • verticalSliderPressed() -
    • verticalSliderReleased() -
    • viewport() -
    • viewportPaintEvent() -
    • viewportResizeEvent() -
    • viewportSize() -
    • viewportToContents() -
    • visibleHeight() +
    • updateScrollBars() +
    • vScrollBarMode() +
    • verticalScrollBar() +
    • verticalSliderPressed() +
    • verticalSliderReleased() +
    • viewport() +
    • viewportPaintEvent() +
    • viewportResizeEvent() +
    • viewportSize() +
    • viewportToContents() +
    • visibleHeight()
    • visibleRect() -
    • visibleWidth() +
    • visibleWidth()
    • wheelEvent()
    • width()
    • winEvent() diff --git a/doc/html/tqtextedit-h.html b/doc/html/tqtextedit-h.html index 87bb4f8f0..83ee2a0a3 100644 --- a/doc/html/tqtextedit-h.html +++ b/doc/html/tqtextedit-h.html @@ -78,7 +78,7 @@ body { background: #ffffff; color: black; } #define TQTEXTEDIT_H #ifndef QT_H -#include "ntqscrollview.h" +#include "tqscrollview.h" #include "tqstylesheet.h" #include "tqptrvector.h" #include "tqvaluelist.h" diff --git a/doc/html/tqtextedit-members.html b/doc/html/tqtextedit-members.html index c5ff8827e..1384964ca 100644 --- a/doc/html/tqtextedit-members.html +++ b/doc/html/tqtextedit-members.html @@ -37,7 +37,7 @@ body { background: #ffffff; color: black; }
      • TQTextEdit()
      • acceptDrops() -
      • addChild() +
      • addChild()
      • adjustSize()
      • alignment()
      • anchorAt() @@ -52,17 +52,17 @@ body { background: #ffffff; color: black; }
      • baseSize()
      • blockSignals()
      • bold() -
      • bottomMargin() +
      • bottomMargin()
      • caption() -
      • center() +
      • center()
      • charAt()
      • checkConnectArgs()
      • child()
      • childAt()
      • childEvent() -
      • childIsVisible() -
      • childX() -
      • childY() +
      • childIsVisible() +
      • childX() +
      • childY()
      • children()
      • childrenRect()
      • childrenRegion() @@ -74,7 +74,7 @@ body { background: #ffffff; color: black; }
      • clearWFlags()
      • clicked()
      • clipRegion() -
      • clipper() +
      • clipper()
      • close()
      • closeEvent()
      • cmd() @@ -83,28 +83,28 @@ body { background: #ffffff; color: black; }
      • connect()
      • connectNotify()
      • constPolish() -
      • contentsContextMenuEvent() -
      • contentsDragEnterEvent() -
      • contentsDragLeaveEvent() -
      • contentsDragMoveEvent() -
      • contentsDropEvent() -
      • contentsHeight() -
      • contentsMouseDoubleClickEvent() -
      • contentsMouseMoveEvent() -
      • contentsMousePressEvent() -
      • contentsMouseReleaseEvent() -
      • contentsMoving() +
      • contentsContextMenuEvent() +
      • contentsDragEnterEvent() +
      • contentsDragLeaveEvent() +
      • contentsDragMoveEvent() +
      • contentsDropEvent() +
      • contentsHeight() +
      • contentsMouseDoubleClickEvent() +
      • contentsMouseMoveEvent() +
      • contentsMousePressEvent() +
      • contentsMouseReleaseEvent() +
      • contentsMoving()
      • contentsRect() -
      • contentsToViewport() -
      • contentsWheelEvent() -
      • contentsWidth() -
      • contentsX() -
      • contentsY() +
      • contentsToViewport() +
      • contentsWheelEvent() +
      • contentsWidth() +
      • contentsX() +
      • contentsY()
      • context()
      • contextMenuEvent()
      • copy()
      • copyAvailable() -
      • cornerWidget() +
      • cornerWidget()
      • create()
      • createPopupMenu()
      • currentAlignmentChanged() @@ -126,27 +126,27 @@ body { background: #ffffff; color: black; }
      • doKeyboardAction()
      • documentTitle()
      • doubleClicked() -
      • dragAutoScroll() +
      • dragAutoScroll()
      • dragEnterEvent()
      • dragLeaveEvent()
      • dragMoveEvent() -
      • drawContents() -
      • drawContentsOffset() +
      • drawContents() +
      • drawContentsOffset()
      • drawFrame()
      • drawText()
      • dropEvent()
      • dumpObjectInfo()
      • dumpObjectTree() -
      • enableClipper() +
      • enableClipper()
      • enabledChange()
      • ensureCursorVisible() -
      • ensureVisible() +
      • ensureVisible()
      • enterEvent()
      • erase()
      • eraseColor()
      • erasePixmap()
      • event() -
      • eventFilter() +
      • eventFilter()
      • family()
      • find()
      • focusData() @@ -175,21 +175,21 @@ body { background: #ffffff; color: black; }
      • getWFlags()
      • grabKeyboard()
      • grabMouse() -
      • hScrollBarMode() +
      • hScrollBarMode()
      • handle()
      • hasFocus()
      • hasMouse()
      • hasMouseTracking()
      • hasSelectedText() -
      • hasStaticBackground() +
      • hasStaticBackground()
      • height()
      • heightForWidth()
      • hide()
      • hideEvent()
      • highPriority() -
      • horizontalScrollBar() -
      • horizontalSliderPressed() -
      • horizontalSliderReleased() +
      • horizontalScrollBar() +
      • horizontalSliderPressed() +
      • horizontalSliderReleased()
      • icon()
      • iconText()
      • iconify() @@ -213,7 +213,7 @@ body { background: #ffffff; color: black; }
      • isFocusEnabled()
      • isFullScreen()
      • isHidden() -
      • isHorizontalSliderPressed() +
      • isHorizontalSliderPressed()
      • isInputMethodEnabled()
      • isMaximized()
      • isMinimized() @@ -228,7 +228,7 @@ body { background: #ffffff; color: black; }
      • isUndoAvailable()
      • isUndoRedoEnabled()
      • isUpdatesEnabled() -
      • isVerticalSliderPressed() +
      • isVerticalSliderPressed()
      • isVisible()
      • isVisibleTo()
      • isVisibleToTLW() @@ -241,7 +241,7 @@ body { background: #ffffff; color: black; }
      • killTimers()
      • layout()
      • leaveEvent() -
      • leftMargin() +
      • leftMargin()
      • length()
      • lineOfChar()
      • lineWidth() @@ -277,7 +277,7 @@ body { background: #ffffff; color: black; }
      • mousePressEvent()
      • mouseReleaseEvent()
      • move() -
      • moveChild() +
      • moveChild()
      • moveCursor()
      • moveEvent()
      • name() @@ -316,24 +316,24 @@ body { background: #ffffff; color: black; }
      • redoAvailable()
      • releaseKeyboard()
      • releaseMouse() -
      • removeChild() +
      • removeChild()
      • removeEventFilter()
      • removeParagraph()
      • removeSelectedText()
      • removeSelection()
      • repaint()
      • repaintChanged() -
      • repaintContents() +
      • repaintContents()
      • reparent()
      • resetInputContext()
      • resize() -
      • resizeContents() +
      • resizeContents()
      • resizeEvent() -
      • resizePolicy() +
      • resizePolicy()
      • returnPressed() -
      • rightMargin() +
      • rightMargin()
      • scroll() -
      • scrollBy() +
      • scrollBy()
      • scrollToAnchor()
      • scrollToBottom()
      • selectAll() @@ -353,13 +353,13 @@ body { background: #ffffff; color: black; }
      • setBold()
      • setCaption()
      • setColor() -
      • setContentsPos() -
      • setCornerWidget() +
      • setContentsPos() +
      • setCornerWidget()
      • setCurrentFont()
      • setCursor()
      • setCursorPosition()
      • setDisabled() -
      • setDragAutoScroll() +
      • setDragAutoScroll()
      • setEnabled()
      • setEraseColor()
      • setErasePixmap() @@ -376,8 +376,8 @@ body { background: #ffffff; color: black; }
      • setFrameShape()
      • setFrameStyle()
      • setGeometry() -
      • setHBarGeometry() -
      • setHScrollBarMode() +
      • setHBarGeometry() +
      • setHScrollBarMode()
      • setHidden()
      • setIcon()
      • setIconText() @@ -387,7 +387,7 @@ body { background: #ffffff; color: black; }
      • setLineWidth()
      • setLinkUnderline()
      • setMargin() -
      • setMargins() +
      • setMargins()
      • setMask()
      • setMaxLogLines()
      • setMaximumHeight() @@ -412,13 +412,13 @@ body { background: #ffffff; color: black; }
      • setPointSize()
      • setProperty()
      • setReadOnly() -
      • setResizePolicy() +
      • setResizePolicy()
      • setSelection()
      • setSelectionAttributes()
      • setShown()
      • setSizeIncrement()
      • setSizePolicy() -
      • setStaticBackground() +
      • setStaticBackground()
      • setStyle()
      • setStyleSheet()
      • setTabChangesFocus() @@ -430,8 +430,8 @@ body { background: #ffffff; color: black; }
      • setUndoDepth()
      • setUndoRedoEnabled()
      • setUpdatesEnabled() -
      • setVBarGeometry() -
      • setVScrollBarMode() +
      • setVBarGeometry() +
      • setVScrollBarMode()
      • setVerticalAlignment()
      • setWFlags()
      • setWindowOpacity() @@ -440,7 +440,7 @@ body { background: #ffffff; color: black; }
      • setWrapColumnOrWidth()
      • setWrapPolicy()
      • show() -
      • showChild() +
      • showChild()
      • showEvent()
      • showFullScreen()
      • showMaximized() @@ -468,7 +468,7 @@ body { background: #ffffff; color: black; }
      • textFormat()
      • timerEvent()
      • topLevelWidget() -
      • topMargin() +
      • topMargin()
      • tr()
      • trUtf8()
      • underline() @@ -479,22 +479,22 @@ body { background: #ffffff; color: black; }
      • unsetFont()
      • unsetPalette()
      • update() -
      • updateContents() +
      • updateContents()
      • updateGeometry()
      • updateMask() -
      • updateScrollBars() -
      • vScrollBarMode() -
      • verticalScrollBar() -
      • verticalSliderPressed() -
      • verticalSliderReleased() -
      • viewport() -
      • viewportPaintEvent() -
      • viewportResizeEvent() -
      • viewportSize() -
      • viewportToContents() -
      • visibleHeight() +
      • updateScrollBars() +
      • vScrollBarMode() +
      • verticalScrollBar() +
      • verticalSliderPressed() +
      • verticalSliderReleased() +
      • viewport() +
      • viewportPaintEvent() +
      • viewportResizeEvent() +
      • viewportSize() +
      • viewportToContents() +
      • visibleHeight()
      • visibleRect() -
      • visibleWidth() +
      • visibleWidth()
      • wheelEvent()
      • width()
      • winEvent() diff --git a/doc/html/tqtextedit.html b/doc/html/tqtextedit.html index 6538682c2..4bd89b6e9 100644 --- a/doc/html/tqtextedit.html +++ b/doc/html/tqtextedit.html @@ -34,7 +34,7 @@ body { background: #ffffff; color: black; }

        The TQTextEdit widget provides a powerful single-page rich text editor. More...

        #include <tqtextedit.h> -

        Inherits TQScrollView. +

        Inherits TQScrollView.

        Inherited by TQMultiLineEdit, TQTextBrowser, and TQTextView.

        List of all member functions.

        Public Members

        @@ -1357,7 +1357,7 @@ on demand, e.g. as the user scrolls, so you don't usually need to call this function.

        In some situations you may want to force the whole text to be formatted. For example, if after calling setText(), you wanted -to know the height of the document (using contentsHeight()), you +to know the height of the document (using contentsHeight()), you would call this function first.

        TQSyntaxHighlighter * TQTextEdit::syntaxHighlighter () const diff --git a/doc/html/tqtextview-members.html b/doc/html/tqtextview-members.html index d7dc8b22e..d261619a0 100644 --- a/doc/html/tqtextview-members.html +++ b/doc/html/tqtextview-members.html @@ -36,7 +36,7 @@ body { background: #ffffff; color: black; }

        Sets the widget's focus proxy to widget w. If w is 0, the function resets this widget to have no focus proxy. -

        Some widgets, such as TQComboBox, can "have focus", but create a +

        Some widgets, such as TQComboBox, can "have focus", but create a child widget to actually handle the focus. TQComboBox, for example, -creates a TQLineEdit which handles the focus. +creates a TQLineEdit which handles the focus.

        setFocusProxy() sets the widget which will actually get focus when "this widget" gets it. If there is a focus proxy, focusPolicy(), setFocusPolicy(), setFocus() and hasFocus() all operate on the @@ -2002,7 +2002,7 @@ focus proxy.

        void TQWidget::setFont ( const TQFont & ) [virtual]

        Sets the font currently set for the widget. See the "font" property for details. -

        Reimplemented in TQComboBox, TQLabel, and TQTabDialog. +

        Reimplemented in TQComboBox, TQLabel, and TQTabDialog.

        void TQWidget::setFont ( const TQFont & f, bool )

        @@ -2033,7 +2033,7 @@ See the "inputMethodEnabled" Enables key event compression, if compress is TRUE, and disables it if compress is FALSE. -

        Key compression is off by default (except for TQLineEdit and +

        Key compression is off by default (except for TQLineEdit and TQTextEdit), so widgets receive one key press event for each key press (or more, since autorepeat is usually on). If you turn it on and your program doesn't keep up with key input, TQt may try to @@ -2131,7 +2131,7 @@ See the "mouseTracking" property

        void TQWidget::setPalette ( const TQPalette & ) [virtual]

        Sets the widget's palette. See the "palette" property for details. -

        Reimplemented in TQComboBox, TQScrollBar, and TQSlider. +

        Reimplemented in TQComboBox, TQScrollBar, and TQSlider.

        void TQWidget::setPalette ( const TQPalette & p, bool )

        @@ -2260,8 +2260,8 @@ instead. If you need to do some delayed initialization use polish().

        See also showEvent(), hide(), showMinimized(), showMaximized(), showNormal(), visible, and polish(). -

        Examples: aclock/main.cpp, life/main.cpp, popup/popup.cpp, t1/main.cpp, t3/main.cpp, t4/main.cpp, and toplevel/options.ui.h. -

        Reimplemented in TQDialog and TQMenuBar. +

        Examples: aclock/main.cpp, life/main.cpp, popup/popup.cpp, t1/main.cpp, t3/main.cpp, t4/main.cpp, and toplevel/options.ui.h. +

        Reimplemented in TQDialog and TQMenuBar.

        void TQWidget::showEvent ( TQShowEvent * ) [virtual protected]

        This event handler can be reimplemented in a subclass to receive @@ -2721,7 +2721,7 @@ explicitly disabled. TQWidget::NoFocus).

        You must enable keyboard focus for a widget if it processes keyboard events. This is normally done from the widget's -constructor. For instance, the TQLineEdit constructor calls +constructor. For instance, the TQLineEdit constructor calls setFocusPolicy(TQWidget::StrongFocus).

        See also focusPolicy, focusInEvent(), focusOutEvent(), keyPressEvent(), keyReleaseEvent(), and enabled. @@ -2735,7 +2735,7 @@ focus by clicking, TQWidget::StrongFocus if it a all.

        You must enable keyboard focus for a widget if it processes keyboard events. This is normally done from the widget's -constructor. For instance, the TQLineEdit constructor calls +constructor. For instance, the TQLineEdit constructor calls setFocusPolicy(TQWidget::StrongFocus).

        See also focusEnabled, focusInEvent(), focusOutEvent(), keyPressEvent(), keyReleaseEvent(), and enabled. @@ -2846,7 +2846,7 @@ active window and for the popup.

        This property holds whether the widget is a dialog widget.

        A dialog widget is a secondary top-level widget, i.e. a top-level widget with a parent. -

        See also isTopLevel and TQDialog. +

        See also isTopLevel and TQDialog.

        Get this property's value with isDialog().

        bool isModal

        @@ -2854,7 +2854,7 @@ widget with a parent.

        This property only makes sense for top-level widgets. A modal widget prevents widgets in all other top-level widgets from getting any input. -

        See also isTopLevel, isDialog, and TQDialog. +

        See also isTopLevel, isDialog, and TQDialog.

        Get this property's value with isModal().

        bool isPopup

        @@ -2873,7 +2873,7 @@ top-level widget. when the parent is deleted, minimized when the parent is minimized etc. If supported by the window manager, it will also have a common taskbar entry with its parent. -

        TQDialog and TQMainWindow widgets are by default top-level, even if +

        TQDialog and TQMainWindow widgets are by default top-level, even if a parent widget is specified in the constructor. This behavior is specified by the WType_TopLevel widget flag.

        See also topLevelWidget(), isDialog, isModal, isPopup, isDesktop, and parentWidget(). @@ -3128,13 +3128,13 @@ widget can be freely resized, but prefers to be the size sizeHint() returns. Button-like widgets set the size policy to specify that they may stretch horizontally, but are fixed vertically. The same applies to lineedit controls (such as -TQLineEdit, TQSpinBox or an editable TQComboBox) and other +TQLineEdit, TQSpinBox or an editable TQComboBox) and other horizontally orientated widgets (such as TQProgressBar). TQToolButton's are normally square, so they allow growth in both directions. Widgets that support different directions (such as -TQSlider, TQScrollBar or TQHeader) specify stretching in the +TQSlider, TQScrollBar or TQHeader) specify stretching in the respective direction only. Widgets that can provide scrollbars -(usually subclasses of TQScrollView) tend to specify that they can +(usually subclasses of TQScrollView) tend to specify that they can use additional space, and that they can make do with less than sizeHint().

        See also sizeHint, TQLayout, TQSizePolicy, and updateGeometry(). diff --git a/doc/html/tutorial1-01.html b/doc/html/tutorial1-01.html index 9542b18e5..8edf315ca 100644 --- a/doc/html/tutorial1-01.html +++ b/doc/html/tutorial1-01.html @@ -43,14 +43,14 @@ The picture above is a snapshot of this program. ****************************************************************/ #include <ntqapplication.h> -#include <ntqpushbutton.h> +#include <tqpushbutton.h> int main( int argc, char **argv ) { TQApplication a( argc, argv ); - TQPushButton hello( "Hello world!", 0 ); + TQPushButton hello( "Hello world!", 0 ); hello.resize( 100, 30 ); a.setMainWidget( &hello ); @@ -69,9 +69,9 @@ int main( int argc, char **argv ) exactly one TQApplication object in every application that uses TQt. TQApplication manages various application-wide resources, such as the default font and cursor. -

            #include <ntqpushbutton.h>
        +

            #include <tqpushbutton.h>
         
        -

        This line includes the TQPushButton class definition. The +

        This line includes the TQPushButton class definition. The reference documentation for each class mentions at the top which file needs to be included to use that class.

        TQPushButton is a classical GUI push button that the user can press @@ -99,7 +99,7 @@ Note that all command-line arguments recognized by TQt are removed from argv (and argc is decremented accordingly). See the TQApplication::argv() documentation for details.

        Note: It is essential that the TQApplication object be created before any window-system parts of TQt are used. -

                TQPushButton hello( "Hello world!", 0 );
        +

                TQPushButton hello( "Hello world!", 0 );
         

        Here, after the TQApplication, comes the first window-system code: A push button is created. diff --git a/doc/html/tutorial1-02.html b/doc/html/tutorial1-02.html index cf2792e4b..a35de0e75 100644 --- a/doc/html/tutorial1-02.html +++ b/doc/html/tutorial1-02.html @@ -43,7 +43,7 @@ now go on to make the application quit properly when the user tells it to. ****************************************************************/ #include <ntqapplication.h> -#include <ntqpushbutton.h> +#include <tqpushbutton.h> #include <tqfont.h> @@ -51,7 +51,7 @@ int main( int argc, char **argv ) { TQApplication a( argc, argv ); - TQPushButton quit( "Quit", 0 ); + TQPushButton quit( "Quit", 0 ); quit.resize( 75, 30 ); quit.setFont( TQFont( "Times", 18, TQFont::Bold ) ); @@ -72,7 +72,7 @@ int main( int argc, char **argv )

        Since this program uses TQFont, it needs to include tqfont.h. TQt's font abstraction is rather different from the horror provided by X, and loading and using fonts has been highly optimized. -

                TQPushButton quit( "Quit", 0 );
        +

                TQPushButton quit( "Quit", 0 );
         

        This time, the button says "Quit" and that's exactly what the program will do when the user clicks the button. This is not a coincidence. @@ -111,7 +111,7 @@ makefile and build the application.)

        Try to resize the window. Press the button. Oops! That connect() would seem to make some difference. -

        Are there any other signals in TQPushButton you can connect to quit? +

        Are there any other signals in TQPushButton you can connect to quit? Hint: The TQPushButton inherits most of its behavior from TQButton.

        You're now ready for Chapter 3.

        [Previous tutorial] diff --git a/doc/html/tutorial1-03.html b/doc/html/tutorial1-03.html index bdd050a75..cbd73786c 100644 --- a/doc/html/tutorial1-03.html +++ b/doc/html/tutorial1-03.html @@ -42,7 +42,7 @@ body { background: #ffffff; color: black; } ****************************************************************/ #include <ntqapplication.h> -#include <ntqpushbutton.h> +#include <tqpushbutton.h> #include <tqfont.h> #include <ntqvbox.h> @@ -53,7 +53,7 @@ int main( int argc, char **argv ) TQVBox box; box.resize( 200, 120 ); - TQPushButton quit( "Quit", &box ); + TQPushButton quit( "Quit", &box ); quit.setFont( TQFont( "Times", 18, TQFont::Bold ) ); TQObject::connect( &quit, TQ_SIGNAL(clicked()), &a, TQ_SLOT(quit()) ); @@ -80,10 +80,10 @@ space according to each child's TQWidget::siz

                box.resize( 200, 120 );
         

        We set its width to 200 pixels and the height to 120 pixels. -

                TQPushButton quit( "Quit", &box );
        +

                TQPushButton quit( "Quit", &box );
         

        A child is born. -

        This TQPushButton is created with both a text ("Quit") and a parent +

        This TQPushButton is created with both a text ("Quit") and a parent (box). A child widget is always on top of its parent. When displayed, it is clipped by its parent's bounds.

        The parent widget, the TQVBox, automatically adds the child centered in diff --git a/doc/html/tutorial1-04.html b/doc/html/tutorial1-04.html index c1d8ea2c4..2dffeb4e3 100644 --- a/doc/html/tutorial1-04.html +++ b/doc/html/tutorial1-04.html @@ -42,7 +42,7 @@ minimum and maximum sizes of a widget, and introduces widget names. ****************************************************************/ #include <ntqapplication.h> -#include <ntqpushbutton.h> +#include <tqpushbutton.h> #include <tqfont.h> @@ -59,7 +59,7 @@ public: setMinimumSize( 200, 120 ); setMaximumSize( 200, 120 ); - TQPushButton *quit = new TQPushButton( "Quit", this, "quit" ); + TQPushButton *quit = new TQPushButton( "Quit", this, "quit" ); quit->setGeometry( 62, 40, 75, 30 ); quit->setFont( TQFont( "Times", 18, TQFont::Bold ) ); @@ -116,7 +116,7 @@ constructor.

        Because this widget doesn't know how to handle resizing, we fix its size by setting the minimum and maximum to be equal. In the next chapter we will show how a widget can respond to resize event from the user. -

                TQPushButton *quit = new TQPushButton( "Quit", this, "quit" );
        +

                TQPushButton *quit = new TQPushButton( "Quit", this, "quit" );
                 quit->setGeometry( 62, 40, 75, 30 );
                 quit->setFont( TQFont( "Times", 18, TQFont::Bold ) );
         
        @@ -166,7 +166,7 @@ makefile and build the application.)

        Exercises

        Try to create another MyWidget object in main(). What happens? -

        Try to add more buttons or put in widgets other than TQPushButton. +

        Try to add more buttons or put in widgets other than TQPushButton.

        You're now ready for Chapter 5.

        [Previous tutorial] [Next tutorial] diff --git a/doc/html/tutorial1-05.html b/doc/html/tutorial1-05.html index e5c0abe87..eecccbc7b 100644 --- a/doc/html/tutorial1-05.html +++ b/doc/html/tutorial1-05.html @@ -42,9 +42,9 @@ by using signals and slots, and how to handle resize events. ****************************************************************/ #include <ntqapplication.h> -#include <ntqpushbutton.h> -#include <ntqslider.h> -#include <ntqlcdnumber.h> +#include <tqpushbutton.h> +#include <tqslider.h> +#include <tqlcdnumber.h> #include <tqfont.h> #include <ntqvbox.h> @@ -59,18 +59,18 @@ public: MyWidget::MyWidget( TQWidget *parent, const char *name ) : TQVBox( parent, name ) { - TQPushButton *quit = new TQPushButton( "Quit", this, "quit" ); + TQPushButton *quit = new TQPushButton( "Quit", this, "quit" ); quit->setFont( TQFont( "Times", 18, TQFont::Bold ) ); connect( quit, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) ); - TQLCDNumber *lcd = new TQLCDNumber( 2, this, "lcd" ); + TQLCDNumber *lcd = new TQLCDNumber( 2, this, "lcd" ); - TQSlider * slider = new TQSlider( Horizontal, this, "slider" ); + TQSlider * slider = new TQSlider( Horizontal, this, "slider" ); slider->setRange( 0, 99 ); - slider->setValue( 0 ); + slider->setValue( 0 ); - connect( slider, TQ_SIGNAL(valueChanged(int)), lcd, TQ_SLOT(display(int)) ); + connect( slider, TQ_SIGNAL(valueChanged(int)), lcd, TQ_SLOT(display(int)) ); } int main( int argc, char **argv ) @@ -89,15 +89,15 @@ int main( int argc, char **argv )

        Line-by-line Walkthrough

            #include <ntqapplication.h>
        -    #include <ntqpushbutton.h>
        -    #include <ntqslider.h>
        -    #include <ntqlcdnumber.h>
        +    #include <tqpushbutton.h>
        +    #include <tqslider.h>
        +    #include <tqlcdnumber.h>
             #include <tqfont.h>
         
             #include <ntqvbox.h>
         
        -

        Three new include files are shown here. ntqslider.h and ntqlcdnumber.h are there -because we use two new widgets, TQSlider and TQLCDNumber. ntqvbox.h is +

        Three new include files are shown here. tqslider.h and tqlcdnumber.h are there +because we use two new widgets, TQSlider and TQLCDNumber. ntqvbox.h is here because we use TQt's automatic layout support.

            class MyWidget : public TQVBox
             {
        @@ -114,19 +114,19 @@ here because we use TQt's automatic layout support.
         the layout of the TQVBox (which places all of its children vertically
         inside itself). Resizes are now handled automatically by the TQVBox and
         therefore by MyWidget, too.
        -

                TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd" );
        +

                TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd" );
         

        lcd is a TQLCDNumber, a widget that displays numbers in an LCD-like fashion. This instance is set up to display two digits and to be a child of this. It is named "lcd". -

                TQSlider * slider = new TQSlider( Horizontal, this, "slider" );
        +

                TQSlider * slider = new TQSlider( Horizontal, this, "slider" );
                 slider->setRange( 0, 99 );
        -        slider->setValue( 0 );
        +        slider->setValue( 0 );
         
        -

        TQSlider is a classical slider; the user can use the widget to drag +

        TQSlider is a classical slider; the user can use the widget to drag something to adjust an integer value in a range. Here we create a horizontal one, set its range to 0-99 (inclusive, see the TQSlider::setRange() documentation) and its initial value to 0. -

                connect( slider, TQ_SIGNAL(valueChanged(int)), lcd, TQ_SLOT(display(int)) );
        +

                connect( slider, TQ_SIGNAL(valueChanged(int)), lcd, TQ_SLOT(display(int)) );
         

        Here we use the signal/slot mechanism to connect the slider's valueChanged() signal to the LCD number's @@ -148,10 +148,10 @@ others stay about the same (because otherwise they would look stupid). makefile and build the application.)

        Exercises

        -

        Try changing the LCD number to add more digits or to change mode. You can even add four push +

        Try changing the LCD number to add more digits or to change mode. You can even add four push buttons to set the number base.

        You can also change the slider's range. -

        Perhaps it would have been better to use TQSpinBox than a slider? +

        Perhaps it would have been better to use TQSpinBox than a slider?

        Try to make the application quit when the LCD number overflows.

        You're now ready for Chapter 6.

        [Previous tutorial] diff --git a/doc/html/tutorial1-06.html b/doc/html/tutorial1-06.html index 288b6e6b6..58daffe70 100644 --- a/doc/html/tutorial1-06.html +++ b/doc/html/tutorial1-06.html @@ -44,9 +44,9 @@ widget as a child widget. ****************************************************************/ #include <ntqapplication.h> -#include <ntqpushbutton.h> -#include <ntqslider.h> -#include <ntqlcdnumber.h> +#include <tqpushbutton.h> +#include <tqslider.h> +#include <tqlcdnumber.h> #include <tqfont.h> #include <ntqvbox.h> #include <ntqgrid.h> @@ -60,11 +60,11 @@ public: LCDRange::LCDRange( TQWidget *parent, const char *name ) : TQVBox( parent, name ) { - TQLCDNumber *lcd = new TQLCDNumber( 2, this, "lcd" ); - TQSlider * slider = new TQSlider( Horizontal, this, "slider" ); + TQLCDNumber *lcd = new TQLCDNumber( 2, this, "lcd" ); + TQSlider * slider = new TQSlider( Horizontal, this, "slider" ); slider->setRange( 0, 99 ); - slider->setValue( 0 ); - connect( slider, TQ_SIGNAL(valueChanged(int)), lcd, TQ_SLOT(display(int)) ); + slider->setValue( 0 ); + connect( slider, TQ_SIGNAL(valueChanged(int)), lcd, TQ_SLOT(display(int)) ); } class MyWidget : public TQVBox @@ -77,7 +77,7 @@ public: MyWidget::MyWidget( TQWidget *parent, const char *name ) : TQVBox( parent, name ) { - TQPushButton *quit = new TQPushButton( "Quit", this, "quit" ); + TQPushButton *quit = new TQPushButton( "Quit", this, "quit" ); quit->setFont( TQFont( "Times", 18, TQFont::Bold ) ); connect( quit, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) ); @@ -115,11 +115,11 @@ constructor. This sort of widget is not very useful, so we'll add some API later

            LCDRange::LCDRange( TQWidget *parent, const char *name )
                     : TQVBox( parent, name )
             {
        -        TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
        -        TQSlider * slider = new TQSlider( Horizontal, this, "slider" );
        +        TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
        +        TQSlider * slider = new TQSlider( Horizontal, this, "slider" );
                 slider->setRange( 0, 99 );
        -        slider->setValue( 0 );
        -        connect( slider, TQ_SIGNAL(valueChanged(int)), lcd, TQ_SLOT(display(int)) );
        +        slider->setValue( 0 );
        +        connect( slider, TQ_SIGNAL(valueChanged(int)), lcd, TQ_SLOT(display(int)) );
             }
         

        This is lifted straight from the @@ -136,7 +136,7 @@ is renamed.

            MyWidget::MyWidget( TQWidget *parent, const char *name )
                     : TQVBox( parent, name )
             {
        -        TQPushButton *quit = new TQPushButton( "Quit", this, "quit" );
        +        TQPushButton *quit = new TQPushButton( "Quit", this, "quit" );
                 quit->setFont( TQFont( "Times", 18, TQFont::Bold ) );
         
                 connect( quit, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) );
        diff --git a/doc/html/tutorial1-07.html b/doc/html/tutorial1-07.html
        index 5d8fc4bec..0de193aeb 100644
        --- a/doc/html/tutorial1-07.html
        +++ b/doc/html/tutorial1-07.html
        @@ -62,11 +62,11 @@ header file.
         

        ntqvbox.h is included. LCDRange inherits TQVBox, and the header file of a parent class must always be included. We cheated a bit in the previous chapters, and we let tqwidget.h be included indirectly via -other header files such as ntqpushbutton.h. +other header files such as tqpushbutton.h.

            class TQSlider;
         

        This is another classic trick, but one that's much less used often. Because -we don't need TQSlider in the interface of the class, only in the +we don't need TQSlider in the interface of the class, only in the implementation, we use a forward declaration of the class in the header file and include the header file for TQSlider in the .cpp file. @@ -110,9 +110,9 @@ signal you'll see called somethingChanged().

        This file is mainly lifted from t6/main.cpp, and only the changes are noted here. -

                connect( slider, TQ_SIGNAL(valueChanged(int)),
        -                 lcd, TQ_SLOT(display(int)) );
        -        connect( slider, TQ_SIGNAL(valueChanged(int)),
        +

                connect( slider, TQ_SIGNAL(valueChanged(int)),
        +                 lcd, TQ_SLOT(display(int)) );
        +        connect( slider, TQ_SIGNAL(valueChanged(int)),
                          TQ_SIGNAL(valueChanged(int)) );
         

        This code is from the LCDRange constructor. @@ -125,23 +125,23 @@ the first is emitted, the second signal is also emitted.

        Let's look at what happens when the user operates the slider. The slider sees that its value has changed and emits the valueChanged() signal. That signal is connected both to the display() slot of the -TQLCDNumber and to the valueChanged() signal of the LCDRange. +TQLCDNumber and to the valueChanged() signal of the LCDRange.

        Thus, when the signal is emitted, LCDRange emits its own -valueChanged() signal. In addition, TQLCDNumber::display() is called +valueChanged() signal. In addition, TQLCDNumber::display() is called and shows the new number.

        Note that you're not guaranteed any particular order of execution - LCDRange::valueChanged() may be emitted before or after TQLCDNumber::display()and is entirely arbitrary.

            int LCDRange::value() const
             {
        -        return slider->value();
        +        return slider->value();
             }
         

        The implementation of value() is straightforward; it simply returns the slider's value.

            void LCDRange::setValue( int value )
             {
        -        slider->setValue( value );
        +        slider->setValue( value );
             }
         

        The implementation of setValue() is equally straightforward. Note diff --git a/doc/html/tutorial1-08.html b/doc/html/tutorial1-08.html index 4eda29b4d..57ffa0587 100644 --- a/doc/html/tutorial1-08.html +++ b/doc/html/tutorial1-08.html @@ -73,7 +73,7 @@ Until now, it has been fixed at 0..99. }

        SetRange() sets the range of the slider in the LCDRange. Because we -have set up the TQLCDNumber to always display two digits, we want to +have set up the TQLCDNumber to always display two digits, we want to limit the possible range of minVal and maxVal to 0..99 to avoid overflow of the TQLCDNumber. (We could have allowed values down to -9 but chose not to.) If the arguments are illegal, we use TQt's @@ -256,7 +256,7 @@ to be terribly useful. However, its constructor just got a new line:

        The LCDRange sets the slider to be its focus proxy. That means that when someone (the program or the user) wants to give the LCDRange -keyboard focus, the slider should take care of it. TQSlider has a decent +keyboard focus, the slider should take care of it. TQSlider has a decent keyboard interface, so with just one line of code we've given LCDRange one.

        Behavior diff --git a/doc/html/tutorial1-10.html b/doc/html/tutorial1-10.html index 5f59affa6..e476b83ef 100644 --- a/doc/html/tutorial1-10.html +++ b/doc/html/tutorial1-10.html @@ -219,7 +219,7 @@ makefile and build the application.)

        Put the cannon in the bottom-right corner.

        Try adding a better keyboard interface. For example, make + and - increase and decrease the force and enter shoot. Hint: TQAccel and -new addStep() and subtractStep() slots in LCDRange, like TQSlider::addStep(). If you're bothered by the way the left and right +new addStep() and subtractStep() slots in LCDRange, like TQSlider::addStep(). If you're bothered by the way the left and right keys work (I am!), change that too.

        You're now ready for Chapter 11.

        [Previous tutorial] diff --git a/doc/html/tutorial1-11.html b/doc/html/tutorial1-11.html index 1385646c1..09ad736be 100644 --- a/doc/html/tutorial1-11.html +++ b/doc/html/tutorial1-11.html @@ -215,7 +215,7 @@ integer. };

        The only addition is the Shoot button. -

                TQPushButton *shoot = new TQPushButton( "&Shoot", this, "shoot" );
        +

                TQPushButton *shoot = new TQPushButton( "&Shoot", this, "shoot" );
                 shoot->setFont( TQFont( "Times", 18, TQFont::Bold ) );
         

        In the constructor we create and set up the Shoot button exactly like we diff --git a/doc/html/tutorial1-12.html b/doc/html/tutorial1-12.html index ef3cabd86..8fd714dfe 100644 --- a/doc/html/tutorial1-12.html +++ b/doc/html/tutorial1-12.html @@ -109,17 +109,17 @@ initialization code.

        This constructor first calls init() and then sets the label text.

            void LCDRange::init()
             {
        -        TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
        -        slider = new TQSlider( Horizontal, this, "slider" );
        +        TQLCDNumber *lcd  = new TQLCDNumber( 2, this, "lcd"  );
        +        slider = new TQSlider( Horizontal, this, "slider" );
                 slider->setRange( 0, 99 );
        -        slider->setValue( 0 );
        +        slider->setValue( 0 );
         
                 label = new TQLabel( " ", this, "label"  );
                 label->setAlignment( AlignCenter );
         
        -        connect( slider, TQ_SIGNAL(valueChanged(int)),
        -                 lcd, TQ_SLOT(display(int)) );
        -        connect( slider, TQ_SIGNAL(valueChanged(int)),
        +        connect( slider, TQ_SIGNAL(valueChanged(int)),
        +                 lcd, TQ_SLOT(display(int)) );
        +        connect( slider, TQ_SIGNAL(valueChanged(int)),
                          TQ_SIGNAL(valueChanged(int)) );
         
                 setFocusProxy( slider );
        diff --git a/doc/html/tutorial1-13.html b/doc/html/tutorial1-13.html
        index c2a54718f..b9b83a367 100644
        --- a/doc/html/tutorial1-13.html
        +++ b/doc/html/tutorial1-13.html
        @@ -90,7 +90,7 @@ except that we've added some lines at the end:
         widget's children.
         

                l->addWidget( lcd, 1 );
         
        -

        At the top we add the TQLCDNumber with a non-zero stretch. +

        At the top we add the TQLCDNumber with a non-zero stretch.

                l->addWidget( slider );
                 l->addWidget( label );
         
        @@ -235,8 +235,8 @@ which was last seen as MyWidget. void newGame(); private: - TQLCDNumber *hits; - TQLCDNumber *shotsLeft; + TQLCDNumber *hits; + TQLCDNumber *shotsLeft; CannonField *cannonField; };
        @@ -278,7 +278,7 @@ working with self-contained components.

        We also use the cannonField's canShoot() signal to enable or disable the Shoot button appropriately.

                TQPushButton *restart
        -            = new TQPushButton( "&New Game", this, "newgame" );
        +            = new TQPushButton( "&New Game", this, "newgame" );
                 restart->setFont( TQFont( "Times", 18, TQFont::Bold ) );
         
                 connect( restart, TQ_SIGNAL(clicked()), this, TQ_SLOT(newGame()) );
        @@ -286,8 +286,8 @@ the Shoot button appropriately.
         

        We create, set up, and connect the New Game button as we have done with the other buttons. Clicking this button will activate the newGame() slot in this widget. -

                hits = new TQLCDNumber( 2, this, "hits" );
        -        shotsLeft = new TQLCDNumber( 2, this, "shotsleft" );
        +

                hits = new TQLCDNumber( 2, this, "hits" );
        +        shotsLeft = new TQLCDNumber( 2, this, "shotsleft" );
                 TQLabel *hitsL = new TQLabel( "HITS", this, "hitsLabel" );
                 TQLabel *shotsLeftL
                     = new TQLabel( "SHOTS LEFT", this, "shotsleftLabel" );
        @@ -322,7 +322,7 @@ ordinary functions, too.)
             {
                 if ( cannonField->gameOver() || cannonField->isShooting() )
                     return;
        -        shotsLeft->display( shotsLeft->intValue() - 1 );
        +        shotsLeft->display( shotsLeft->intValue() - 1 );
                 cannonField->shoot();
             }
         
        @@ -331,8 +331,8 @@ air, we return immediately. We decrement the number of shots left and tell the cannon to shoot.

            void GameBoard::hit()
             {
        -        hits->display( hits->intValue() + 1 );
        -        if ( shotsLeft->intValue() == 0 )
        +        hits->display( hits->intValue() + 1 );
        +        if ( shotsLeft->intValue() == 0 )
                     cannonField->setGameOver();
                 else
                     cannonField->newTarget();
        @@ -343,7 +343,7 @@ number of hits. If there are no shots left, the game is over. Otherwise,
         we make the CannonField generate a new target.
         

            void GameBoard::missed()
             {
        -        if ( shotsLeft->intValue() == 0 )
        +        if ( shotsLeft->intValue() == 0 )
                     cannonField->setGameOver();
             }
         
        @@ -351,8 +351,8 @@ we make the CannonField generate a new target. shots left, the game is over.

            void GameBoard::newGame()
             {
        -        shotsLeft->display( 15 );
        -        hits->display( 0 );
        +        shotsLeft->display( 15 );
        +        hits->display( 0 );
                 cannonField->restartGame();
                 cannonField->newTarget();
             }
        diff --git a/doc/html/tutorial2-05.html b/doc/html/tutorial2-05.html
        index b48f9e3dd..df6209736 100644
        --- a/doc/html/tutorial2-05.html
        +++ b/doc/html/tutorial2-05.html
        @@ -535,7 +535,7 @@ and edit values, value colors, etc.
                 OptionsForm *optionsForm = new OptionsForm( this );
                 optionsForm->chartTypeComboBox->setCurrentItem( m_chartType );
                 optionsForm->setFont( m_font );
        -
                if ( optionsForm->exec() ) {
        +
                if ( optionsForm->exec() ) {
                     setChartType( ChartType(
                             optionsForm->chartTypeComboBox->currentItem()) );
                     m_font = optionsForm->font();
        @@ -555,7 +555,7 @@ elements.
         
            void ChartForm::optionsSetData()
             {
                 SetDataForm *setDataForm = new SetDataForm( &m_elements, m_decimalPlaces, this );
        -        if ( setDataForm->exec() ) {
        +        if ( setDataForm->exec() ) {
                     m_changed = TRUE;
                     drawElements();
                 }
        diff --git a/doc/html/tutorial2-06.html b/doc/html/tutorial2-06.html
        index 3f2c03868..d57d8cf9e 100644
        --- a/doc/html/tutorial2-06.html
        +++ b/doc/html/tutorial2-06.html
        @@ -271,7 +271,7 @@ vector.
         

        (Extracts from canvasview.cpp.)

        -

            void CanvasView::contentsContextMenuEvent( TQContextMenuEvent * )
        +
            void CanvasView::contentsContextMenuEvent( TQContextMenuEvent * )
             {
                 ((ChartForm*)parent())->optionsMenu->exec( TQCursor::pos() );
             }
        @@ -282,7 +282,7 @@ to the right type and then exec()ute the options menu at the cursor
         position. 
         

        Handling Resizing

        -

            void CanvasView::viewportResizeEvent( TQResizeEvent *e )
        +

            void CanvasView::viewportResizeEvent( TQResizeEvent *e )
             {
                 canvas()->resize( e->size().width(), e->size().height() );
                 ((ChartForm*)parent())->drawElements();
        @@ -297,7 +297,7 @@ drawn correctly.
         
         

        When the user wants to drag a label into position they click it, then drag and release at the new position. -

            void CanvasView::contentsMousePressEvent( TQMouseEvent *e )
        +

            void CanvasView::contentsMousePressEvent( TQMouseEvent *e )
             {
                 TQCanvasItemList list = canvas()->collisions( e->pos() );
                 for ( TQCanvasItemList::iterator it = list.begin(); it != list.end(); ++it )
        @@ -313,7 +313,7 @@ drag and release at the new position.
         the mouse click "collided" with (if any). We then iterate over this
         list and if we find a CanvasText item we set it as the moving item
         and record its position. Otherwise we set there to be no moving item.
        -

            void CanvasView::contentsMouseMoveEvent( TQMouseEvent *e )
        +

            void CanvasView::contentsMouseMoveEvent( TQMouseEvent *e )
             {
                 if ( m_movingItem ) {
                     TQPoint offset = e->pos() - m_pos;
        diff --git a/doc/html/tutorial2-08.html b/doc/html/tutorial2-08.html
        index da9766384..6bd21ee6b 100644
        --- a/doc/html/tutorial2-08.html
        +++ b/doc/html/tutorial2-08.html
        @@ -40,7 +40,7 @@ enter label text and choose a label color for each label.
         

        (Extracts from setdataform.h.)

        -

            class SetDataForm: public TQDialog
        +
            class SetDataForm: public TQDialog
             {
                 TQ_OBJECT
             public:
        @@ -60,9 +60,9 @@ enter label text and choose a label color for each label.
         
             private:
                 TQTable *table;
        -        TQPushButton *colorPushButton;
        -        TQPushButton *okPushButton;
        -        TQPushButton *cancelPushButton;
        +        TQPushButton *colorPushButton;
        +        TQPushButton *okPushButton;
        +        TQPushButton *cancelPushButton;
         
             protected:
                 TQVBoxLayout *tableButtonBox;
        @@ -90,13 +90,13 @@ TQt supports. We'll use these in the pattern combobox.
         

            SetDataForm::SetDataForm( ElementVector *elements, int decimalPlaces,
                                       TQWidget* parent,  const char* name,
                                       bool modal, WFlags f )
        -        : TQDialog( parent, name, modal, f )
        +        : TQDialog( parent, name, modal, f )
         
             {
                 m_elements = elements;
                 m_decimalPlaces = decimalPlaces;
         
        -

        We pass most of the arguments to the TQDialog superclass. We assign the +

        We pass most of the arguments to the TQDialog superclass. We assign the elements vector pointer and the number of decimal places to display to member variables so that they are accessible by all SetDataForm's member functions. @@ -139,7 +139,7 @@ column and finally add the table to the tableButtonBox layout.

                buttonBox = new TQHBoxLayout( 0, 0, 6, "button box layout" );
         

        We create a horizontal box layout to hold the buttons. -

                colorPushButton = new TQPushButton( this, "color button" );
        +

                colorPushButton = new TQPushButton( this, "color button" );
                 colorPushButton->setText( "&Color..." );
                 colorPushButton->setEnabled( FALSE );
                 buttonBox->addWidget( colorPushButton );
        @@ -153,12 +153,12 @@ on a color cell.
         

        Since we want to separate the color button from the OK and Cancel buttons we next create a spacer and add that to the buttonBox layout. -

                okPushButton = new TQPushButton( this, "ok button" );
        +

                okPushButton = new TQPushButton( this, "ok button" );
                 okPushButton->setText( "OK" );
        -        okPushButton->setDefault( TRUE );
        +        okPushButton->setDefault( TRUE );
                 buttonBox->addWidget( okPushButton );
         
        -        cancelPushButton = new TQPushButton( this, "cancel button" );
        +        cancelPushButton = new TQPushButton( this, "cancel button" );
                 cancelPushButton->setText( "Cancel" );
                 cancelPushButton->setAccel( Key_Escape );
                 buttonBox->addWidget( cancelPushButton );
        @@ -177,8 +177,8 @@ complete.
                 connect( table, TQ_SIGNAL( valueChanged(int,int) ),
                          this, TQ_SLOT( valueChanged(int,int) ) );
                 connect( colorPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( setColor() ) );
        -        connect( okPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
        -        connect( cancelPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
        +        connect( okPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
        +        connect( cancelPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
         

        We now "wire up" the form.

          @@ -194,7 +194,7 @@ correct number of decimal places.
        • If the user clicks the Color button we call a setColor() slot.
        • The OK button is connected to the accept() slot; we will update the elements vector in this slot. -
        • The Cancel button is connected to the TQDialog reject() slot, and +
        • The Cancel button is connected to the TQDialog reject() slot, and requires no further code or action on our part.

                TQPixmap patterns[MAX_PATTERNS];
        @@ -221,10 +221,10 @@ create a blank pixmap of that size.
                     table->setPixmap( i, 1, pix );
                     table->setText( i, 1, color.name() );
         
        -            TQComboBox *combobox = new TQComboBox;
        +            TQComboBox *combobox = new TQComboBox;
                     for ( int j = 0; j < MAX_PATTERNS; ++j )
        -                combobox->insertItem( patterns[j] );
        -            combobox->setCurrentItem( element.valuePattern() - 1 );
        +                combobox->insertItem( patterns[j] );
        +            combobox->setCurrentItem( element.valuePattern() - 1 );
                     table->setCellWidget( i, 2, combobox );
         
                     table->setText( i, 3, element.label() );
        @@ -246,9 +246,9 @@ CanvasText subclass) and store the color there. But we've taken a
         simpler route: we set the cell's text to the name of the color.
         

        Next we populate the pattern combobox with the patterns. We will use the position of the chosen pattern in the combobox to determine which -pattern the user has selected. TQTable can make use of TQComboTableItem +pattern the user has selected. TQTable can make use of TQComboTableItem items; but these only support text, so we use setCellWidget() to -insert TQComboBox's into the table instead. +insert TQComboBox's into the table instead.

        Next we insert the element's label. Finally we set the label color in the same way as we set the value color.

        The Slots @@ -305,7 +305,7 @@ function and put the focus back into the table. the static TQColorDialog::getColor() dialog to get the user's choice of color. If they chose a color we fill the color cell's pixmap with that color and set the cell's text to the new color's name. -

            void SetDataForm::accept()
        +

            void SetDataForm::accept()
             {
                 bool ok;
                 for ( int i = 0; i < ChartForm::MAX_ELEMENTS; ++i ) {
        @@ -322,7 +322,7 @@ color and set the cell's text to the new color's name.
                     element.setLabelColor( TQColor( table->text( i, 4 ) ) );
                 }
         
        -        TQDialog::accept();
        +        TQDialog::accept();
             }
         

        If the user clicks OK we must update the elements vector. We iterate @@ -332,7 +332,7 @@ and the label color by constructing TQColor temporari color name as argument. The pattern is set to the pattern combobox's current item with an offset of 1 (since our pattern numbers begin at 1, but the combobox's items are indexed from 0). -

        Finally we call TQDialog::accept(). +

        Finally we call TQDialog::accept().

        « File Handling | Contents | diff --git a/doc/html/tutorial2-09.html b/doc/html/tutorial2-09.html index 174c2d3e1..4f86c92ef 100644 --- a/doc/html/tutorial2-09.html +++ b/doc/html/tutorial2-09.html @@ -39,7 +39,7 @@ apply to all data sets in one place.

        (Extracts from optionsform.h.)

        -

            class OptionsForm : public TQDialog
        +
            class OptionsForm : public TQDialog
             {
                 TQ_OBJECT
             public:
        @@ -51,18 +51,18 @@ apply to all data sets in one place.
                 void setFont( TQFont font );
         
                 TQLabel *chartTypeTextLabel;
        -        TQComboBox *chartTypeComboBox;
        -        TQPushButton *fontPushButton;
        +        TQComboBox *chartTypeComboBox;
        +        TQPushButton *fontPushButton;
                 TQLabel *fontTextLabel;
                 TQFrame *addValuesFrame;
                 TQButtonGroup *addValuesButtonGroup;
        -        TQRadioButton *noRadioButton;
        -        TQRadioButton *yesRadioButton;
        -        TQRadioButton *asPercentageRadioButton;
        +        TQRadioButton *noRadioButton;
        +        TQRadioButton *yesRadioButton;
        +        TQRadioButton *asPercentageRadioButton;
                 TQLabel *decimalPlacesTextLabel;
        -        TQSpinBox *decimalPlacesSpinBox;
        -        TQPushButton *okPushButton;
        -        TQPushButton *cancelPushButton;
        +        TQSpinBox *decimalPlacesSpinBox;
        +        TQPushButton *okPushButton;
        +        TQPushButton *cancelPushButton;
         
             protected slots:
                 void chooseFont();
        @@ -97,12 +97,12 @@ things based on the changes the user makes.
         

            OptionsForm::OptionsForm( TQWidget* parent, const char* name,
                                       bool modal, WFlags f )
        -        : TQDialog( parent, name, modal, f )
        +        : TQDialog( parent, name, modal, f )
             {
                 setCaption( "Chart -- Options" );
                 resize( 320, 290 );
         
        -

        We pass all the arguments on to the TQDialog constructor, set a caption +

        We pass all the arguments on to the TQDialog constructor, set a caption and set an initial size.

        The layout of the form will be to have the chart type label and combo box in a horizontal box layout, and similarly for the font button and @@ -120,11 +120,11 @@ vertical box layout.

                chartTypeTextLabel = new TQLabel( "&Chart Type", this );
                 chartTypeLayout->addWidget( chartTypeTextLabel );
         
        -        chartTypeComboBox = new TQComboBox( FALSE, this );
        -        chartTypeComboBox->insertItem( TQPixmap( options_piechart ), "Pie Chart" );
        -        chartTypeComboBox->insertItem( TQPixmap( options_verticalbarchart ),
        +        chartTypeComboBox = new TQComboBox( FALSE, this );
        +        chartTypeComboBox->insertItem( TQPixmap( options_piechart ), "Pie Chart" );
        +        chartTypeComboBox->insertItem( TQPixmap( options_verticalbarchart ),
                                                "Vertical Bar Chart" );
        -        chartTypeComboBox->insertItem( TQPixmap( options_horizontalbarchart ),
        +        chartTypeComboBox->insertItem( TQPixmap( options_horizontalbarchart ),
                                                "Horizontal Bar Chart" );
                 chartTypeLayout->addWidget( chartTypeComboBox );
                 optionsFormLayout->addLayout( chartTypeLayout );
        @@ -136,7 +136,7 @@ to the horizontal layout and add the horizontal layout to the form's
         vertical layout.
         

                fontLayout = new TQHBoxLayout( 0, 0, 6 );
         
        -        fontPushButton = new TQPushButton( "&Font...", this );
        +        fontPushButton = new TQPushButton( "&Font...", this );
                 fontLayout->addWidget( fontPushButton );
                 TQSpacerItem* spacer = new TQSpacerItem( 0, 0,
                                                        TQSizePolicy::Expanding,
        @@ -164,14 +164,14 @@ know what font the user is using).
                                                     addValuesButtonGroup->layout() );
                 addValuesButtonGroupLayout->setAlignment( TQt::AlignTop );
         
        -        noRadioButton = new TQRadioButton( "&No", addValuesButtonGroup );
        -        noRadioButton->setChecked( TRUE );
        +        noRadioButton = new TQRadioButton( "&No", addValuesButtonGroup );
        +        noRadioButton->setChecked( TRUE );
                 addValuesButtonGroupLayout->addWidget( noRadioButton );
         
        -        yesRadioButton = new TQRadioButton( "&Yes", addValuesButtonGroup );
        +        yesRadioButton = new TQRadioButton( "&Yes", addValuesButtonGroup );
                 addValuesButtonGroupLayout->addWidget( yesRadioButton );
         
        -        asPercentageRadioButton = new TQRadioButton( "As &Percentage",
        +        asPercentageRadioButton = new TQRadioButton( "As &Percentage",
                                                             addValuesButtonGroup );
                 addValuesButtonGroupLayout->addWidget( asPercentageRadioButton );
                 addValuesFrameLayout->addWidget( addValuesButtonGroup );
        @@ -186,17 +186,17 @@ create the radio buttons, making "No" the default.
         horizontal layouts, and the buttons are laid out in a very similar way
         to the buttons in the set data form.
         

                connect( fontPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( chooseFont() ) );
        -        connect( okPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
        -        connect( cancelPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
        +        connect( okPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( accept() ) );
        +        connect( cancelPushButton, TQ_SIGNAL( clicked() ), this, TQ_SLOT( reject() ) );
         

        We only need three connections:

        1. When the user clicks the font button we execute our own chooseFont() slot. -
        2. If the user clicks OK we call TQDialog::accept(); it is up to the +
        3. If the user clicks OK we call TQDialog::accept(); it is up to the caller to read the data from the dialog's widgets and perform any necessary actions. -
        4. If the user clicks Cancel we call TQDialog::reject(). +
        5. If the user clicks Cancel we call TQDialog::reject().

                chartTypeTextLabel->setBuddy( chartTypeComboBox );
                 decimalPlacesTextLabel->setBuddy( decimalPlacesSpinBox );
        diff --git a/doc/html/whatsthis b/doc/html/whatsthis
        index 481a976c4..77f1ccb18 100644
        --- a/doc/html/whatsthis
        +++ b/doc/html/whatsthis
        @@ -45,9 +45,9 @@ Buffered TCP connection. | TQSocket
         Bundles signals from identifiable senders. | TQSignalMapper
         CDE look and feel. | QCDEStyle
         Can be used to send signals for classes that don't inherit TQObject. | TQSignal
        -Checkable list view items. | QCheckListItem
        -Checkbox with a text label. | QCheckBox
        -Checkboxes in QTables. | QCheckTableItem
        +Checkable list view items. | TQCheckListItem
        +Checkbox with a text label. | TQCheckBox
        +Checkboxes in QTables. | TQCheckTableItem
         Clip region for a painter. | TQRegion
         Clock time functions. | TQTime
         Collection of nodes that can be accessed by name. | TQDomNamedNodeMap
        @@ -56,9 +56,9 @@ Collects tool tips into related groups. | TQToolTipGroup
         Color groups for each widget state. | TQPalette
         Colors based on RGB or HSV values. | TQColor
         Column of tabbed widget items. | TQToolBox
        -Combined button and popup list. | QComboBox
        +Combined button and popup list. | TQComboBox
         Combines a TQDateEdit and TQTimeEdit widget into a single widget for editing datetimes. | TQDateTimeEdit
        -Command button. | QPushButton
        +Command button. | TQPushButton
         Common API for network protocols. | TQNetworkProtocol
         Common operations for network protocols. | TQNetworkOperation
         Common operations on URLs. | TQUrlOperator
        @@ -98,7 +98,7 @@ Describes a key event. | QKeyEvent
         Dialog widget for selecting a font. | TQFontDialog
         Dialog widget for specifying colors. | TQColorDialog
         Dialogs that allow users to select files or directories. | TQFileDialog
        -Displays a number with LCD-like digits. | QLCDNumber
        +Displays a number with LCD-like digits. | TQLCDNumber
         Does low-level painting e.g. on widgets. | TQPainter
         Doubly-linked list of char*. | TQStrList
         Doubly-linked list of char* with case-insensitive comparison. | TQStrIList
        @@ -222,7 +222,7 @@ Maps open-standard MIME to Mac flavors. | TQMacMime
         Maps open-standard MIME to Window Clipboard formats. | TQWindowsMime
         Means of executing and manipulating SQL statements. | TQSqlQuery
         Means of using TQt Assistant as an application's help tool. | QAssistantClient
        -Means of using comboboxes in QTables. | QComboTableItem
        +Means of using comboboxes in QTables. | TQComboTableItem
         Meta information about TQt objects. | QMetaObject
         Microsoft Windows-like look and feel. | QWindowsStyle
         Modal dialog with a short message, an icon, and some buttons. | QMessageBox
        @@ -237,7 +237,7 @@ Namespace for miscellaneous identifiers in the TQt OpenGL module. | TQGL
         Namespace for miscellaneous identifiers that need to be global-like. | Qt
         Off-screen, pixel-based paint device. | TQPixmap
         On-screen view of a TQCanvas. | TQCanvasView
        -One-line text editor. | QLineEdit
        +One-line text editor. | TQLineEdit
         Optional parameters for TQStyle functions. | TQStyleOption
         Organizes QButton widgets in a group. | QButtonGroup
         Organizes QButton widgets in a group with one horizontal row. | QHButtonGroup
        @@ -268,7 +268,7 @@ TQObject that is a web browser plugin. | QNPInstance
         TQPtrList of TQObjects. | TQObjectList
         TQWidget that is a web browser plugin window. | QNPWidget
         Quick-access button to commands or options, usually used inside a TQToolBar. | TQToolButton
        -Radio button with a text or pixmap label. | QRadioButton
        +Radio button with a text or pixmap label. | TQRadioButton
         Range checking of floating-point numbers. | QDoubleValidator
         Read-only SQL forms. | TQDataView
         Rectangle on a TQCanvas. | TQCanvasRectangle
        @@ -287,10 +287,10 @@ Request header information for HTTP. | TQHttpRequestHeader
         Response header information for HTTP. | TQHttpResponseHeader
         Rich text browser with hypertext navigation. | TQTextBrowser
         Robust integer semaphore. | TQSemaphore
        -Rounded range control (like a speedometer or potentiometer). | QDial
        +Rounded range control (like a speedometer or potentiometer). | TQDial
         SGI/Irix look and feel. | QSGIStyle
         SQL database error information. | TQSqlError
        -Scrolling area with on-demand scroll bars. | QScrollView
        +Scrolling area with on-demand scroll bars. | TQScrollView
         Serialization of binary data to a TQIODevice. | TQDataStream
         Set of icons with different styles and sizes. | TQIconSet
         Signals that a main icon drag has begun. | TQIconDragEvent
        @@ -301,7 +301,7 @@ Simple stored-value drag object for arbitrary MIME data. | TQStoredDrag
         Simplifies locking and unlocking TQMutexes. | TQMutexLocker
         Single item in a TQIconView. | TQIconViewItem
         Small displayable piece of rich text. | TQSimpleRichText
        -Spin box widget (spin button). | QSpinBox
        +Spin box widget (spin button). | TQSpinBox
         Splash screen that can be shown during application startup. | QSplashScreen
         Stack of tabbed widgets. | QTabDialog
         Stack of tabbed widgets. | QTabWidget
        @@ -335,7 +335,7 @@ Template class which ensures that implicitly shared and explicitly shared classe
         Template collection class that provides a vector (array). | TQPtrVector
         Text object on a TQCanvas. | TQCanvasText
         Text or image display. | TQLabel
        -The QDialog API for Motif-based dialogs. | QMotifDialog
        +The TQDialog API for Motif-based dialogs. | QMotifDialog
         The TQWidget API for Xt/Motif widgets. | QMotifWidget
         The XML handler classes with information about the parsing position within a file. | TQXmlLocator
         The abstract base class of button widgets, providing functionality common to buttons. | QButton
        @@ -345,7 +345,7 @@ The base class of all TQt objects. | TQObject
         The base class of all event classes. Event objects contain event parameters. | TQEvent
         The base class of all list box items. | QListBoxItem
         The base class of all user interface objects. | TQWidget
        -The base class of dialog windows. | QDialog
        +The base class of dialog windows. | TQDialog
         The base class of geometry managers. | QLayout
         The base class of most pointer-based TQt collections. | TQPtrCollection
         The base class of objects that can be painted. | TQPaintDevice
        @@ -381,8 +381,8 @@ Value-based template class that provides a pair of elements. | TQPair
         Value-based template class that provides a stack. | TQValueStack
         Value-based template class that provides lists. | TQValueList
         Vertical geometry management of its child widgets. | QVBox
        -Vertical or horizontal scroll bar. | QScrollBar
        -Vertical or horizontal slider. | QSlider
        +Vertical or horizontal scroll bar. | TQScrollBar
        +Vertical or horizontal slider. | TQSlider
         Watches the lifetime of multiple TQObjects. | TQObjectCleanupHandler
         Widget for rendering OpenGL graphics. | TQGLWidget
         Widget which can be docked inside a QDockArea or floated as a top level window on the desktop. | QDockWindow
        diff --git a/doc/html/wizard-example.html b/doc/html/wizard-example.html
        index d1175ec15..03513778a 100644
        --- a/doc/html/wizard-example.html
        +++ b/doc/html/wizard-example.html
        @@ -72,7 +72,7 @@ protected:
             void setupPage3();
         
             TQHBox *page1, *page2, *page3;
        -    TQLineEdit *key, *firstName, *lastName, *address, *phone, *email;
        +    TQLineEdit *key, *firstName, *lastName, *address, *phone, *email;
             TQLabel *lKey, *lFirstName, *lLastName, *lAddress, *lPhone, *lEmail;
         
         protected slots:
        @@ -102,8 +102,8 @@ protected slots:
         #include <ntqhbox.h>
         #include <ntqvbox.h>
         #include <tqlabel.h>
        -#include <ntqlineedit.h>
        -#include <ntqpushbutton.h>
        +#include <tqlineedit.h>
        +#include <tqpushbutton.h>
         #include <ntqvalidator.h>
         #include <ntqapplication.h>
         
        @@ -137,11 +137,11 @@ void Wizard::setupPage1()
         
             (void)new TQLabel( "Key:", row1 );
         
        -    key = new TQLineEdit( row1 );
        -    key->setMaxLength( 4 );
        -    key->setValidator( new TQIntValidator( 1000, 9999, key ) );
        +    key = new TQLineEdit( row1 );
        +    key->setMaxLength( 4 );
        +    key->setValidator( new TQIntValidator( 1000, 9999, key ) );
         
        -    connect( key, TQ_SIGNAL( textChanged( const TQString & ) ),
        +    connect( key, TQ_SIGNAL( textChanged( const TQString & ) ),
                      this, TQ_SLOT( keyChanged( const TQString & ) ) );
         
             addPage( page1, "Personal Key" );
        @@ -191,17 +191,17 @@ void Wizard::setupPage2()
             label4->setMinimumWidth( label4->sizeHint().width() );
             label5->setMinimumWidth( label4->sizeHint().width() );
         
        -    firstName = new TQLineEdit( row1 );
        -    lastName = new TQLineEdit( row2 );
        -    address = new TQLineEdit( row3 );
        -    phone = new TQLineEdit( row4 );
        -    email = new TQLineEdit( row5 );
        +    firstName = new TQLineEdit( row1 );
        +    lastName = new TQLineEdit( row2 );
        +    address = new TQLineEdit( row3 );
        +    phone = new TQLineEdit( row4 );
        +    email = new TQLineEdit( row5 );
         
        -    connect( firstName, TQ_SIGNAL( textChanged( const TQString & ) ),
        +    connect( firstName, TQ_SIGNAL( textChanged( const TQString & ) ),
                      this, TQ_SLOT( dataChanged( const TQString & ) ) );
        -    connect( lastName, TQ_SIGNAL( textChanged( const TQString & ) ),
        +    connect( lastName, TQ_SIGNAL( textChanged( const TQString & ) ),
                      this, TQ_SLOT( dataChanged( const TQString & ) ) );
        -    connect( email, TQ_SIGNAL( textChanged( const TQString & ) ),
        +    connect( email, TQ_SIGNAL( textChanged( const TQString & ) ),
                      this, TQ_SLOT( dataChanged( const TQString & ) ) );
         
             addPage( page2, "Personal Data" );
        @@ -274,21 +274,21 @@ void Wizard::setupPage3()
             if ( page == page1 ) {
             } else if ( page == page2 ) {
             } else if ( page == page3 ) {
        -        lKey->setText( key->text() );
        -        lFirstName->setText( firstName->text() );
        -        lLastName->setText( lastName->text() );
        -        lAddress->setText( address->text() );
        -        lPhone->setText( phone->text() );
        -        lEmail->setText( email->text() );
        +        lKey->setText( key->text() );
        +        lFirstName->setText( firstName->text() );
        +        lLastName->setText( lastName->text() );
        +        lAddress->setText( address->text() );
        +        lPhone->setText( phone->text() );
        +        lEmail->setText( email->text() );
             }
         
             TQWizard::showPage(page);
         
             if ( page == page1 ) {
        -        keyChanged( key->text() );
        +        keyChanged( key->text() );
                 key->setFocus();
             } else if ( page == page2 ) {
        -        dataChanged( firstName->text() );
        +        dataChanged( firstName->text() );
                 firstName->setFocus();
             } else if ( page == page3 ) {
                 finishButton()->setEnabled( TRUE );
        @@ -300,15 +300,15 @@ void Wizard::keyChanged( const TQStri
         {
             TQString t = text;
             int p = 0;
        -    bool on = ( key->validator()->validate(t, p) == TQValidator::Acceptable );
        +    bool on = ( key->validator()->validate(t, p) == TQValidator::Acceptable );
             nextButton()->setEnabled( on );
         }
         
         void Wizard::dataChanged( const TQString & )
         {
        -    if ( !firstName->text().isEmpty() &&
        -         !lastName->text().isEmpty() &&
        -         !email->text().isEmpty() )
        +    if ( !firstName->text().isEmpty() &&
        +         !lastName->text().isEmpty() &&
        +         !email->text().isEmpty() )
                 nextButton()->setEnabled( TRUE );
             else
                 nextButton()->setEnabled( FALSE );
        @@ -336,7 +336,7 @@ int main(int argc,char **argv)
         
             Wizard wizard;
             wizard.setCaption("TQt Example - Wizard");
        -    return wizard.exec();
        +    return wizard.exec();
         }
         
        diff --git a/doc/html/wizard-wizard-cpp.html b/doc/html/wizard-wizard-cpp.html index 05215f56a..484043e9c 100644 --- a/doc/html/wizard-wizard-cpp.html +++ b/doc/html/wizard-wizard-cpp.html @@ -48,8 +48,8 @@ body { background: #ffffff; color: black; } #include <ntqhbox.h> #include <ntqvbox.h> #include <tqlabel.h> -#include <ntqlineedit.h> -#include <ntqpushbutton.h> +#include <tqlineedit.h> +#include <tqpushbutton.h> #include <ntqvalidator.h> #include <ntqapplication.h> @@ -83,11 +83,11 @@ void Wizard::setupPage1() (void)new TQLabel( "Key:", row1 ); - key = new TQLineEdit( row1 ); - key->setMaxLength( 4 ); - key->setValidator( new TQIntValidator( 1000, 9999, key ) ); + key = new TQLineEdit( row1 ); + key->setMaxLength( 4 ); + key->setValidator( new TQIntValidator( 1000, 9999, key ) ); - connect( key, TQ_SIGNAL( textChanged( const TQString & ) ), + connect( key, TQ_SIGNAL( textChanged( const TQString & ) ), this, TQ_SLOT( keyChanged( const TQString & ) ) ); addPage( page1, "Personal Key" ); @@ -137,17 +137,17 @@ void Wizard::setupPage2() label4->setMinimumWidth( label4->sizeHint().width() ); label5->setMinimumWidth( label4->sizeHint().width() ); - firstName = new TQLineEdit( row1 ); - lastName = new TQLineEdit( row2 ); - address = new TQLineEdit( row3 ); - phone = new TQLineEdit( row4 ); - email = new TQLineEdit( row5 ); + firstName = new TQLineEdit( row1 ); + lastName = new TQLineEdit( row2 ); + address = new TQLineEdit( row3 ); + phone = new TQLineEdit( row4 ); + email = new TQLineEdit( row5 ); - connect( firstName, TQ_SIGNAL( textChanged( const TQString & ) ), + connect( firstName, TQ_SIGNAL( textChanged( const TQString & ) ), this, TQ_SLOT( dataChanged( const TQString & ) ) ); - connect( lastName, TQ_SIGNAL( textChanged( const TQString & ) ), + connect( lastName, TQ_SIGNAL( textChanged( const TQString & ) ), this, TQ_SLOT( dataChanged( const TQString & ) ) ); - connect( email, TQ_SIGNAL( textChanged( const TQString & ) ), + connect( email, TQ_SIGNAL( textChanged( const TQString & ) ), this, TQ_SLOT( dataChanged( const TQString & ) ) ); addPage( page2, "Personal Data" ); @@ -220,21 +220,21 @@ void Wizard::setupPage3() if ( page == page1 ) { } else if ( page == page2 ) { } else if ( page == page3 ) { - lKey->setText( key->text() ); - lFirstName->setText( firstName->text() ); - lLastName->setText( lastName->text() ); - lAddress->setText( address->text() ); - lPhone->setText( phone->text() ); - lEmail->setText( email->text() ); + lKey->setText( key->text() ); + lFirstName->setText( firstName->text() ); + lLastName->setText( lastName->text() ); + lAddress->setText( address->text() ); + lPhone->setText( phone->text() ); + lEmail->setText( email->text() ); } TQWizard::showPage(page); if ( page == page1 ) { - keyChanged( key->text() ); + keyChanged( key->text() ); key->setFocus(); } else if ( page == page2 ) { - dataChanged( firstName->text() ); + dataChanged( firstName->text() ); firstName->setFocus(); } else if ( page == page3 ) { finishButton()->setEnabled( TRUE ); @@ -246,15 +246,15 @@ void Wizard::keyChanged( const TQString { TQString t = text; int p = 0; - bool on = ( key->validator()->validate(t, p) == TQValidator::Acceptable ); + bool on = ( key->validator()->validate(t, p) == TQValidator::Acceptable ); nextButton()->setEnabled( on ); } void Wizard::dataChanged( const TQString & ) { - if ( !firstName->text().isEmpty() && - !lastName->text().isEmpty() && - !email->text().isEmpty() ) + if ( !firstName->text().isEmpty() && + !lastName->text().isEmpty() && + !email->text().isEmpty() ) nextButton()->setEnabled( TRUE ); else nextButton()->setEnabled( FALSE ); diff --git a/doc/html/wizard-wizard-h.html b/doc/html/wizard-wizard-h.html index 4aa9d2b8d..e2d614b7e 100644 --- a/doc/html/wizard-wizard-h.html +++ b/doc/html/wizard-wizard-h.html @@ -67,7 +67,7 @@ protected: void setupPage3(); TQHBox *page1, *page2, *page3; - TQLineEdit *key, *firstName, *lastName, *address, *phone, *email; + TQLineEdit *key, *firstName, *lastName, *address, *phone, *email; TQLabel *lKey, *lFirstName, *lLastName, *lAddress, *lPhone, *lEmail; protected slots: diff --git a/doc/html/xform-example.html b/doc/html/xform-example.html index 3a7b9bab9..0f0cb74fd 100644 --- a/doc/html/xform-example.html +++ b/doc/html/xform-example.html @@ -49,15 +49,15 @@ arbitrarily. #include <ntqapplication.h> -#include <ntqdialog.h> +#include <tqdialog.h> #include <tqlabel.h> -#include <ntqlineedit.h> -#include <ntqpushbutton.h> -#include <ntqcheckbox.h> -#include <ntqradiobutton.h> +#include <tqlineedit.h> +#include <tqpushbutton.h> +#include <tqcheckbox.h> +#include <tqradiobutton.h> #include <ntqbuttongroup.h> -#include <ntqlcdnumber.h> -#include <ntqslider.h> +#include <tqlcdnumber.h> +#include <tqslider.h> #include <tqmenubar.h> #include <tqfontdialog.h> #include <ntqlayout.h> @@ -100,19 +100,19 @@ private slots: void timerEvent(TQTimerEvent*); private: Mode mode; - TQSlider *rotS; // Rotation angle scroll bar - TQSlider *shearS; // Shear value scroll bar - TQSlider *magS; // Magnification value scroll bar - TQLCDNumber *rotLCD; // Rotation angle LCD display - TQLCDNumber *shearLCD; // Shear value LCD display - TQLCDNumber *magLCD; // Magnification value LCD display - TQCheckBox *mirror; // Checkbox for mirror image on/of + TQSlider *rotS; // Rotation angle scroll bar + TQSlider *shearS; // Shear value scroll bar + TQSlider *magS; // Magnification value scroll bar + TQLCDNumber *rotLCD; // Rotation angle LCD display + TQLCDNumber *shearLCD; // Shear value LCD display + TQLCDNumber *magLCD; // Magnification value LCD display + TQCheckBox *mirror; // Checkbox for mirror image on/of TQWidgetStack* optionals; - TQLineEdit *textEd; // Inp[ut field for xForm text - TQPushButton *fpb; // Select font push button - TQRadioButton *rb_txt; // Radio button for text - TQRadioButton *rb_img; // Radio button for image - TQRadioButton *rb_pic; // Radio button for picture + TQLineEdit *textEd; // Inp[ut field for xForm text + TQPushButton *fpb; // Select font push button + TQRadioButton *rb_txt; // Radio button for text + TQRadioButton *rb_img; // Radio button for image + TQRadioButton *rb_pic; // Radio button for picture TQFont currentFont; }; @@ -159,16 +159,16 @@ private: currentFont = initialFont; mode = Image; - rotLCD = new TQLCDNumber( 4, this, "rotateLCD" ); - rotS = new TQSlider( TQSlider::Horizontal, this, + rotLCD = new TQLCDNumber( 4, this, "rotateLCD" ); + rotS = new TQSlider( TQSlider::Horizontal, this, "rotateSlider" ); - shearLCD = new TQLCDNumber( 5,this, "shearLCD" ); - shearS = new TQSlider( TQSlider::Horizontal, this, + shearLCD = new TQLCDNumber( 5,this, "shearLCD" ); + shearS = new TQSlider( TQSlider::Horizontal, this, "shearSlider" ); - mirror = new TQCheckBox( this, "mirrorCheckBox" ); - rb_txt = new TQRadioButton( this, "text" ); - rb_img = new TQRadioButton( this, "image" ); - rb_pic = new TQRadioButton( this, "picture" ); + mirror = new TQCheckBox( this, "mirrorCheckBox" ); + rb_txt = new TQRadioButton( this, "text" ); + rb_img = new TQRadioButton( this, "image" ); + rb_pic = new TQRadioButton( this, "picture" ); optionals = new TQWidgetStack(this); TQVBox* optionals_text = new TQVBox(optionals); optionals_text->setSpacing(6); @@ -176,21 +176,21 @@ private: optionals_other->setSpacing(6); optionals->addWidget(optionals_text,0); optionals->addWidget(optionals_other,1); - fpb = new TQPushButton( optionals_text, "text" ); - textEd = new TQLineEdit( optionals_text, "text" ); + fpb = new TQPushButton( optionals_text, "text" ); + textEd = new TQLineEdit( optionals_text, "text" ); textEd->setFocus(); - rotLCD->display( " 0'" ); + rotLCD->display( " 0'" ); rotS->setRange( -180, 180 ); - rotS->setValue( 0 ); - connect( rotS, TQ_SIGNAL(valueChanged(int)), TQ_SLOT(newMtx()) ); + rotS->setValue( 0 ); + connect( rotS, TQ_SIGNAL(valueChanged(int)), TQ_SLOT(newMtx()) ); - shearLCD->display( "0.00" ); + shearLCD->display( "0.00" ); shearS->setRange( -25, 25 ); - shearS->setValue( 0 ); - connect( shearS, TQ_SIGNAL(valueChanged(int)), TQ_SLOT(newMtx()) ); + shearS->setValue( 0 ); + connect( shearS, TQ_SIGNAL(valueChanged(int)), TQ_SLOT(newMtx()) ); mirror->setText( tr("Mirror") ); connect( mirror, TQ_SIGNAL(clicked()), TQ_SLOT(newMtx()) ); @@ -202,25 +202,25 @@ private: bg->insert(rb_pic,2); rb_txt->setText( tr("Text") ); rb_img->setText( tr("Image") ); - rb_img->setChecked(TRUE); + rb_img->setChecked(TRUE); rb_pic->setText( tr("Picture") ); connect( bg, TQ_SIGNAL(clicked(int)), TQ_SLOT(changeMode(int)) ); fpb->setText( tr("Select font...") ); connect( fpb, TQ_SIGNAL(clicked()), TQ_SLOT(selectFont()) ); - textEd->setText( "Troll" ); - connect( textEd, TQ_SIGNAL(textChanged(const TQString&)), + textEd->setText( "Troll" ); + connect( textEd, TQ_SIGNAL(textChanged(const TQString&)), TQ_SLOT(newTxt(const TQString&)) ); - magLCD = new TQLCDNumber( 4,optionals_other, "magLCD" ); - magLCD->display( "100" ); - magS = new TQSlider( TQSlider::Horizontal, optionals_other, + magLCD = new TQLCDNumber( 4,optionals_other, "magLCD" ); + magLCD->display( "100" ); + magS = new TQSlider( TQSlider::Horizontal, optionals_other, "magnifySlider" ); magS->setRange( 0, 800 ); - connect( magS, TQ_SIGNAL(valueChanged(int)), TQ_SLOT(newMtx()) ); - magS->setValue( 0 ); - connect( magS, TQ_SIGNAL(valueChanged(int)), magLCD, TQ_SLOT(display(int))); + connect( magS, TQ_SIGNAL(valueChanged(int)), TQ_SLOT(newMtx()) ); + magS->setValue( 0 ); + connect( magS, TQ_SIGNAL(valueChanged(int)), magLCD, TQ_SLOT(display(int))); optionals_text->adjustSize(); optionals_other->adjustSize(); @@ -231,13 +231,13 @@ private: void XFormControl::timerEvent(TQTimerEvent*) { - int v = magS->value(); + int v = magS->value(); v = (v+2)+v/10; if ( v >= 200 ) { v = 200; killTimers(); } - magS->setValue(v); + magS->setValue(v); } @@ -265,13 +265,13 @@ TQWMatrix XFormControl::matrix() { TQWMatrix m; if (mode != Text) { - double magVal = 1.0*magS->value()/100; + double magVal = 1.0*magS->value()/100; m.scale( magVal, magVal ); } - double shearVal = 1.0*shearS->value()/25; + double shearVal = 1.0*shearS->value()/25; m.shear( shearVal, shearVal ); - m.rotate( rotS->value() ); - if ( mirror->isChecked() ) { + m.rotate( rotS->value() ); + if ( mirror->isChecked() ) { m.scale( 1, -1 ); m.rotate( 180 ); } @@ -280,13 +280,13 @@ TQWMatrix XFormControl::matrix() tmp.sprintf( "%1.2f", shearVal ); if ( shearVal >= 0 ) tmp.insert( 0, " " ); - shearLCD->display( tmp ); + shearLCD->display( tmp ); - int rot = rotS->value(); + int rot = rotS->value(); if ( rot < 0 ) rot = rot + 360; tmp.sprintf( "%3i'", rot ); - rotLCD->display( tmp ); + rotLCD->display( tmp ); return m; } @@ -319,13 +319,13 @@ void XFormControl::changeMode(int m) newMtx(); if ( mode == Text ) { optionals->raiseWidget(0); - rb_txt->setChecked(TRUE); + rb_txt->setChecked(TRUE); } else { optionals->raiseWidget(1); if ( mode == Image ) - rb_img->setChecked(TRUE); + rb_img->setChecked(TRUE); else - rb_pic->setChecked(TRUE); + rb_pic->setChecked(TRUE); } tqApp->flushX(); } diff --git a/doc/i18n.doc b/doc/i18n.doc index b1924b9cd..6cc7d8879 100644 --- a/doc/i18n.doc +++ b/doc/i18n.doc @@ -121,7 +121,7 @@ the fl and fi ligatures used in typesetting US and European books. Qt tries to take care of all the special features listed above. You usually don't have to worry about these features so long as you use -Qt's input widgets (e.g. QLineEdit, TQTextEdit, and derived classes) +Qt's input widgets (e.g. TQLineEdit, TQTextEdit, and derived classes) and Qt's display widgets (e.g. TQLabel). Support for these writing systems is transparent to the programmer @@ -143,7 +143,7 @@ string. In some languages (e.g. Arabic or languages from the Indian subcontinent), the width and shape of a glyph changes depending on the surrounding characters. Writing input controls usually requires a certain knowledge of the scripts it is going to be used in. Usually -the easiest way is to subclass QLineEdit or TQTextEdit. +the easiest way is to subclass TQLineEdit or TQTextEdit. \endlist diff --git a/doc/layout.doc b/doc/layout.doc index 89267b48c..777d3a114 100644 --- a/doc/layout.doc +++ b/doc/layout.doc @@ -196,9 +196,9 @@ You can insert layouts inside a layout by giving the parent layout as a parameter in the constructor. \code TQWidget *main = new TQWidget; - QLineEdit *field = new QLineEdit( main ); - QPushButton *ok = new QPushButton( "OK", main ); - QPushButton *cancel = new QPushButton( "Cancel", main ); + TQLineEdit *field = new TQLineEdit( main ); + TQPushButton *ok = new TQPushButton( "OK", main ); + TQPushButton *cancel = new TQPushButton( "Cancel", main ); TQLabel *label = new TQLabel( "Write once, compile everywhere.", main ); // a layout on a widget diff --git a/doc/man/man3/tqaccel.3qt b/doc/man/man3/tqaccel.3qt index d38a0a29c..3b551a89d 100644 --- a/doc/man/man3/tqaccel.3qt +++ b/doc/man/man3/tqaccel.3qt @@ -106,7 +106,7 @@ In most cases, you will not need to use this class directly. Use the TQAction cl .PP .nf .br - QPushButton p( "&Exit", parent ); // automatic shortcut ALT+Key_E + TQPushButton p( "&Exit", parent ); // automatic shortcut ALT+Key_E .br TQPopupMenu *fileMenu = new fileMenu( parent ); .br @@ -120,7 +120,7 @@ Each accelerator item consists of an identifier and a QKeySequence. A single key .PP When an accelerator key is pressed, the accelerator sends out the signal activated() with a number that identifies this particular accelerator item. Accelerator items can also be individually connected, so that two different keys will activate two different slots (see connectItem() and disconnectItem()). .PP -The activated() signal is \fInot\fR emitted when two or more accelerators match the same key. Instead, the first matching accelerator sends out the activatedAmbiguously() signal. By pressing the key multiple times, users can navigate between all matching accelerators. Some standard controls like QPushButton and QCheckBox connect the activatedAmbiguously() signal to the harmless setFocus() slot, whereas activated() is connected to a slot invoking the button's action. Most controls, like TQLabel and QTabBar, treat activated() and activatedAmbiguously() as equivalent. +The activated() signal is \fInot\fR emitted when two or more accelerators match the same key. Instead, the first matching accelerator sends out the activatedAmbiguously() signal. By pressing the key multiple times, users can navigate between all matching accelerators. Some standard controls like TQPushButton and TQCheckBox connect the activatedAmbiguously() signal to the harmless setFocus() slot, whereas activated() is connected to a slot invoking the button's action. Most controls, like TQLabel and QTabBar, treat activated() and activatedAmbiguously() as equivalent. .PP Use setEnabled() to enable or disable all the items in an accelerator, or setItemEnabled() to enable or disable individual items. An item is active only when both the QAccel and the item itself are enabled. .PP diff --git a/doc/man/man3/tqapplication.3qt b/doc/man/man3/tqapplication.3qt index 4e9a030b0..0b91f3d75 100644 --- a/doc/man/man3/tqapplication.3qt +++ b/doc/man/man3/tqapplication.3qt @@ -623,7 +623,7 @@ See also quit(). .SH "TQWidget * QApplication::activeModalWidget ()\fC [static]\fR" Returns the active modal widget. .PP -A modal widget is a special top level widget which is a subclass of QDialog that specifies the modal parameter of the constructor as TRUE. A modal widget must be closed before the user can continue with other parts of the program. +A modal widget is a special top level widget which is a subclass of TQDialog that specifies the modal parameter of the constructor as TRUE. A modal widget must be closed before the user can continue with other parts of the program. .PP Modal widgets are organized in a stack. This function returns the active modal widget at the top of the stack. .PP @@ -1115,7 +1115,7 @@ Example: .PP .nf .br - QPushButton *quitButton = new QPushButton( "Quit" ); + TQPushButton *quitButton = new TQPushButton( "Quit" ); .br connect( quitButton, TQ_SIGNAL(clicked()), tqApp, TQ_SLOT(quit()) ); .br @@ -1487,7 +1487,7 @@ See also setStartDragDistance(), startDragTime(), and TQPoint::manhattanLength() .SH "int QApplication::startDragTime ()\fC [static]\fR" If you support drag and drop in you application and a drag should start after a mouse click and after a certain time elapsed, you should use the value which this method returns as the delay (in ms). .PP -Qt also uses this delay internally, e.g. in TQTextEdit and QLineEdit, for starting a drag. +Qt also uses this delay internally, e.g. in TQTextEdit and TQLineEdit, for starting a drag. .PP The default value is 500 ms. .PP diff --git a/doc/man/man3/tqasciidict.3qt b/doc/man/man3/tqasciidict.3qt index 915cb8288..e02592ef1 100644 --- a/doc/man/man3/tqasciidict.3qt +++ b/doc/man/man3/tqasciidict.3qt @@ -95,11 +95,11 @@ Example: .PP .nf .br - TQAsciiDict fields; // char* keys, QLineEdit* values + TQAsciiDict fields; // char* keys, TQLineEdit* values .br - fields.insert( "forename", new QLineEdit( this ) ); + fields.insert( "forename", new TQLineEdit( this ) ); .br - fields.insert( "surname", new QLineEdit( this ) ); + fields.insert( "surname", new TQLineEdit( this ) ); .br .br fields["forename"]->setText( "Homer" ); @@ -107,7 +107,7 @@ Example: fields["surname"]->setText( "Simpson" ); .br .br - TQAsciiDictIterator it( fields ); // See TQAsciiDictIterator + TQAsciiDictIterator it( fields ); // See TQAsciiDictIterator .br for( ; it.current(); ++it ) .br diff --git a/doc/man/man3/tqasciidictiterator.3qt b/doc/man/man3/tqasciidictiterator.3qt index 2ce41d233..2c4e9569b 100644 --- a/doc/man/man3/tqasciidictiterator.3qt +++ b/doc/man/man3/tqasciidictiterator.3qt @@ -56,13 +56,13 @@ Example: .PP .nf .br - TQAsciiDict fields; + TQAsciiDict fields; .br - fields.insert( "forename", new QLineEdit( this ) ); + fields.insert( "forename", new TQLineEdit( this ) ); .br - fields.insert( "surname", new QLineEdit( this ) ); + fields.insert( "surname", new TQLineEdit( this ) ); .br - fields.insert( "age", new QLineEdit( this ) ); + fields.insert( "age", new TQLineEdit( this ) ); .br .br fields["forename"]->setText( "Homer" ); @@ -72,7 +72,7 @@ Example: fields["age"]->setText( "45" ); .br .br - TQAsciiDictIterator it( fields ); + TQAsciiDictIterator it( fields ); .br for( ; it.current(); ++it ) .br diff --git a/doc/man/man3/tqbutton.3qt b/doc/man/man3/tqbutton.3qt index 3e83ac43d..cf1be83c2 100644 --- a/doc/man/man3/tqbutton.3qt +++ b/doc/man/man3/tqbutton.3qt @@ -13,7 +13,7 @@ QButton \- The abstract base class of button widgets, providing functionality co .PP Inherits TQWidget. .PP -Inherited by QCheckBox, QPushButton, QRadioButton, and TQToolButton. +Inherited by TQCheckBox, TQPushButton, TQRadioButton, and TQToolButton. .PP .SS "Public Members" .in +1c @@ -168,11 +168,11 @@ Inherited by QCheckBox, QPushButton, QRadioButton, and TQToolButton. .SH DESCRIPTION The QButton class is the abstract base class of button widgets, providing functionality common to buttons. .PP -\fBIf you want to create a button use QPushButton.\fR +\fBIf you want to create a button use TQPushButton.\fR .PP The QButton class implements an \fIabstract\fR button, and lets subclasses specify how to reply to user actions and how to draw the button. .PP -QButton provides both push and toggle buttons. The QRadioButton and QCheckBox classes provide only toggle buttons; QPushButton and TQToolButton provide both toggle and push buttons. +QButton provides both push and toggle buttons. The TQRadioButton and TQCheckBox classes provide only toggle buttons; TQPushButton and TQToolButton provide both toggle and push buttons. .PP Any button can have either a text or pixmap label. setText() sets the button to be a text button and setPixmap() sets it to be a pixmap button. The text/pixmap is manipulated as necessary to create the "disabled" appearance when the button is disabled. .PP @@ -190,7 +190,7 @@ setToggleButton() sets whether the button is a toggle button or not. .PP The difference between isDown() and isOn() is as follows: When the user clicks a toggle button to toggle it on, the button is first \fIpressed\fR and then released into the \fIon\fR state. When the user clicks it again (to toggle it off), the button moves first to the \fIpressed\fR state, then to the \fIoff\fR state (isOn() and isDown() are both FALSE). .PP -Default buttons (as used in many dialogs) are provided by QPushButton::setDefault() and QPushButton::setAutoDefault(). +Default buttons (as used in many dialogs) are provided by TQPushButton::setDefault() and TQPushButton::setAutoDefault(). .PP QButton provides five signals:
          .TP @@ -208,7 +208,7 @@ If the button is a text button with an ampersand (&) in its text, QButton create .PP .nf .br - QPushButton *p = new QPushButton( "Ro&ck && Roll", this ); + TQPushButton *p = new TQPushButton( "Ro&ck && Roll", this ); .br .fi .PP @@ -224,7 +224,7 @@ You can also set a custom accelerator using the setAccel() function. This is use .br .fi .PP -All of the buttons provided by TQt (QPushButton, TQToolButton, QCheckBox and QRadioButton) can display both text and pixmaps. +All of the buttons provided by TQt (TQPushButton, TQToolButton, TQCheckBox and TQRadioButton) can display both text and pixmaps. .PP To subclass QButton, you must reimplement at least drawButton() (to draw the button's outline) and drawButtonLabel() (to draw its text or pixmap). It is generally advisable to reimplement sizeHint() as well, and sometimes hitButton() (to determine whether a button press is within the button). .PP diff --git a/doc/man/man3/tqbuttongroup.3qt b/doc/man/man3/tqbuttongroup.3qt index 9b09ff7fe..da6fc1c13 100644 --- a/doc/man/man3/tqbuttongroup.3qt +++ b/doc/man/man3/tqbuttongroup.3qt @@ -115,7 +115,7 @@ A button can be removed from the group with remove(). A pointer to a button with .ce 1 .B "[Image Omitted]" .PP -See also QPushButton, QCheckBox, QRadioButton, Widget Appearance and Style, Layout Management, and Organizers. +See also TQPushButton, TQCheckBox, TQRadioButton, Widget Appearance and Style, Layout Management, and Organizers. .SH MEMBER FUNCTION DOCUMENTATION .SH "QButtonGroup::QButtonGroup ( TQWidget * parent = 0, const char * name = 0 )" Constructs a button group with no title. diff --git a/doc/man/man3/tqcanvas.3qt b/doc/man/man3/tqcanvas.3qt index 802b50b6b..de7e76b5a 100644 --- a/doc/man/man3/tqcanvas.3qt +++ b/doc/man/man3/tqcanvas.3qt @@ -156,7 +156,7 @@ The TQCanvas class provides a 2D area that can contain TQCanvasItem objects. .PP The TQCanvas class manages its 2D graphic area and all the canvas items the area contains. The canvas has no visual appearance of its own. Instead, it is displayed on screen using a TQCanvasView. Multiple TQCanvasView widgets may be associated with a canvas to provide multiple views of the same canvas. .PP -The canvas is optimized for large numbers of items, particularly where only a small percentage of the items change at any one time. If the entire display changes very frequently, you should consider using your own custom QScrollView subclass. +The canvas is optimized for large numbers of items, particularly where only a small percentage of the items change at any one time. If the entire display changes very frequently, you should consider using your own custom TQScrollView subclass. .PP Qt provides a rich set of canvas item classes, e.g. TQCanvasEllipse, TQCanvasLine, TQCanvasPolygon, TQCanvasPolygonalItem, TQCanvasRectangle, TQCanvasSpline, TQCanvasSprite and TQCanvasText. You can subclass to create your own canvas items; TQCanvasPolygonalItem is the most common base class used for this purpose. .PP diff --git a/doc/man/man3/tqcanvasview.3qt b/doc/man/man3/tqcanvasview.3qt index 32a46003d..66253369e 100644 --- a/doc/man/man3/tqcanvasview.3qt +++ b/doc/man/man3/tqcanvasview.3qt @@ -11,7 +11,7 @@ TQCanvasView \- On-screen view of a TQCanvas .SH SYNOPSIS \fC#include \fR .PP -Inherits QScrollView. +Inherits TQScrollView. .PP .SS "Public Members" .in +1c @@ -54,7 +54,7 @@ The TQCanvasView class provides an on-screen view of a TQCanvas. .PP A TQCanvasView is widget which provides a view of a TQCanvas. .PP -If you want users to be able to interact with a canvas view, subclass TQCanvasView. You might then reimplement QScrollView::contentsMousePressEvent(). For example, assuming no transformation matrix is set: +If you want users to be able to interact with a canvas view, subclass TQCanvasView. You might then reimplement TQScrollView::contentsMousePressEvent(). For example, assuming no transformation matrix is set: .PP .nf .br @@ -136,7 +136,7 @@ Repaints part of the TQCanvas that the canvas view is showing starting at \fIcx\ .PP See also TQCanvas::setDoubleBuffering(). .PP -Reimplemented from QScrollView. +Reimplemented from TQScrollView. .SH "const TQWMatrix & TQCanvasView::inverseWorldMatrix () const" Returns a reference to the inverse of the canvas view's current transformation matrix. .PP diff --git a/doc/man/man3/tqcheckbox.3qt b/doc/man/man3/tqcheckbox.3qt index 327555d65..0a964040b 100644 --- a/doc/man/man3/tqcheckbox.3qt +++ b/doc/man/man3/tqcheckbox.3qt @@ -1,5 +1,5 @@ '\" t -.TH QCheckBox 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQCheckBox 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,19 +7,19 @@ .ad l .nh .SH NAME -QCheckBox \- Checkbox with a text label +TQCheckBox \- Checkbox with a text label .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP Inherits QButton. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQCheckBox\fR ( TQWidget * parent, const char * name = 0 )" +.BI "\fBTQCheckBox\fR ( TQWidget * parent, const char * name = 0 )" .br .ti -1c -.BI "\fBQCheckBox\fR ( const TQString & text, TQWidget * parent, const char * name = 0 )" +.BI "\fBTQCheckBox\fR ( const TQString & text, TQWidget * parent, const char * name = 0 )" .br .ti -1c .BI "bool \fBisChecked\fR () const" @@ -119,9 +119,9 @@ Inherits QButton. .br .in -1c .SH DESCRIPTION -The QCheckBox widget provides a checkbox with a text label. +The TQCheckBox widget provides a checkbox with a text label. .PP -QCheckBox and QRadioButton are both option buttons. That is, they can be switched on (checked) or off (unchecked). The classes differ in how the choices for the user are restricted. Radio buttons define a "one of many" choice, whereas checkboxes provide" many of many" choices. +TQCheckBox and TQRadioButton are both option buttons. That is, they can be switched on (checked) or off (unchecked). The classes differ in how the choices for the user are restricted. Radio buttons define a "one of many" choice, whereas checkboxes provide" many of many" choices. .PP A QButtonGroup can be used to group check buttons visually. .PP @@ -129,9 +129,9 @@ Whenever a checkbox is checked or cleared it emits the signal toggled(). Connect .PP \fBWarning:\fR The toggled() signal can not be trusted for tristate checkboxes. .PP -In addition to the usual checked and unchecked states, QCheckBox optionally provides a third state to indicate "no change". This is useful whenever you need to give the user the option of neither checking nor unchecking a checkbox. If you need this third state, enable it with setTristate() and use state() to query the current toggle state. When a tristate checkbox changes state, it emits the stateChanged() signal. +In addition to the usual checked and unchecked states, TQCheckBox optionally provides a third state to indicate "no change". This is useful whenever you need to give the user the option of neither checking nor unchecking a checkbox. If you need this third state, enable it with setTristate() and use state() to query the current toggle state. When a tristate checkbox changes state, it emits the stateChanged() signal. .PP -Just like QPushButton, a checkbox can display text or a pixmap. The text can be set in the constructor or with setText(); the pixmap is set with setPixmap(). +Just like TQPushButton, a checkbox can display text or a pixmap. The text can be set in the constructor or with setText(); the pixmap is set with setPixmap(). .PP .ce 1 .B "[Image Omitted]" @@ -140,13 +140,13 @@ Just like QPushButton, a checkbox can display text or a pixmap. The text can be .ce 1 .B "[Image Omitted]" .PP -See also QButton, QRadioButton, Fowler: Check Box, and Basic Widgets. +See also QButton, TQRadioButton, Fowler: Check Box, and Basic Widgets. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QCheckBox::QCheckBox ( TQWidget * parent, const char * name = 0 )" +.SH "TQCheckBox::TQCheckBox ( TQWidget * parent, const char * name = 0 )" Constructs a checkbox with no text. .PP The \fIparent\fR and \fIname\fR arguments are sent to the TQWidget constructor. -.SH "QCheckBox::QCheckBox ( const TQString & text, TQWidget * parent, const char * name = 0 )" +.SH "TQCheckBox::TQCheckBox ( const TQString & text, TQWidget * parent, const char * name = 0 )" Constructs a checkbox with text \fItext\fR. .PP The \fIparent\fR and \fIname\fR arguments are sent to the TQWidget constructor. @@ -171,7 +171,7 @@ Returns the group that this button belongs to. If the button is not a member of any QButtonGroup, this function returns 0. .PP See also QButtonGroup. -.SH "bool QCheckBox::isChecked () const" +.SH "bool TQCheckBox::isChecked () const" Returns TRUE if the checkbox is checked; otherwise returns FALSE. See the "checked" property for details. .SH "bool QButton::isDown () const" Returns TRUE if the button is pressed; otherwise returns FALSE. See the "down" property for details. @@ -181,7 +181,7 @@ Returns TRUE if the button is an exclusive toggle; otherwise returns FALSE. See Returns TRUE if the button is toggled; otherwise returns FALSE. See the "on" property for details. .SH "bool QButton::isToggleButton () const" Returns TRUE if the button is a toggle button; otherwise returns FALSE. See the "toggleButton" property for details. -.SH "bool QCheckBox::isTristate () const" +.SH "bool TQCheckBox::isTristate () const" Returns TRUE if the checkbox is a tri-state checkbox; otherwise returns FALSE. See the "tristate" property for details. .SH "const TQPixmap * QButton::pixmap () const" Returns the pixmap shown on the button. See the "pixmap" property for details. @@ -200,11 +200,11 @@ See also pressed(), clicked(), and toggled(). Sets the accelerator associated with the button. See the "accel" property for details. .SH "void QButton::setAutoRepeat ( bool )\fC [virtual]\fR" Sets whether autoRepeat is enabled. See the "autoRepeat" property for details. -.SH "void QCheckBox::setChecked ( bool check )\fC [slot]\fR" +.SH "void TQCheckBox::setChecked ( bool check )\fC [slot]\fR" Sets whether the checkbox is checked to \fIcheck\fR. See the "checked" property for details. .SH "void QButton::setDown ( bool )\fC [virtual]\fR" Sets whether the button is pressed. See the "down" property for details. -.SH "void QCheckBox::setNoChange ()" +.SH "void TQCheckBox::setNoChange ()" Sets the checkbox to the "no change" state. .PP See also tristate. @@ -212,7 +212,7 @@ See also tristate. Sets the pixmap shown on the button. See the "pixmap" property for details. .SH "void QButton::setText ( const TQString & )\fC [virtual]\fR" Sets the text shown on the button. See the "text" property for details. -.SH "void QCheckBox::setTristate ( bool y = TRUE )" +.SH "void TQCheckBox::setTristate ( bool y = TRUE )" Sets whether the checkbox is a tri-state checkbox to \fIy\fR. See the "tristate" property for details. .SH "ToggleState QButton::state () const" Returns the state of the toggle button. See the "toggleState" property for details. @@ -283,7 +283,7 @@ The default is two-state, i.e. tri-state is FALSE. Set this property's value with setTristate() and get this property's value with isTristate(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqcheckbox.html +.BR http://doc.trolltech.com/tqcheckbox.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqchecklistitem.3qt b/doc/man/man3/tqchecklistitem.3qt index 879c5d88d..cc0307078 100644 --- a/doc/man/man3/tqchecklistitem.3qt +++ b/doc/man/man3/tqchecklistitem.3qt @@ -1,5 +1,5 @@ '\" t -.TH QCheckListItem 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQCheckListItem 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,7 +7,7 @@ .ad l .nh .SH NAME -QCheckListItem \- Checkable list view items +TQCheckListItem \- Checkable list view items .SH SYNOPSIS \fC#include \fR .PP @@ -22,31 +22,31 @@ Inherits QListViewItem. .BI "enum \fBToggleState\fR { Off, NoChange, On }" .br .ti -1c -.BI "\fBQCheckListItem\fR ( QCheckListItem * parent, const TQString & text, Type tt = RadioButtonController )" +.BI "\fBTQCheckListItem\fR ( TQCheckListItem * parent, const TQString & text, Type tt = RadioButtonController )" .br .ti -1c -.BI "\fBQCheckListItem\fR ( QCheckListItem * parent, QListViewItem * after, const TQString & text, Type tt = RadioButtonController )" +.BI "\fBTQCheckListItem\fR ( TQCheckListItem * parent, QListViewItem * after, const TQString & text, Type tt = RadioButtonController )" .br .ti -1c -.BI "\fBQCheckListItem\fR ( QListViewItem * parent, const TQString & text, Type tt = RadioButtonController )" +.BI "\fBTQCheckListItem\fR ( QListViewItem * parent, const TQString & text, Type tt = RadioButtonController )" .br .ti -1c -.BI "\fBQCheckListItem\fR ( QListViewItem * parent, QListViewItem * after, const TQString & text, Type tt = RadioButtonController )" +.BI "\fBTQCheckListItem\fR ( QListViewItem * parent, QListViewItem * after, const TQString & text, Type tt = RadioButtonController )" .br .ti -1c -.BI "\fBQCheckListItem\fR ( QListView * parent, const TQString & text, Type tt = RadioButtonController )" +.BI "\fBTQCheckListItem\fR ( QListView * parent, const TQString & text, Type tt = RadioButtonController )" .br .ti -1c -.BI "\fBQCheckListItem\fR ( QListView * parent, QListViewItem * after, const TQString & text, Type tt = RadioButtonController )" +.BI "\fBTQCheckListItem\fR ( QListView * parent, QListViewItem * after, const TQString & text, Type tt = RadioButtonController )" .br .ti -1c -.BI "\fBQCheckListItem\fR ( QListViewItem * parent, const TQString & text, const TQPixmap & p )" +.BI "\fBTQCheckListItem\fR ( QListViewItem * parent, const TQString & text, const TQPixmap & p )" .br .ti -1c -.BI "\fBQCheckListItem\fR ( QListView * parent, const TQString & text, const TQPixmap & p )" +.BI "\fBTQCheckListItem\fR ( QListView * parent, const TQString & text, const TQPixmap & p )" .br .ti -1c -.BI "\fB~QCheckListItem\fR ()" +.BI "\fB~TQCheckListItem\fR ()" .br .ti -1c .BI "virtual void \fBpaintCell\fR ( TQPainter * p, const TQColorGroup & cg, int column, int width, int align )" @@ -95,9 +95,9 @@ Inherits QListViewItem. .br .in -1c .SH DESCRIPTION -The QCheckListItem class provides checkable list view items. +The TQCheckListItem class provides checkable list view items. .PP -QCheckListItems are used in QListViews to provide QListViewItems that are checkboxes, radio buttons or controllers. +TQCheckListItems are used in QListViews to provide QListViewItems that are checkboxes, radio buttons or controllers. .PP Checkbox and controller check list items may be inserted at any level in a list view. Radio button check list items must be children of a controller check list item. .PP @@ -111,72 +111,72 @@ The item can be checked or unchecked with setOn(). Its type can be retrieved wit .PP See also QListViewItem, QListView, and Advanced Widgets. .SS "Member Type Documentation" -.SH "QCheckListItem::ToggleState" -This enum specifies a QCheckListItem's toggle state. +.SH "TQCheckListItem::ToggleState" +This enum specifies a TQCheckListItem's toggle state. .TP -\fCQCheckListItem::Off\fR +\fCTQCheckListItem::Off\fR .TP -\fCQCheckListItem::NoChange\fR +\fCTQCheckListItem::NoChange\fR .TP -\fCQCheckListItem::On\fR -.SH "QCheckListItem::Type" -This enum type specifies a QCheckListItem's type: +\fCTQCheckListItem::On\fR +.SH "TQCheckListItem::Type" +This enum type specifies a TQCheckListItem's type: .TP -\fCQCheckListItem::RadioButton\fR +\fCTQCheckListItem::RadioButton\fR .TP -\fCQCheckListItem::CheckBox\fR +\fCTQCheckListItem::CheckBox\fR .TP -\fCQCheckListItem::Controller\fR - \fIobsolete\fR (use RadioButtonController instead) +\fCTQCheckListItem::Controller\fR - \fIobsolete\fR (use RadioButtonController instead) .TP -\fCQCheckListItem::RadioButtonController\fR +\fCTQCheckListItem::RadioButtonController\fR .TP -\fCQCheckListItem::CheckBoxController\fR +\fCTQCheckListItem::CheckBoxController\fR .SH MEMBER FUNCTION DOCUMENTATION -.SH "QCheckListItem::QCheckListItem ( QCheckListItem * parent, const TQString & text, Type tt = RadioButtonController )" +.SH "TQCheckListItem::TQCheckListItem ( TQCheckListItem * parent, const TQString & text, Type tt = RadioButtonController )" Constructs a checkable item with parent \fIparent\fR, text \fItext\fR and of type \fItt\fR. Note that a RadioButton must be the child of a RadioButtonController, otherwise it will not toggle. -.SH "QCheckListItem::QCheckListItem ( QCheckListItem * parent, QListViewItem * after, const TQString & text, Type tt = RadioButtonController )" +.SH "TQCheckListItem::TQCheckListItem ( TQCheckListItem * parent, QListViewItem * after, const TQString & text, Type tt = RadioButtonController )" Constructs a checkable item with parent \fIparent\fR, which is after \fIafter\fR in the parent's list of children, and with text \fItext\fR and of type \fItt\fR. Note that a RadioButton must be the child of a RadioButtonController, otherwise it will not toggle. -.SH "QCheckListItem::QCheckListItem ( QListViewItem * parent, const TQString & text, Type tt = RadioButtonController )" +.SH "TQCheckListItem::TQCheckListItem ( QListViewItem * parent, const TQString & text, Type tt = RadioButtonController )" Constructs a checkable item with parent \fIparent\fR, text \fItext\fR and of type \fItt\fR. Note that this item must \fInot\fR be a RadioButton. Radio buttons must be children of a RadioButtonController. -.SH "QCheckListItem::QCheckListItem ( QListViewItem * parent, QListViewItem * after, const TQString & text, Type tt = RadioButtonController )" +.SH "TQCheckListItem::TQCheckListItem ( QListViewItem * parent, QListViewItem * after, const TQString & text, Type tt = RadioButtonController )" Constructs a checkable item with parent \fIparent\fR, which is after \fIafter\fR in the parent's list of children, with text \fItext\fR and of type \fItt\fR. Note that this item must \fInot\fR be a RadioButton. Radio buttons must be children of a RadioButtonController. -.SH "QCheckListItem::QCheckListItem ( QListView * parent, const TQString & text, Type tt = RadioButtonController )" +.SH "TQCheckListItem::TQCheckListItem ( QListView * parent, const TQString & text, Type tt = RadioButtonController )" Constructs a checkable item with parent \fIparent\fR, text \fItext\fR and of type \fItt\fR. Note that \fItt\fR must \fInot\fR be RadioButton. Radio buttons must be children of a RadioButtonController. -.SH "QCheckListItem::QCheckListItem ( QListView * parent, QListViewItem * after, const TQString & text, Type tt = RadioButtonController )" +.SH "TQCheckListItem::TQCheckListItem ( QListView * parent, QListViewItem * after, const TQString & text, Type tt = RadioButtonController )" Constructs a checkable item with parent \fIparent\fR, which is after \fIafter\fR in the parent's list of children, with text \fItext\fR and of type \fItt\fR. Note that \fItt\fR must \fInot\fR be RadioButton. Radio buttons must be children of a RadioButtonController. -.SH "QCheckListItem::QCheckListItem ( QListViewItem * parent, const TQString & text, const TQPixmap & p )" +.SH "TQCheckListItem::TQCheckListItem ( QListViewItem * parent, const TQString & text, const TQPixmap & p )" Constructs a RadioButtonController item with parent \fIparent\fR, text \fItext\fR and pixmap \fIp\fR. -.SH "QCheckListItem::QCheckListItem ( QListView * parent, const TQString & text, const TQPixmap & p )" +.SH "TQCheckListItem::TQCheckListItem ( QListView * parent, const TQString & text, const TQPixmap & p )" Constructs a RadioButtonController item with parent \fIparent\fR, text \fItext\fR and pixmap \fIp\fR. -.SH "QCheckListItem::~QCheckListItem ()" +.SH "TQCheckListItem::~TQCheckListItem ()" Destroys the item, and all its children to any depth, freeing up all allocated resources. -.SH "void QCheckListItem::activate ()\fC [virtual protected]\fR" +.SH "void TQCheckListItem::activate ()\fC [virtual protected]\fR" Toggle check box or set radio button to on. .PP Reimplemented from QListViewItem. -.SH "bool QCheckListItem::isOn () const" +.SH "bool TQCheckListItem::isOn () const" Returns TRUE if the item is toggled on; otherwise returns FALSE. -.SH "bool QCheckListItem::isTristate () const" +.SH "bool TQCheckListItem::isTristate () const" Returns TRUE if the item is tristate; otherwise returns FALSE. .PP See also setTristate(). -.SH "void QCheckListItem::paintCell ( TQPainter * p, const TQColorGroup & cg, int column, int width, int align )\fC [virtual]\fR" +.SH "void TQCheckListItem::paintCell ( TQPainter * p, const TQColorGroup & cg, int column, int width, int align )\fC [virtual]\fR" Paints the item using the painter \fIp\fR and the color group \fIcg\fR. The item is in column \fIcolumn\fR, has width \fIwidth\fR and has alignment \fIalign\fR. (See TQt::AlignmentFlags for valid alignments.) .PP Reimplemented from QListViewItem. -.SH "void QCheckListItem::paintFocus ( TQPainter * p, const TQColorGroup & cg, const TQRect & r )\fC [virtual]\fR" +.SH "void TQCheckListItem::paintFocus ( TQPainter * p, const TQColorGroup & cg, const TQRect & r )\fC [virtual]\fR" Draws the focus rectangle \fIr\fR using the color group \fIcg\fR on the painter \fIp\fR. .PP Reimplemented from QListViewItem. -.SH "int QCheckListItem::rtti () const\fC [virtual]\fR" +.SH "int TQCheckListItem::rtti () const\fC [virtual]\fR" Returns 1. .PP Make your derived classes return their own values for rtti(), and you can distinguish between list view items. You should use values greater than 1000, to allow for extensions to this class. .PP Reimplemented from QListViewItem. -.SH "void QCheckListItem::setOn ( bool b )\fC [virtual]\fR" +.SH "void TQCheckListItem::setOn ( bool b )\fC [virtual]\fR" Sets the button on if \fIb\fR is TRUE, otherwise sets it off. Maintains radio button exclusivity. -.SH "void QCheckListItem::setState ( ToggleState s )" +.SH "void TQCheckListItem::setState ( ToggleState s )" Sets the toggle state of the checklistitem to \fIs\fR. \fIs\fR can be Off, NoChange or On. .PP Tristate can only be enabled for CheckBox or CheckBoxController, therefore the NoChange only applies to them. @@ -184,27 +184,27 @@ Tristate can only be enabled for CheckBox or CheckBoxController, therefore the N Setting the state to On or Off on a CheckBoxController will recursivly set the states of its children to the same state. .PP Setting the state to NoChange on a CheckBoxController will make it recursivly recall the previous stored state of its children. If there was no previous stored state the children are all set to On. -.SH "void QCheckListItem::setTristate ( bool b )" +.SH "void TQCheckListItem::setTristate ( bool b )" Sets tristate to \fIb\fR if the Type is either a CheckBoxController or a CheckBox. .PP \fCCheckBoxControllers\fR are tristate by default. .PP See also state() and isTristate(). -.SH "ToggleState QCheckListItem::state () const" +.SH "ToggleState TQCheckListItem::state () const" Returns the state of the item. .PP -See also QCheckListItem::ToggleState. -.SH "void QCheckListItem::stateChange ( bool )\fC [virtual protected]\fR" +See also TQCheckListItem::ToggleState. +.SH "void TQCheckListItem::stateChange ( bool )\fC [virtual protected]\fR" This virtual function is called when the item changes its state. NoChange (if tristate is enabled and the type is either CheckBox or CheckBoxController) reports the same as Off, so use state() to determine if the state is actually Off or NoChange. -.SH "TQString QCheckListItem::text () const" +.SH "TQString TQCheckListItem::text () const" Returns the item's text. -.SH "void QCheckListItem::turnOffChild ()\fC [protected]\fR" +.SH "void TQCheckListItem::turnOffChild ()\fC [protected]\fR" If this is a RadioButtonController that has RadioButton children, turn off the child that is on. -.SH "Type QCheckListItem::type () const" +.SH "Type TQCheckListItem::type () const" Returns the type of this item. .SH "SEE ALSO" -.BR http://doc.trolltech.com/qchecklistitem.html +.BR http://doc.trolltech.com/tqchecklistitem.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqchecktableitem.3qt b/doc/man/man3/tqchecktableitem.3qt index 1245be951..b2e99a38c 100644 --- a/doc/man/man3/tqchecktableitem.3qt +++ b/doc/man/man3/tqchecktableitem.3qt @@ -1,5 +1,5 @@ '\" t -.TH QCheckTableItem 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQCheckTableItem 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,7 +7,7 @@ .ad l .nh .SH NAME -QCheckTableItem \- Checkboxes in QTables +TQCheckTableItem \- Checkboxes in QTables .SH SYNOPSIS \fC#include \fR .PP @@ -16,7 +16,7 @@ Inherits QTableItem. .SS "Public Members" .in +1c .ti -1c -.BI "\fBQCheckTableItem\fR ( QTable * table, const TQString & txt )" +.BI "\fBTQCheckTableItem\fR ( QTable * table, const TQString & txt )" .br .ti -1c .BI "virtual void \fBsetChecked\fR ( bool b )" @@ -29,17 +29,17 @@ Inherits QTableItem. .br .in -1c .SH DESCRIPTION -The QCheckTableItem class provides checkboxes in QTables. +The TQCheckTableItem class provides checkboxes in QTables. .PP -A QCheckTableItem is a table item which looks and behaves like a checkbox. The advantage of using QCheckTableItems rather than real checkboxes is that a QCheckTableItem uses far less resources than a real checkbox would in a QTable. When the cell has the focus it displays a real checkbox which the user can interact with. When the cell does not have the focus the cell \fIlooks\fR like a checkbox. Pixmaps may not be used in QCheckTableItems. +A TQCheckTableItem is a table item which looks and behaves like a checkbox. The advantage of using TQCheckTableItems rather than real checkboxes is that a TQCheckTableItem uses far less resources than a real checkbox would in a QTable. When the cell has the focus it displays a real checkbox which the user can interact with. When the cell does not have the focus the cell \fIlooks\fR like a checkbox. Pixmaps may not be used in TQCheckTableItems. .PP -QCheckTableItem items have the edit type WhenCurrent (see EditType). +TQCheckTableItem items have the edit type WhenCurrent (see EditType). .PP To change the checkbox's label use setText(). The checkbox can be checked and unchecked with setChecked() and its state retrieved using isChecked(). .PP -To populate a table cell with a QCheckTableItem use QTable::setItem(). +To populate a table cell with a TQCheckTableItem use QTable::setItem(). .PP -QCheckTableItems can be distinguished from QTableItems and QComboTableItems using their Run Time Type Identification (rtti) value. +TQCheckTableItems can be distinguished from QTableItems and TQComboTableItems using their Run Time Type Identification (rtti) value. .PP
          .ce 1 @@ -47,15 +47,15 @@ QCheckTableItems can be distinguished from QTableItems and QComboTableItems usin .PP
          .PP -See also rtti(), EditType, QComboTableItem, QTableItem, QCheckBox, and Advanced Widgets. +See also rtti(), EditType, TQComboTableItem, QTableItem, TQCheckBox, and Advanced Widgets. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QCheckTableItem::QCheckTableItem ( QTable * table, const TQString & txt )" -Creates a QCheckTableItem with an EditType of WhenCurrent as a child of \fItable\fR. The checkbox is initially unchecked and its label is set to the string \fItxt\fR. -.SH "bool QCheckTableItem::isChecked () const" +.SH "TQCheckTableItem::TQCheckTableItem ( QTable * table, const TQString & txt )" +Creates a TQCheckTableItem with an EditType of WhenCurrent as a child of \fItable\fR. The checkbox is initially unchecked and its label is set to the string \fItxt\fR. +.SH "bool TQCheckTableItem::isChecked () const" Returns TRUE if the checkbox table item is checked; otherwise returns FALSE. .PP See also setChecked(). -.SH "int QCheckTableItem::rtti () const\fC [virtual]\fR" +.SH "int TQCheckTableItem::rtti () const\fC [virtual]\fR" Returns 2. .PP Make your derived classes return their own values for rtti()to distinguish between different table item subclasses. You should use values greater than 1000, preferably a large random number, to allow for extensions to this class. @@ -63,13 +63,13 @@ Make your derived classes return their own values for rtti()to distinguish betwe See also QTableItem::rtti(). .PP Reimplemented from QTableItem. -.SH "void QCheckTableItem::setChecked ( bool b )\fC [virtual]\fR" +.SH "void TQCheckTableItem::setChecked ( bool b )\fC [virtual]\fR" If \fIb\fR is TRUE the checkbox is checked; if \fIb\fR is FALSE the checkbox is unchecked. .PP See also isChecked(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/qchecktableitem.html +.BR http://doc.trolltech.com/tqchecktableitem.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqcolordialog.3qt b/doc/man/man3/tqcolordialog.3qt index 967c8cda4..15fb0bba0 100644 --- a/doc/man/man3/tqcolordialog.3qt +++ b/doc/man/man3/tqcolordialog.3qt @@ -11,7 +11,7 @@ TQColorDialog \- Dialog widget for specifying colors .SH SYNOPSIS \fC#include \fR .PP -Inherits QDialog. +Inherits TQDialog. .PP .SS "Static Public Members"
        1. TQColor \fBgetColor\fR ( const TQColor & initial = white, TQWidget * parent = 0, const char * name = 0 )
        2. TQRgb \fBgetRgba\fR ( TQRgb initial, bool * ok = 0, TQWidget * parent = 0, const char * name = 0 )
        3. int \fBcustomCount\fR ()
        4. TQRgb \fBcustomColor\fR ( int i )
        5. void \fBsetCustomColor\fR ( int i, TQRgb c )
        6. void \fBsetStandardColor\fR ( int i, TQRgb c ) diff --git a/doc/man/man3/tqcombobox.3qt b/doc/man/man3/tqcombobox.3qt index fff211689..14bafe163 100644 --- a/doc/man/man3/tqcombobox.3qt +++ b/doc/man/man3/tqcombobox.3qt @@ -1,5 +1,5 @@ '\" t -.TH QComboBox 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQComboBox 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,22 +7,22 @@ .ad l .nh .SH NAME -QComboBox \- Combined button and popup list +TQComboBox \- Combined button and popup list .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP Inherits TQWidget. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQComboBox\fR ( TQWidget * parent = 0, const char * name = 0 )" +.BI "\fBTQComboBox\fR ( TQWidget * parent = 0, const char * name = 0 )" .br .ti -1c -.BI "\fBQComboBox\fR ( bool rw, TQWidget * parent = 0, const char * name = 0 )" +.BI "\fBTQComboBox\fR ( bool rw, TQWidget * parent = 0, const char * name = 0 )" .br .ti -1c -.BI "\fB~QComboBox\fR ()" +.BI "\fB~TQComboBox\fR ()" .br .ti -1c .BI "int \fBcount\fR () const" @@ -124,10 +124,10 @@ Inherits TQWidget. .BI "QListBox * \fBlistBox\fR () const" .br .ti -1c -.BI "virtual void \fBsetLineEdit\fR ( QLineEdit * edit )" +.BI "virtual void \fBsetLineEdit\fR ( TQLineEdit * edit )" .br .ti -1c -.BI "QLineEdit * \fBlineEdit\fR () const" +.BI "TQLineEdit * \fBlineEdit\fR () const" .br .ti -1c .BI "virtual void \fBsetAutoCompletion\fR ( bool )" @@ -221,19 +221,19 @@ Inherits TQWidget. .br .in -1c .SH DESCRIPTION -The QComboBox widget is a combined button and popup list. +The TQComboBox widget is a combined button and popup list. .PP A combobox is a selection widget which displays the current item and can pop up a list of items. A combobox may be editable in which case the user can enter arbitrary strings. .PP Comboboxes provide a means of showing the user's current choice out of a list of options in a way that takes up the minimum amount of screen space. .PP -QComboBox supports three different display styles: Aqua/Motif 1.x, Motif 2.0 and Windows. In Motif 1.x, a combobox was called XmOptionMenu. In Motif 2.0, OSF introduced an improved combobox and named that XmComboBox. QComboBox provides both. +TQComboBox supports three different display styles: Aqua/Motif 1.x, Motif 2.0 and Windows. In Motif 1.x, a combobox was called XmOptionMenu. In Motif 2.0, OSF introduced an improved combobox and named that XmComboBox. TQComboBox provides both. .PP -QComboBox provides two different constructors. The simplest constructor creates an "old-style" combobox in Motif (or Aqua) style: +TQComboBox provides two different constructors. The simplest constructor creates an "old-style" combobox in Motif (or Aqua) style: .PP .nf .br - QComboBox *c = new QComboBox( this, "read-only combobox" ); + TQComboBox *c = new TQComboBox( this, "read-only combobox" ); .br .fi .PP @@ -241,9 +241,9 @@ The other constructor creates a new-style combobox in Motif style, and can creat .PP .nf .br - QComboBox *c1 = new QComboBox( FALSE, this, "read-only combobox" ); + TQComboBox *c1 = new TQComboBox( FALSE, this, "read-only combobox" ); .br - QComboBox *c2 = new QComboBox( TRUE, this, "editable combobox" ); + TQComboBox *c2 = new TQComboBox( TRUE, this, "editable combobox" ); .br .fi .PP @@ -283,118 +283,118 @@ A combobox can be populated using the insert functions, insertStringList() and i .PP (Windows style) .PP -Depending on the style, QComboBox will use a QListBox or a TQPopupMenu to display the list of items. See setListBox() for more information. +Depending on the style, TQComboBox will use a QListBox or a TQPopupMenu to display the list of items. See setListBox() for more information. .PP -See also QLineEdit, QListBox, QSpinBox, QRadioButton, QButtonGroup, GUI Design Handbook: Combo Box, GUI Design Handbook: Drop-Down List Box, and Basic Widgets. +See also TQLineEdit, QListBox, TQSpinBox, TQRadioButton, QButtonGroup, GUI Design Handbook: Combo Box, GUI Design Handbook: Drop-Down List Box, and Basic Widgets. .SS "Member Type Documentation" -.SH "QComboBox::Policy" -This enum specifies what the QComboBox should do when a new string is entered by the user. +.SH "TQComboBox::Policy" +This enum specifies what the TQComboBox should do when a new string is entered by the user. .TP -\fCQComboBox::NoInsertion\fR - the string will not be inserted into the combobox. +\fCTQComboBox::NoInsertion\fR - the string will not be inserted into the combobox. .TP -\fCQComboBox::AtTop\fR - insert the string as the first item in the combobox. +\fCTQComboBox::AtTop\fR - insert the string as the first item in the combobox. .TP -\fCQComboBox::AtCurrent\fR - replace the previously selected item with the string the user has entered. +\fCTQComboBox::AtCurrent\fR - replace the previously selected item with the string the user has entered. .TP -\fCQComboBox::AtBottom\fR - insert the string as the last item in the combobox. +\fCTQComboBox::AtBottom\fR - insert the string as the last item in the combobox. .TP -\fCQComboBox::AfterCurrent\fR - insert the string after the previously selected item. +\fCTQComboBox::AfterCurrent\fR - insert the string after the previously selected item. .TP -\fCQComboBox::BeforeCurrent\fR - insert the string before the previously selected item. +\fCTQComboBox::BeforeCurrent\fR - insert the string before the previously selected item. .PP activated() is always emitted when the string is entered. .PP If inserting the new string would cause the combobox to breach its content size limit, the item at the other end of the list is deleted. The definition of "other end" is implementation-dependent. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QComboBox::QComboBox ( TQWidget * parent = 0, const char * name = 0 )" +.SH "TQComboBox::TQComboBox ( TQWidget * parent = 0, const char * name = 0 )" Constructs a combobox widget with parent \fIparent\fR called \fIname\fR. .PP This constructor creates a popup list if the program uses Motif (or Aqua) look and feel; this is compatible with Motif 1.x and Aqua. .PP -Note: If you use this constructor to create your QComboBox, then the pixmap() function will always return 0. To workaround this, use the other constructor. -.SH "QComboBox::QComboBox ( bool rw, TQWidget * parent = 0, const char * name = 0 )" +Note: If you use this constructor to create your TQComboBox, then the pixmap() function will always return 0. To workaround this, use the other constructor. +.SH "TQComboBox::TQComboBox ( bool rw, TQWidget * parent = 0, const char * name = 0 )" Constructs a combobox with a maximum size and either Motif 2.0 or Windows look and feel. .PP The input field can be edited if \fIrw\fR is TRUE, otherwise the user may only choose one of the items in the combobox. .PP The \fIparent\fR and \fIname\fR arguments are passed on to the TQWidget constructor. -.SH "QComboBox::~QComboBox ()" +.SH "TQComboBox::~TQComboBox ()" Destroys the combobox. -.SH "void QComboBox::activated ( int index )\fC [signal]\fR" +.SH "void TQComboBox::activated ( int index )\fC [signal]\fR" This signal is emitted when a new item has been activated (selected). The \fIindex\fR is the position of the item in the combobox. .PP This signal is not emitted if the item is changed programmatically, e.g. using setCurrentItem(). .PP Examples: .)l fileiconview/mainwindow.cpp, helpviewer/helpwindow.cpp, lineedits/lineedits.cpp, listboxcombo/listboxcombo.cpp, and qmag/qmag.cpp. -.SH "void QComboBox::activated ( const TQString & string )\fC [signal]\fR" +.SH "void TQComboBox::activated ( const TQString & string )\fC [signal]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP This signal is emitted when a new item has been activated (selected). \fIstring\fR is the selected string. .PP You can also use the activated(int) signal, but be aware that its argument is meaningful only for selected strings, not for user entered strings. -.SH "bool QComboBox::autoCompletion () const" +.SH "bool TQComboBox::autoCompletion () const" Returns TRUE if auto-completion is enabled; otherwise returns FALSE. See the "autoCompletion" property for details. -.SH "bool QComboBox::autoResize () const" +.SH "bool TQComboBox::autoResize () const" Returns TRUE if auto resize is enabled; otherwise returns FALSE. See the "autoResize" property for details. -.SH "void QComboBox::changeItem ( const TQString & t, int index )" +.SH "void TQComboBox::changeItem ( const TQString & t, int index )" Replaces the item at position \fIindex\fR with the text \fIt\fR. -.SH "void QComboBox::changeItem ( const TQPixmap & im, int index )" +.SH "void TQComboBox::changeItem ( const TQPixmap & im, int index )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Replaces the item at position \fIindex\fR with the pixmap \fIim\fR, unless the combobox is editable. .PP See also insertItem(). -.SH "void QComboBox::changeItem ( const TQPixmap & im, const TQString & t, int index )" +.SH "void TQComboBox::changeItem ( const TQPixmap & im, const TQString & t, int index )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Replaces the item at position \fIindex\fR with the pixmap \fIim\fR and the text \fIt\fR. .PP See also insertItem(). -.SH "void QComboBox::clear ()\fC [slot]\fR" +.SH "void TQComboBox::clear ()\fC [slot]\fR" Removes all combobox items. -.SH "void QComboBox::clearEdit ()\fC [slot]\fR" +.SH "void TQComboBox::clearEdit ()\fC [slot]\fR" Clears the line edit without changing the combobox's contents. Does nothing if the combobox isn't editable. .PP This is particularly useful when using a combobox as a line edit with history. For example you can connect the combobox's activated() signal to clearEdit() in order to present the user with a new, empty line as soon as Enter is pressed. .PP See also setEditText(). -.SH "void QComboBox::clearValidator ()\fC [slot]\fR" +.SH "void TQComboBox::clearValidator ()\fC [slot]\fR" This slot is equivalent to setValidator( 0 ). -.SH "int QComboBox::count () const" +.SH "int TQComboBox::count () const" Returns the number of items in the combobox. See the "count" property for details. -.SH "int QComboBox::currentItem () const" +.SH "int TQComboBox::currentItem () const" Returns the index of the current item in the combobox. See the "currentItem" property for details. -.SH "TQString QComboBox::currentText () const" +.SH "TQString TQComboBox::currentText () const" Returns the text of the combobox's current item. See the "currentText" property for details. -.SH "bool QComboBox::duplicatesEnabled () const" +.SH "bool TQComboBox::duplicatesEnabled () const" Returns TRUE if duplicates are allowed; otherwise returns FALSE. See the "duplicatesEnabled" property for details. -.SH "bool QComboBox::editable () const" +.SH "bool TQComboBox::editable () const" Returns TRUE if the combobox is editable; otherwise returns FALSE. See the "editable" property for details. -.SH "void QComboBox::highlighted ( int index )\fC [signal]\fR" +.SH "void TQComboBox::highlighted ( int index )\fC [signal]\fR" This signal is emitted when a new item has been set to be the current item. The \fIindex\fR is the position of the item in the combobox. .PP This signal is not emitted if the item is changed programmatically, e.g. using setCurrentItem(). -.SH "void QComboBox::highlighted ( const TQString & string )\fC [signal]\fR" +.SH "void TQComboBox::highlighted ( const TQString & string )\fC [signal]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP This signal is emitted when a new item has been set to be the current item. \fIstring\fR is the item's text. .PP You can also use the highlighted(int) signal. -.SH "void QComboBox::insertItem ( const TQString & t, int index = -1 )" +.SH "void TQComboBox::insertItem ( const TQString & t, int index = -1 )" Inserts a text item with text \fIt\fR, at position \fIindex\fR. The item will be appended if \fIindex\fR is negative. .PP Examples: .)l chart/optionsform.cpp, fileiconview/mainwindow.cpp, helpviewer/helpwindow.cpp, lineedits/lineedits.cpp, listboxcombo/listboxcombo.cpp, regexptester/regexptester.cpp, and tictac/tictac.cpp. -.SH "void QComboBox::insertItem ( const TQPixmap & pixmap, int index = -1 )" +.SH "void TQComboBox::insertItem ( const TQPixmap & pixmap, int index = -1 )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Inserts a \fIpixmap\fR item at position \fIindex\fR. The item will be appended if \fIindex\fR is negative. -.SH "void QComboBox::insertItem ( const TQPixmap & pixmap, const TQString & text, int index = -1 )" +.SH "void TQComboBox::insertItem ( const TQPixmap & pixmap, const TQString & text, int index = -1 )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Inserts a \fIpixmap\fR item with additional text \fItext\fR at position \fIindex\fR. The item will be appended if \fIindex\fR is negative. -.SH "void QComboBox::insertStrList ( const char ** strings, int numStrings = -1, int index = -1 )" +.SH "void TQComboBox::insertStrList ( const char ** strings, int numStrings = -1, int index = -1 )" Inserts the array of char * \fIstrings\fR at position \fIindex\fR in the combobox. .PP The \fInumStrings\fR argument is the number of strings. If \fInumStrings\fR is -1 (default), the \fIstrings\fR array must be terminated with 0. @@ -412,98 +412,98 @@ Example: See also insertStringList(). .PP Example: qmag/qmag.cpp. -.SH "void QComboBox::insertStrList ( const TQStrList & list, int index = -1 )" +.SH "void TQComboBox::insertStrList ( const TQStrList & list, int index = -1 )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Inserts the \fIlist\fR of strings at position \fIindex\fR in the combobox. .PP This is only for compatibility since it does not support Unicode strings. See insertStringList(). -.SH "void QComboBox::insertStrList ( const TQStrList * list, int index = -1 )" +.SH "void TQComboBox::insertStrList ( const TQStrList * list, int index = -1 )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Inserts the \fIlist\fR of strings at position \fIindex\fR in the combobox. .PP This is only for compatibility since it does not support Unicode strings. See insertStringList(). -.SH "void QComboBox::insertStringList ( const TQStringList & list, int index = -1 )" +.SH "void TQComboBox::insertStringList ( const TQStringList & list, int index = -1 )" Inserts the \fIlist\fR of strings at position \fIindex\fR in the combobox. -.SH "Policy QComboBox::insertionPolicy () const" +.SH "Policy TQComboBox::insertionPolicy () const" Returns the position of the items inserted by the user. See the "insertionPolicy" property for details. -.SH "QLineEdit * QComboBox::lineEdit () const" +.SH "TQLineEdit * TQComboBox::lineEdit () const" Returns the line edit, or 0 if there is no line edit. .PP Only editable listboxes have a line editor. -.SH "QListBox * QComboBox::listBox () const" -Returns the current list box, or 0 if there is no list box. (QComboBox can use TQPopupMenu instead of QListBox.) Provided to match setListBox(). +.SH "QListBox * TQComboBox::listBox () const" +Returns the current list box, or 0 if there is no list box. (TQComboBox can use TQPopupMenu instead of QListBox.) Provided to match setListBox(). .PP See also setListBox(). .PP Example: listboxcombo/listboxcombo.cpp. -.SH "int QComboBox::maxCount () const" +.SH "int TQComboBox::maxCount () const" Returns the maximum number of items allowed in the combobox. See the "maxCount" property for details. -.SH "const TQPixmap * QComboBox::pixmap ( int index ) const" +.SH "const TQPixmap * TQComboBox::pixmap ( int index ) const" Returns the pixmap item at position \fIindex\fR, or 0 if the item is not a pixmap. -.SH "void QComboBox::popup ()\fC [virtual]\fR" +.SH "void TQComboBox::popup ()\fC [virtual]\fR" Pops up the combobox popup list. .PP If the list is empty, no items appear. -.SH "void QComboBox::removeItem ( int index )" +.SH "void TQComboBox::removeItem ( int index )" Removes the item at position \fIindex\fR. -.SH "void QComboBox::setAutoCompletion ( bool )\fC [virtual]\fR" +.SH "void TQComboBox::setAutoCompletion ( bool )\fC [virtual]\fR" Sets whether auto-completion is enabled. See the "autoCompletion" property for details. -.SH "void QComboBox::setAutoResize ( bool )\fC [virtual]\fR" +.SH "void TQComboBox::setAutoResize ( bool )\fC [virtual]\fR" Sets whether auto resize is enabled. See the "autoResize" property for details. -.SH "void QComboBox::setCurrentItem ( int index )\fC [virtual]\fR" +.SH "void TQComboBox::setCurrentItem ( int index )\fC [virtual]\fR" Sets the index of the current item in the combobox to \fIindex\fR. See the "currentItem" property for details. -.SH "void QComboBox::setCurrentText ( const TQString & )\fC [virtual]\fR" +.SH "void TQComboBox::setCurrentText ( const TQString & )\fC [virtual]\fR" Sets the text of the combobox's current item. See the "currentText" property for details. -.SH "void QComboBox::setDuplicatesEnabled ( bool enable )" +.SH "void TQComboBox::setDuplicatesEnabled ( bool enable )" Sets whether duplicates are allowed to \fIenable\fR. See the "duplicatesEnabled" property for details. -.SH "void QComboBox::setEditText ( const TQString & newText )\fC [virtual slot]\fR" +.SH "void TQComboBox::setEditText ( const TQString & newText )\fC [virtual slot]\fR" Sets the text in the line edit to \fInewText\fR without changing the combobox's contents. Does nothing if the combobox isn't editable. .PP This is useful e.g. for providing a good starting point for the user's editing and entering the change in the combobox only when the user presses Enter. .PP See also clearEdit() and insertItem(). -.SH "void QComboBox::setEditable ( bool )" +.SH "void TQComboBox::setEditable ( bool )" Sets whether the combobox is editable. See the "editable" property for details. -.SH "void QComboBox::setFont ( const TQFont & font )\fC [virtual]\fR" +.SH "void TQComboBox::setFont ( const TQFont & font )\fC [virtual]\fR" Sets the font for both the combobox button and the combobox popup list to \fIfont\fR. .PP Reimplemented from TQWidget. -.SH "void QComboBox::setInsertionPolicy ( Policy policy )\fC [virtual]\fR" +.SH "void TQComboBox::setInsertionPolicy ( Policy policy )\fC [virtual]\fR" Sets the position of the items inserted by the user to \fIpolicy\fR. See the "insertionPolicy" property for details. -.SH "void QComboBox::setLineEdit ( QLineEdit * edit )\fC [virtual]\fR" +.SH "void TQComboBox::setLineEdit ( TQLineEdit * edit )\fC [virtual]\fR" Sets the line edit to use \fIedit\fR instead of the current line edit. -.SH "void QComboBox::setListBox ( QListBox * newListBox )\fC [virtual]\fR" +.SH "void TQComboBox::setListBox ( QListBox * newListBox )\fC [virtual]\fR" Sets the combobox to use \fInewListBox\fR instead of the current list box or popup. As a side effect, it clears the combobox of its current contents. .PP -\fBWarning:\fR QComboBox assumes that newListBox->text(n) returns non-null for 0 <= n < newListbox->count(). This assumption is necessary because of the line edit in QComboBox. -.SH "void QComboBox::setMaxCount ( int )\fC [virtual]\fR" +\fBWarning:\fR TQComboBox assumes that newListBox->text(n) returns non-null for 0 <= n < newListbox->count(). This assumption is necessary because of the line edit in TQComboBox. +.SH "void TQComboBox::setMaxCount ( int )\fC [virtual]\fR" Sets the maximum number of items allowed in the combobox. See the "maxCount" property for details. -.SH "void QComboBox::setPalette ( const TQPalette & palette )\fC [virtual]\fR" +.SH "void TQComboBox::setPalette ( const TQPalette & palette )\fC [virtual]\fR" Sets the palette for both the combobox button and the combobox popup list to \fIpalette\fR. .PP Reimplemented from TQWidget. -.SH "void QComboBox::setSizeLimit ( int )\fC [virtual]\fR" +.SH "void TQComboBox::setSizeLimit ( int )\fC [virtual]\fR" Sets the maximum on-screen size of the combobox. See the "sizeLimit" property for details. -.SH "void QComboBox::setValidator ( const QValidator * v )\fC [virtual]\fR" +.SH "void TQComboBox::setValidator ( const QValidator * v )\fC [virtual]\fR" Applies the validator \fIv\fR to the combobox so that only text which is valid according to \fIv\fR is accepted. .PP This function does nothing if the combobox is not editable. .PP See also validator(), clearValidator(), and QValidator. -.SH "int QComboBox::sizeLimit () const" +.SH "int TQComboBox::sizeLimit () const" Returns the maximum on-screen size of the combobox. See the "sizeLimit" property for details. -.SH "TQString QComboBox::text ( int index ) const" +.SH "TQString TQComboBox::text ( int index ) const" Returns the text item at position \fIindex\fR, or TQString::null if the item is not a string. .PP See also currentText. .PP Examples: .)l fileiconview/mainwindow.cpp and helpviewer/helpwindow.cpp. -.SH "void QComboBox::textChanged ( const TQString & string )\fC [signal]\fR" +.SH "void TQComboBox::textChanged ( const TQString & string )\fC [signal]\fR" This signal is used for editable comboboxes. It is emitted whenever the contents of the text entry field changes. \fIstring\fR contains the new text. -.SH "const QValidator * QComboBox::validator () const" +.SH "const QValidator * TQComboBox::validator () const" Returns the validator which constrains editing for this combobox if there is one; otherwise returns 0. .PP See also setValidator(), clearValidator(), and QValidator. @@ -578,7 +578,7 @@ This property is ignored for both Motif 1.x style and non-editable comboboxes in Set this property's value with setSizeLimit() and get this property's value with sizeLimit(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqcombobox.html +.BR http://doc.trolltech.com/tqcombobox.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqcombotableitem.3qt b/doc/man/man3/tqcombotableitem.3qt index ca4314ea0..3d0db43e8 100644 --- a/doc/man/man3/tqcombotableitem.3qt +++ b/doc/man/man3/tqcombotableitem.3qt @@ -1,5 +1,5 @@ '\" t -.TH QComboTableItem 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQComboTableItem 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,7 +7,7 @@ .ad l .nh .SH NAME -QComboTableItem \- Means of using comboboxes in QTables +TQComboTableItem \- Means of using comboboxes in QTables .SH SYNOPSIS \fC#include \fR .PP @@ -16,10 +16,10 @@ Inherits QTableItem. .SS "Public Members" .in +1c .ti -1c -.BI "\fBQComboTableItem\fR ( QTable * table, const TQStringList & list, bool editable = FALSE )" +.BI "\fBTQComboTableItem\fR ( QTable * table, const TQStringList & list, bool editable = FALSE )" .br .ti -1c -.BI "\fB~QComboTableItem\fR ()" +.BI "\fB~TQComboTableItem\fR ()" .br .ti -1c .BI "virtual void \fBsetCurrentItem\fR ( int i )" @@ -53,21 +53,21 @@ Inherits QTableItem. .br .in -1c .SH DESCRIPTION -The QComboTableItem class provides a means of using comboboxes in QTables. +The TQComboTableItem class provides a means of using comboboxes in QTables. .PP -A QComboTableItem is a table item which looks and behaves like a combobox. The advantage of using QComboTableItems rather than real comboboxes is that a QComboTableItem uses far less resources than real comboboxes in QTables. When the cell has the focus it displays a real combobox which the user can interact with. When the cell does not have the focus the cell \fIlooks\fR like a combobox. Only text items (i.e. no pixmaps) may be used in QComboTableItems. +A TQComboTableItem is a table item which looks and behaves like a combobox. The advantage of using TQComboTableItems rather than real comboboxes is that a TQComboTableItem uses far less resources than real comboboxes in QTables. When the cell has the focus it displays a real combobox which the user can interact with. When the cell does not have the focus the cell \fIlooks\fR like a combobox. Only text items (i.e. no pixmaps) may be used in TQComboTableItems. .PP -QComboTableItem items have the edit type WhenCurrent (see EditType). The QComboTableItem's list of items is provided by a TQStringList passed to the constructor. +TQComboTableItem items have the edit type WhenCurrent (see EditType). The TQComboTableItem's list of items is provided by a TQStringList passed to the constructor. .PP The list of items may be changed using setStringList(). The current item can be set with setCurrentItem() and retrieved with currentItem(). The text of the current item can be obtained with currentText(), and the text of a particular item can be retrieved with text(). .PP -If isEditable() is TRUE the QComboTableItem will permit the user to either choose an existing list item, or create a new list item by entering their own text; otherwise the user may only choose one of the existing list items. +If isEditable() is TRUE the TQComboTableItem will permit the user to either choose an existing list item, or create a new list item by entering their own text; otherwise the user may only choose one of the existing list items. .PP -To populate a table cell with a QComboTableItem use QTable::setItem(). +To populate a table cell with a TQComboTableItem use QTable::setItem(). .PP -QComboTableItems may be deleted with QTable::clearCell(). +TQComboTableItems may be deleted with QTable::clearCell(). .PP -QComboTableItems can be distinguished from QTableItems and QCheckTableItems using their Run Time Type Identification number (see rtti()). +TQComboTableItems can be distinguished from QTableItems and TQCheckTableItems using their Run Time Type Identification number (see rtti()). .PP
          .ce 1 @@ -75,31 +75,31 @@ QComboTableItems can be distinguished from QTableItems and QCheckTableItems usin .PP
          .PP -See also QCheckTableItem, QTableItem, QComboBox, and Advanced Widgets. +See also TQCheckTableItem, QTableItem, TQComboBox, and Advanced Widgets. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QComboTableItem::QComboTableItem ( QTable * table, const TQStringList & list, bool editable = FALSE )" +.SH "TQComboTableItem::TQComboTableItem ( QTable * table, const TQStringList & list, bool editable = FALSE )" Creates a combo table item for the table \fItable\fR. The combobox's list of items is passed in the \fIlist\fR argument. If \fIeditable\fR is TRUE the user may type in new list items; if \fIeditable\fR is FALSE the user may only select from the list of items provided. .PP -By default QComboTableItems cannot be replaced by other table items since isReplaceable() returns FALSE by default. +By default TQComboTableItems cannot be replaced by other table items since isReplaceable() returns FALSE by default. .PP See also QTable::clearCell() and EditType. -.SH "QComboTableItem::~QComboTableItem ()" -QComboTableItem destructor. -.SH "int QComboTableItem::count () const" +.SH "TQComboTableItem::~TQComboTableItem ()" +TQComboTableItem destructor. +.SH "int TQComboTableItem::count () const" Returns the total number of list items in the combo table item. -.SH "int QComboTableItem::currentItem () const" +.SH "int TQComboTableItem::currentItem () const" Returns the index of the combo table item's current list item. .PP See also setCurrentItem(). -.SH "TQString QComboTableItem::currentText () const" +.SH "TQString TQComboTableItem::currentText () const" Returns the text of the combo table item's current list item. .PP See also currentItem() and text(). -.SH "bool QComboTableItem::isEditable () const" +.SH "bool TQComboTableItem::isEditable () const" Returns TRUE if the user can add their own list items to the combobox's list of items; otherwise returns FALSE. .PP See also setEditable(). -.SH "int QComboTableItem::rtti () const\fC [virtual]\fR" +.SH "int TQComboTableItem::rtti () const\fC [virtual]\fR" Returns 1. .PP Make your derived classes return their own values for rtti()to distinguish between different table item subclasses. You should use values greater than 1000, preferably a large random number, to allow for extensions to this class. @@ -107,31 +107,31 @@ Make your derived classes return their own values for rtti()to distinguish betwe See also QTableItem::rtti(). .PP Reimplemented from QTableItem. -.SH "void QComboTableItem::setCurrentItem ( int i )\fC [virtual]\fR" +.SH "void TQComboTableItem::setCurrentItem ( int i )\fC [virtual]\fR" Sets the list item \fIi\fR to be the combo table item's current list item. .PP See also currentItem(). .PP Example: table/small-table-demo/main.cpp. -.SH "void QComboTableItem::setCurrentItem ( const TQString & s )\fC [virtual]\fR" +.SH "void TQComboTableItem::setCurrentItem ( const TQString & s )\fC [virtual]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Sets the list item whose text is \fIs\fR to be the combo table item's current list item. Does nothing if no list item has the text \fIs\fR. .PP See also currentItem(). -.SH "void QComboTableItem::setEditable ( bool b )\fC [virtual]\fR" +.SH "void TQComboTableItem::setEditable ( bool b )\fC [virtual]\fR" If \fIb\fR is TRUE the combo table item can be edited, i.e. the user may enter a new text item themselves. If \fIb\fR is FALSE the user may may only choose one of the existing items. .PP See also isEditable(). -.SH "void QComboTableItem::setStringList ( const TQStringList & l )\fC [virtual]\fR" -Sets the list items of this QComboTableItem to the strings in the string list \fIl\fR. -.SH "TQString QComboTableItem::text ( int i ) const" +.SH "void TQComboTableItem::setStringList ( const TQStringList & l )\fC [virtual]\fR" +Sets the list items of this TQComboTableItem to the strings in the string list \fIl\fR. +.SH "TQString TQComboTableItem::text ( int i ) const" Returns the text of the combo's list item at index \fIi\fR. .PP See also currentText(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/qcombotableitem.html +.BR http://doc.trolltech.com/tqcombotableitem.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqdial.3qt b/doc/man/man3/tqdial.3qt index 52f925216..3400b5df5 100644 --- a/doc/man/man3/tqdial.3qt +++ b/doc/man/man3/tqdial.3qt @@ -1,5 +1,5 @@ '\" t -.TH QDial 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQDial 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,22 +7,22 @@ .ad l .nh .SH NAME -QDial \- Rounded range control (like a speedometer or potentiometer) +TQDial \- Rounded range control (like a speedometer or potentiometer) .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP Inherits TQWidget and QRangeControl. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQDial\fR ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )" +.BI "\fBTQDial\fR ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )" .br .ti -1c -.BI "\fBQDial\fR ( int minValue, int maxValue, int pageStep, int value, TQWidget * parent = 0, const char * name = 0 )" +.BI "\fBTQDial\fR ( int minValue, int maxValue, int pageStep, int value, TQWidget * parent = 0, const char * name = 0 )" .br .ti -1c -.BI "\fB~QDial\fR ()" +.BI "\fB~TQDial\fR ()" .br .ti -1c .BI "bool \fBtracking\fR () const" @@ -158,9 +158,9 @@ Inherits TQWidget and QRangeControl. .br .in -1c .SH DESCRIPTION -The QDial class provides a rounded range control (like a speedometer or potentiometer). +The TQDial class provides a rounded range control (like a speedometer or potentiometer). .PP -QDial is used when the user needs to control a value within a program-definable range, and the range either wraps around (typically, 0..359 degrees) or the dialog layout needs a square widget. +TQDial is used when the user needs to control a value within a program-definable range, and the range either wraps around (typically, 0..359 degrees) or the dialog layout needs a square widget. .PP Both API- and UI-wise, the dial is very similar to a slider. Indeed, when wrapping() is FALSE (the default) there is no real difference between a slider and a dial. They have the same signals, slots and member functions, all of which do the same things. Which one you use depends only on your taste and on the application. .PP @@ -168,7 +168,7 @@ The dial initially emits valueChanged() signals continuously while the slider is .PP The slider also emits dialPressed() and dialReleased() signals when the mouse button is pressed and released. But note that the dial's value can change without these signals being emitted; the keyboard and wheel can be used to change the value. .PP -Unlike the slider, QDial attempts to draw a "nice" number of notches rather than one per lineStep(). If possible, the number of notches drawn is one per lineStep(), but if there aren't enough pixels to draw every one, QDial will draw every second, third etc., notch. notchSize() returns the number of units per notch, hopefully a multiple of lineStep(); setNotchTarget() sets the target distance between neighbouring notches in pixels. The default is 3.75 pixels. +Unlike the slider, TQDial attempts to draw a "nice" number of notches rather than one per lineStep(). If possible, the number of notches drawn is one per lineStep(), but if there aren't enough pixels to draw every one, TQDial will draw every second, third etc., notch. notchSize() returns the number of units per notch, hopefully a multiple of lineStep(); setNotchTarget() sets the target distance between neighbouring notches in pixels. The default is 3.75 pixels. .PP Like the slider, the dial makes the QRangeControl functions setValue(), addLine(), subtractLine(), addPage() and subtractPage() available as slots. .PP @@ -181,85 +181,85 @@ The dial's keyboard interface is fairly simple: The left/up and right/down arrow .ce 1 .B "[Image Omitted]" .PP -See also QScrollBar, QSpinBox, GUI Design Handbook: Slider, and Basic Widgets. +See also TQScrollBar, TQSpinBox, GUI Design Handbook: Slider, and Basic Widgets. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QDial::QDial ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )" +.SH "TQDial::TQDial ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )" Constructs a dial called \fIname\fR with parent \fIparent\fR. \fIf\fR is propagated to the TQWidget constructor. It has the default range of a QRangeControl. -.SH "QDial::QDial ( int minValue, int maxValue, int pageStep, int value, TQWidget * parent = 0, const char * name = 0 )" +.SH "TQDial::TQDial ( int minValue, int maxValue, int pageStep, int value, TQWidget * parent = 0, const char * name = 0 )" Constructs a dial called \fIname\fR with parent \fIparent\fR. The dial's value can never be smaller than \fIminValue\fR or greater than \fImaxValue\fR. Its page step size is \fIpageStep\fR, and its initial value is \fIvalue\fR. .PP \fIvalue\fR is forced to be within the legal range. -.SH "QDial::~QDial ()" +.SH "TQDial::~TQDial ()" Destroys the dial. -.SH "void QDial::addLine ()\fC [slot]\fR" +.SH "void TQDial::addLine ()\fC [slot]\fR" Increments the dial's value() by one lineStep(). -.SH "void QDial::addPage ()\fC [slot]\fR" +.SH "void TQDial::addPage ()\fC [slot]\fR" Increments the dial's value() by one pageStep() of steps. -.SH "void QDial::dialMoved ( int value )\fC [signal]\fR" +.SH "void TQDial::dialMoved ( int value )\fC [signal]\fR" This signal is emitted whenever the dial \fIvalue\fR changes. The frequency of this signal is \fInot\fR influenced by setTracking(). .PP See also valueChanged(). -.SH "void QDial::dialPressed ()\fC [signal]\fR" +.SH "void TQDial::dialPressed ()\fC [signal]\fR" This signal is emitted when the user begins mouse interaction with the dial. .PP See also dialReleased(). -.SH "void QDial::dialReleased ()\fC [signal]\fR" +.SH "void TQDial::dialReleased ()\fC [signal]\fR" This signal is emitted when the user ends mouse interaction with the dial. .PP See also dialPressed(). -.SH "int QDial::lineStep () const" +.SH "int TQDial::lineStep () const" Returns the current line step. See the "lineStep" property for details. -.SH "int QDial::maxValue () const" +.SH "int TQDial::maxValue () const" Returns the current maximum value. See the "maxValue" property for details. -.SH "int QDial::minValue () const" +.SH "int TQDial::minValue () const" Returns the current minimum value. See the "minValue" property for details. -.SH "int QDial::notchSize () const" +.SH "int TQDial::notchSize () const" Returns the current notch size. See the "notchSize" property for details. -.SH "double QDial::notchTarget () const" +.SH "double TQDial::notchTarget () const" Returns the target number of pixels between notches. See the "notchTarget" property for details. -.SH "bool QDial::notchesVisible () const" +.SH "bool TQDial::notchesVisible () const" Returns TRUE if the notches are shown; otherwise returns FALSE. See the "notchesVisible" property for details. -.SH "int QDial::pageStep () const" +.SH "int TQDial::pageStep () const" Returns the current page step. See the "pageStep" property for details. -.SH "void QDial::rangeChange ()\fC [virtual protected]\fR" +.SH "void TQDial::rangeChange ()\fC [virtual protected]\fR" Reimplemented to ensure tick-marks are consistent with the new range. .PP Reimplemented from QRangeControl. -.SH "void QDial::repaintScreen ( const TQRect * cr = 0 )\fC [virtual protected]\fR" +.SH "void TQDial::repaintScreen ( const TQRect * cr = 0 )\fC [virtual protected]\fR" Paints the dial using clip region \fIcr\fR. -.SH "void QDial::setLineStep ( int )" +.SH "void TQDial::setLineStep ( int )" Sets the current line step. See the "lineStep" property for details. -.SH "void QDial::setMaxValue ( int )" +.SH "void TQDial::setMaxValue ( int )" Sets the current maximum value. See the "maxValue" property for details. -.SH "void QDial::setMinValue ( int )" +.SH "void TQDial::setMinValue ( int )" Sets the current minimum value. See the "minValue" property for details. -.SH "void QDial::setNotchTarget ( double )\fC [virtual]\fR" +.SH "void TQDial::setNotchTarget ( double )\fC [virtual]\fR" Sets the target number of pixels between notches. See the "notchTarget" property for details. -.SH "void QDial::setNotchesVisible ( bool b )\fC [virtual slot]\fR" +.SH "void TQDial::setNotchesVisible ( bool b )\fC [virtual slot]\fR" Sets whether the notches are shown to \fIb\fR. See the "notchesVisible" property for details. -.SH "void QDial::setPageStep ( int )" +.SH "void TQDial::setPageStep ( int )" Sets the current page step. See the "pageStep" property for details. -.SH "void QDial::setTracking ( bool enable )\fC [virtual slot]\fR" +.SH "void TQDial::setTracking ( bool enable )\fC [virtual slot]\fR" Sets whether tracking is enabled to \fIenable\fR. See the "tracking" property for details. -.SH "void QDial::setValue ( int )\fC [virtual slot]\fR" +.SH "void TQDial::setValue ( int )\fC [virtual slot]\fR" Sets the current dial value. See the "value" property for details. -.SH "void QDial::setWrapping ( bool on )\fC [virtual slot]\fR" +.SH "void TQDial::setWrapping ( bool on )\fC [virtual slot]\fR" Sets whether wrapping is enabled to \fIon\fR. See the "wrapping" property for details. -.SH "void QDial::subtractLine ()\fC [slot]\fR" +.SH "void TQDial::subtractLine ()\fC [slot]\fR" Decrements the dial's value() by one lineStep(). -.SH "void QDial::subtractPage ()\fC [slot]\fR" +.SH "void TQDial::subtractPage ()\fC [slot]\fR" Decrements the dial's value() by one pageStep() of steps. -.SH "bool QDial::tracking () const" +.SH "bool TQDial::tracking () const" Returns TRUE if tracking is enabled; otherwise returns FALSE. See the "tracking" property for details. -.SH "int QDial::value () const" +.SH "int TQDial::value () const" Returns the current dial value. See the "value" property for details. -.SH "void QDial::valueChange ()\fC [virtual protected]\fR" +.SH "void TQDial::valueChange ()\fC [virtual protected]\fR" Reimplemented to ensure the display is correct and to emit the valueChanged(int) signal when appropriate. .PP Reimplemented from QRangeControl. -.SH "void QDial::valueChanged ( int value )\fC [signal]\fR" +.SH "void TQDial::valueChanged ( int value )\fC [signal]\fR" This signal is emitted whenever the dial's \fIvalue\fR changes. The frequency of this signal is influenced by setTracking(). -.SH "bool QDial::wrapping () const" +.SH "bool TQDial::wrapping () const" Returns TRUE if wrapping is enabled; otherwise returns FALSE. See the "wrapping" property for details. .SS "Property Documentation" .SH "int lineStep" @@ -273,7 +273,7 @@ Set this property's value with setLineStep() and get this property's value with .SH "int maxValue" This property holds the current maximum value. .PP -When setting this property, the QDial::minValue is adjusted if necessary to ensure that the range remains valid. +When setting this property, the TQDial::minValue is adjusted if necessary to ensure that the range remains valid. .PP See also setRange(). .PP @@ -281,7 +281,7 @@ Set this property's value with setMaxValue() and get this property's value with .SH "int minValue" This property holds the current minimum value. .PP -When setting this property, the QDial::maxValue is adjusted if necessary to ensure that the range remains valid. +When setting this property, the TQDial::maxValue is adjusted if necessary to ensure that the range remains valid. .PP See also setRange(). .PP @@ -297,7 +297,7 @@ Get this property's value with notchSize(). .SH "double notchTarget" This property holds the target number of pixels between notches. .PP -The notch target is the number of pixels QDial attempts to put between each notch. +The notch target is the number of pixels TQDial attempts to put between each notch. .PP The actual size may differ from the target size. .PP @@ -325,7 +325,7 @@ Set this property's value with setTracking() and get this property's value with .SH "int value" This property holds the current dial value. .PP -This is guaranteed to be within the range QDial::minValue..QDial::maxValue. +This is guaranteed to be within the range TQDial::minValue..TQDial::maxValue. .PP See also minValue and maxValue. .PP @@ -340,7 +340,7 @@ This property's default is FALSE. Set this property's value with setWrapping() and get this property's value with wrapping(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqdial.html +.BR http://doc.trolltech.com/tqdial.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqdialog.3qt b/doc/man/man3/tqdialog.3qt index fcef22e76..311cfbb59 100644 --- a/doc/man/man3/tqdialog.3qt +++ b/doc/man/man3/tqdialog.3qt @@ -1,5 +1,5 @@ '\" t -.TH QDialog 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQDialog 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,9 +7,9 @@ .ad l .nh .SH NAME -QDialog \- The base class of dialog windows +TQDialog \- The base class of dialog windows .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP Inherits TQWidget. .PP @@ -18,10 +18,10 @@ Inherited by TQColorDialog, QErrorMessage, TQFileDialog, TQFontDialog, QInputDia .SS "Public Members" .in +1c .ti -1c -.BI "explicit \fBQDialog\fR ( TQWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )" +.BI "explicit \fBTQDialog\fR ( TQWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )" .br .ti -1c -.BI "\fB~QDialog\fR ()" +.BI "\fB~TQDialog\fR ()" .br .ti -1c .BI "enum \fBDialogCode\fR { Rejected, Accepted }" @@ -94,11 +94,11 @@ Inherited by TQColorDialog, QErrorMessage, TQFileDialog, TQFontDialog, QInputDia .br .in -1c .SH DESCRIPTION -The QDialog class is the base class of dialog windows. +The TQDialog class is the base class of dialog windows. .PP -A dialog window is a top-level window mostly used for short-term tasks and brief communications with the user. QDialogs may be modal or modeless. QDialogs support extensibility and can provide a return value. They can have default buttons. QDialogs can also have a TQSizeGrip in their lower-right corner, using setSizeGripEnabled(). +A dialog window is a top-level window mostly used for short-term tasks and brief communications with the user. TQDialogs may be modal or modeless. TQDialogs support extensibility and can provide a return value. They can have default buttons. TQDialogs can also have a TQSizeGrip in their lower-right corner, using setSizeGripEnabled(). .PP -Note that QDialog uses the parent widget slightly differently from other classes in Qt. A dialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent's top-level widget (if it is not top-level itself). It will also share the parent's taskbar entry. +Note that TQDialog uses the parent widget slightly differently from other classes in Qt. A dialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent's top-level widget (if it is not top-level itself). It will also share the parent's taskbar entry. .SH "Modal Dialogs" A \fBmodal\fR dialog is a dialog that blocks input to other visible windows in the same application. Users must finish interacting with the dialog and close it before they can access any other window in the application. Dialogs that are used to request a file name from the user or that are used to set application preferences are usually modal. .PP @@ -110,9 +110,9 @@ A \fBmodeless\fR dialog is a dialog that operates independently of other windows .PP Modeless dialogs are displayed using show(), which returns control to the caller immediately. .SH "Default button" -A dialog's \fIdefault\fR button is the button that's pressed when the user presses Enter (Return). This button is used to signify that the user accepts the dialog's settings and wants to close the dialog. Use QPushButton::setDefault(), QPushButton::isDefault() and QPushButton::autoDefault() to set and control the dialog's default button. +A dialog's \fIdefault\fR button is the button that's pressed when the user presses Enter (Return). This button is used to signify that the user accepts the dialog's settings and wants to close the dialog. Use TQPushButton::setDefault(), TQPushButton::isDefault() and TQPushButton::autoDefault() to set and control the dialog's default button. .SH "Escape Key" -If the user presses the Esc key in a dialog, QDialog::reject() will be called. This will cause the window to close: the closeEvent cannot be ignored. +If the user presses the Esc key in a dialog, TQDialog::reject() will be called. This will cause the window to close: the closeEvent cannot be ignored. .SH "Extensibility" Extensibility is the ability to show the dialog in two ways: a partial dialog that shows the most commonly used options, and a full dialog that shows all the options. Typically an extensible dialog will initially appear as a partial dialog, but with a" More" toggle button. If the user presses the "More" button down, the full dialog will appear. The extension widget will be resized to its sizeHint(). If orientation is Horizontal the extension widget's height() will be expanded to the height() of the dialog. If the orientation is Vertical the extension widget's width() will be expanded to the width() of the dialog. Extensibility is controlled with setExtension(), setOrientation() and showExtension(). .SH "Return value (modal dialogs)" @@ -132,7 +132,7 @@ A modal dialog. .br TQString result; .br - if ( dlg->exec() == QDialog::Accepted ) { + if ( dlg->exec() == TQDialog::Accepted ) { .br result = dlg->selectedFile(); .br @@ -181,15 +181,15 @@ A modeless dialog. After the show() call, control returns to the main event loop .PP See also QTabDialog, TQWidget, QProgressDialog, GUI Design Handbook: Dialogs, Standard, Abstract Widget Classes, and Dialog Classes. .SS "Member Type Documentation" -.SH "QDialog::DialogCode" +.SH "TQDialog::DialogCode" The value returned by a modal dialog. .TP -\fCQDialog::Accepted\fR +\fCTQDialog::Accepted\fR .TP -\fCQDialog::Rejected\fR +\fCTQDialog::Rejected\fR .PP .SH MEMBER FUNCTION DOCUMENTATION -.SH "explicit QDialog::QDialog ( TQWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )" +.SH "explicit TQDialog::TQDialog ( TQWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )" Constructs a dialog called \fIname\fR, with parent \fIparent\fR. .PP A dialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent. It will also share the parent's taskbar entry. @@ -199,22 +199,22 @@ The widget flags \fIf\fR are passed on to the TQWidget constructor. If, for exam \fBWarning:\fR In TQt 3.2, the \fImodal\fR flag is obsolete. There is now a setModal() function that can be used for obtaining a modal behavior when calling show(). This is rarely needed, because modal dialogs are usually invoked using exec(), which ignores the \fImodal\fR flag. .PP See also TQWidget::setWFlags() and TQt::WidgetFlags. -.SH "QDialog::~QDialog ()" -Destroys the QDialog, deleting all its children. -.SH "void QDialog::accept ()\fC [virtual protected slot]\fR" +.SH "TQDialog::~TQDialog ()" +Destroys the TQDialog, deleting all its children. +.SH "void TQDialog::accept ()\fC [virtual protected slot]\fR" Hides the modal dialog and sets the result code to Accepted. .PP See also reject() and done(). .PP Examples: .)l chart/setdataform.cpp and distributor/distributor.ui.h. -.SH "void QDialog::done ( int r )\fC [virtual protected slot]\fR" +.SH "void TQDialog::done ( int r )\fC [virtual protected slot]\fR" Closes the dialog and sets its result code to \fIr\fR. If this dialog is shown with exec(), done() causes the local event loop to finish, and exec() to return \fIr\fR. .PP As with TQWidget::close(), done() deletes the dialog if the WDestructiveClose flag is set. If the dialog is the application's main widget, the application terminates. If the dialog is the last window closed, the QApplication::lastWindowClosed() signal is emitted. .PP See also accept(), reject(), QApplication::mainWidget(), and QApplication::quit(). -.SH "int QDialog::exec ()\fC [slot]\fR" +.SH "int TQDialog::exec ()\fC [slot]\fR" Shows the dialog as a modal dialog, blocking until the user closes it. The function returns a DialogCode result. .PP Users cannot interact with any other window in the same application until they close the dialog. @@ -223,43 +223,43 @@ See also show() and result(). .PP Examples: .)l chart/chartform.cpp, dialog/mainwindow.cpp, i18n/main.cpp, network/ftpclient/ftpmainwindow.ui.h, network/networkprotocol/view.cpp, tqdir/tqdir.cpp, and wizard/main.cpp. -.SH "TQWidget * QDialog::extension () const" +.SH "TQWidget * TQDialog::extension () const" Returns the dialog's extension or 0 if no extension has been defined. .PP See also setExtension(). -.SH "bool QDialog::isModal () const" +.SH "bool TQDialog::isModal () const" Returns TRUE if show() should pop up the dialog as modal or modeless; otherwise returns FALSE. See the "modal" property for details. -.SH "bool QDialog::isSizeGripEnabled () const" +.SH "bool TQDialog::isSizeGripEnabled () const" Returns TRUE if the size grip is enabled; otherwise returns FALSE. See the "sizeGripEnabled" property for details. -.SH "Orientation QDialog::orientation () const" +.SH "Orientation TQDialog::orientation () const" Returns the dialog's extension orientation. .PP See also setOrientation(). -.SH "void QDialog::reject ()\fC [virtual protected slot]\fR" +.SH "void TQDialog::reject ()\fC [virtual protected slot]\fR" Hides the modal dialog and sets the result code to Rejected. .PP See also accept() and done(). -.SH "int QDialog::result () const" +.SH "int TQDialog::result () const" Returns the modal dialog's result code, Accepted or Rejected. .PP Do not call this function if the dialog was constructed with the WDestructiveClose flag. -.SH "void QDialog::setExtension ( TQWidget * extension )" +.SH "void TQDialog::setExtension ( TQWidget * extension )" Sets the widget, \fIextension\fR, to be the dialog's extension, deleting any previous extension. The dialog takes ownership of the extension. Note that if 0 is passed any existing extension will be deleted. .PP This function must only be called while the dialog is hidden. .PP See also showExtension(), setOrientation(), and extension(). -.SH "void QDialog::setModal ( bool modal )" +.SH "void TQDialog::setModal ( bool modal )" Sets whether show() should pop up the dialog as modal or modeless to \fImodal\fR. See the "modal" property for details. -.SH "void QDialog::setOrientation ( Orientation orientation )" +.SH "void TQDialog::setOrientation ( Orientation orientation )" If \fIorientation\fR is Horizontal, the extension will be displayed to the right of the dialog's main area. If \fIorientation\fR is Vertical, the extension will be displayed below the dialog's main area. .PP See also orientation() and setExtension(). -.SH "void QDialog::setResult ( int i )\fC [protected]\fR" +.SH "void TQDialog::setResult ( int i )\fC [protected]\fR" Sets the modal dialog's result code to \fIi\fR. -.SH "void QDialog::setSizeGripEnabled ( bool )" +.SH "void TQDialog::setSizeGripEnabled ( bool )" Sets whether the size grip is enabled. See the "sizeGripEnabled" property for details. -.SH "void QDialog::show ()\fC [virtual]\fR" +.SH "void TQDialog::show ()\fC [virtual]\fR" Shows the dialog as a modeless dialog. Control returns immediately to the calling code. .PP The dialog will be modal or modeless according to the value of the modal property. @@ -270,10 +270,10 @@ Examples: .)l movies/main.cpp, regexptester/main.cpp, showimg/showimg.cpp, and sql/overview/form1/main.cpp. .PP Reimplemented from TQWidget. -.SH "void QDialog::showExtension ( bool showIt )\fC [protected slot]\fR" +.SH "void TQDialog::showExtension ( bool showIt )\fC [protected slot]\fR" If \fIshowIt\fR is TRUE, the dialog's extension is shown; otherwise the extension is hidden. .PP -This slot is usually connected to the QButton::toggled() signal of a QPushButton. +This slot is usually connected to the QButton::toggled() signal of a TQPushButton. .PP A dialog with a visible extension is not resizeable. .PP @@ -297,7 +297,7 @@ A TQSizeGrip is placed in the bottom right corner of the dialog when this proper Set this property's value with setSizeGripEnabled() and get this property's value with isSizeGripEnabled(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqdialog.html +.BR http://doc.trolltech.com/tqdialog.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqdict.3qt b/doc/man/man3/tqdict.3qt index c34011b1e..a91eb4076 100644 --- a/doc/man/man3/tqdict.3qt +++ b/doc/man/man3/tqdict.3qt @@ -113,11 +113,11 @@ Example #1: .PP .nf .br - TQDict fields; // TQString keys, QLineEdit* values + TQDict fields; // TQString keys, TQLineEdit* values .br - fields.insert( "forename", new QLineEdit( this ) ); + fields.insert( "forename", new TQLineEdit( this ) ); .br - fields.insert( "surname", new QLineEdit( this ) ); + fields.insert( "surname", new TQLineEdit( this ) ); .br .br fields["forename"]->setText( "Homer" ); @@ -125,7 +125,7 @@ Example #1: fields["surname"]->setText( "Simpson" ); .br .br - TQDictIterator it( fields ); // See TQDictIterator + TQDictIterator it( fields ); // See TQDictIterator .br for( ; it.current(); ++it ) .br diff --git a/doc/man/man3/tqdictiterator.3qt b/doc/man/man3/tqdictiterator.3qt index e222a3a9d..495e01e41 100644 --- a/doc/man/man3/tqdictiterator.3qt +++ b/doc/man/man3/tqdictiterator.3qt @@ -57,13 +57,13 @@ Example: .PP .nf .br - TQDict fields; + TQDict fields; .br - fields.insert( "forename", new QLineEdit( this ) ); + fields.insert( "forename", new TQLineEdit( this ) ); .br - fields.insert( "surname", new QLineEdit( this ) ); + fields.insert( "surname", new TQLineEdit( this ) ); .br - fields.insert( "age", new QLineEdit( this ) ); + fields.insert( "age", new TQLineEdit( this ) ); .br .br fields["forename"]->setText( "Homer" ); @@ -73,7 +73,7 @@ Example: fields["age"]->setText( "45" ); .br .br - TQDictIterator it( fields ); + TQDictIterator it( fields ); .br for( ; it.current(); ++it ) .br diff --git a/doc/man/man3/tqeditorfactory.3qt b/doc/man/man3/tqeditorfactory.3qt index 11d799df7..d12ea7334 100644 --- a/doc/man/man3/tqeditorfactory.3qt +++ b/doc/man/man3/tqeditorfactory.3qt @@ -39,7 +39,7 @@ Inherited by TQSqlEditorFactory. .SH DESCRIPTION The TQEditorFactory class is used to create editor widgets for QVariant data types. .PP -Each editor factory provides the createEditor() function which given a QVariant will create and return a TQWidget that can edit that QVariant. For example if you have a QVariant::String type, a QLineEdit would be the default editor returned, whereas a QVariant::Int's default editor would be a QSpinBox. +Each editor factory provides the createEditor() function which given a QVariant will create and return a TQWidget that can edit that QVariant. For example if you have a QVariant::String type, a TQLineEdit would be the default editor returned, whereas a QVariant::Int's default editor would be a TQSpinBox. .PP If you want to create different editors for fields with the same data type, subclass TQEditorFactory and reimplement the createEditor() function. .PP diff --git a/doc/man/man3/tqerrormessage.3qt b/doc/man/man3/tqerrormessage.3qt index 8effc51ff..87115f63e 100644 --- a/doc/man/man3/tqerrormessage.3qt +++ b/doc/man/man3/tqerrormessage.3qt @@ -11,7 +11,7 @@ QErrorMessage \- Error message display dialog .SH SYNOPSIS \fC#include \fR .PP -Inherits QDialog. +Inherits TQDialog. .PP .SS "Public Members" .in +1c @@ -56,7 +56,7 @@ In both cases QErrorMessage will queue pending messages, and display them (or no See also QMessageBox, TQStatusBar::message(), Dialog Classes, and Miscellaneous Classes. .SH MEMBER FUNCTION DOCUMENTATION .SH "QErrorMessage::QErrorMessage ( TQWidget * parent, const char * name = 0 )" -Constructs and installs an error handler window. The parent \fIparent\fR and name \fIname\fR are passed on to the QDialog constructor. +Constructs and installs an error handler window. The parent \fIparent\fR and name \fIname\fR are passed on to the TQDialog constructor. .SH "QErrorMessage::~QErrorMessage ()" Destroys the object and frees any allocated resources. Notably, the list of "do not show again" messages is deleted. .SH "void QErrorMessage::message ( const TQString & m )\fC [slot]\fR" diff --git a/doc/man/man3/tqfiledialog.3qt b/doc/man/man3/tqfiledialog.3qt index 4bdadcc70..0232858ab 100644 --- a/doc/man/man3/tqfiledialog.3qt +++ b/doc/man/man3/tqfiledialog.3qt @@ -11,7 +11,7 @@ TQFileDialog \- Dialogs that allow users to select files or directories .SH SYNOPSIS \fC#include \fR .PP -Inherits QDialog. +Inherits TQDialog. .PP .SS "Public Members" .in +1c @@ -214,7 +214,7 @@ Inherits QDialog. .SS "Protected Members" .in +1c .ti -1c -.BI "void \fBaddWidgets\fR ( TQLabel * l, TQWidget * w, QPushButton * b )" +.BI "void \fBaddWidgets\fR ( TQLabel * l, TQWidget * w, TQPushButton * b )" .br .ti -1c .BI "void \fBaddToolButton\fR ( QButton * b, bool separator = FALSE )" @@ -293,7 +293,7 @@ The last important function you will need to use when creating your own file dia .br TQString fileName; .br - if ( fd->exec() == QDialog::Accepted ) + if ( fd->exec() == TQDialog::Accepted ) .br fileName = fd->selectedFile(); .br @@ -447,7 +447,7 @@ See also addLeftWidget(), addWidgets(), and addToolButton(). Adds the tool button \fIb\fR to the row of tool buttons at the top of the file dialog. The button is appended to the right of this row. If \fIseparator\fR is TRUE, a small space is inserted between the last button of the row and the new button \fIb\fR. .PP See also addWidgets(), addLeftWidget(), and addRightWidget(). -.SH "void TQFileDialog::addWidgets ( TQLabel * l, TQWidget * w, QPushButton * b )\fC [protected]\fR" +.SH "void TQFileDialog::addWidgets ( TQLabel * l, TQWidget * w, TQPushButton * b )\fC [protected]\fR" Adds the specified widgets to the bottom of the file dialog. The label \fIl\fR is placed underneath the "file name" and the "file types" labels. The widget \fIw\fR is placed underneath the file types combobox. The button \fIb\fR is placed underneath the Cancel pushbutton. .PP .nf @@ -460,9 +460,9 @@ Adds the specified widgets to the bottom of the file dialog. The label \fIl\fR i .br TQLabel* label = new TQLabel( "Added widgets", this ); .br - QLineEdit* lineedit = new QLineEdit( this ); + TQLineEdit* lineedit = new TQLineEdit( this ); .br - QPushButton* pushbutton = new QPushButton( this ); + TQPushButton* pushbutton = new TQPushButton( this ); .br .br addWidgets( label, lineedit, pushbutton ); diff --git a/doc/man/man3/tqfontdialog.3qt b/doc/man/man3/tqfontdialog.3qt index 6f3fe18bf..546e9c340 100644 --- a/doc/man/man3/tqfontdialog.3qt +++ b/doc/man/man3/tqfontdialog.3qt @@ -11,7 +11,7 @@ TQFontDialog \- Dialog widget for selecting a font .SH SYNOPSIS \fC#include \fR .PP -Inherits QDialog. +Inherits TQDialog. .PP .SS "Static Public Members"
        7. TQFont \fBgetFont\fR ( bool * ok, const TQFont & initial, TQWidget * parent = 0, const char * name = 0 )
        8. TQFont \fBgetFont\fR ( bool * ok, TQWidget * parent = 0, const char * name = 0 ) diff --git a/doc/man/man3/tqframe.3qt b/doc/man/man3/tqframe.3qt index 0d9fcaff7..f491c8be5 100644 --- a/doc/man/man3/tqframe.3qt +++ b/doc/man/man3/tqframe.3qt @@ -13,7 +13,7 @@ QFrame \- The base class of widgets that can have a frame .PP Inherits TQWidget. .PP -Inherited by QGroupBox, QScrollView, QDockWindow, QGrid, QHBox, TQLabel, QLCDNumber, QLineEdit, TQMenuBar, TQPopupMenu, QProgressBar, QSplitter, TQToolBox, and TQWidgetStack. +Inherited by QGroupBox, TQScrollView, QDockWindow, QGrid, QHBox, TQLabel, TQLCDNumber, TQLineEdit, TQMenuBar, TQPopupMenu, QProgressBar, QSplitter, TQToolBox, and TQWidgetStack. .PP .SS "Public Members" .in +1c @@ -228,7 +228,7 @@ This function is reimplemented by subclasses that draw something inside the fram .PP See also contentsRect and TQPainter::setClipRect(). .PP -Reimplemented in TQLabel, QLCDNumber, TQMenuBar, and TQPopupMenu. +Reimplemented in TQLabel, TQLCDNumber, TQMenuBar, and TQPopupMenu. .SH "void QFrame::drawFrame ( TQPainter * p )\fC [virtual protected]\fR" Draws the frame using the painter \fIp\fR and the current frame attributes and color group. The rectangle inside the frame is not affected. .PP diff --git a/doc/man/man3/tqgridlayout.3qt b/doc/man/man3/tqgridlayout.3qt index 2a2f1a250..21b99cf11 100644 --- a/doc/man/man3/tqgridlayout.3qt +++ b/doc/man/man3/tqgridlayout.3qt @@ -154,7 +154,7 @@ This illustration shows a fragment of a dialog with a five-column, three-row gri .PP .PP -Columns 0, 2 and 4 in this dialog fragment are made up of a TQLabel, a QLineEdit, and a QListBox. Columns 1 and 3 are placeholders made with addColSpacing(). Row 0 consists of three TQLabel objects, row 1 of three QLineEdit objects and row 2 of three QListBox objects. We used placeholder columns (1 and 3) to get the right amount of space between the columns. +Columns 0, 2 and 4 in this dialog fragment are made up of a TQLabel, a TQLineEdit, and a QListBox. Columns 1 and 3 are placeholders made with addColSpacing(). Row 0 consists of three TQLabel objects, row 1 of three TQLineEdit objects and row 2 of three QListBox objects. We used placeholder columns (1 and 3) to get the right amount of space between the columns. .PP Note that the columns and rows are not equally wide or tall. If you want two columns to have the same width, you must set their minimum widths and stretch factors to be the same yourself. You do this using addColSpacing() and setColStretch(). .PP diff --git a/doc/man/man3/tqgridview.3qt b/doc/man/man3/tqgridview.3qt index 3cf6c8a63..39ec36985 100644 --- a/doc/man/man3/tqgridview.3qt +++ b/doc/man/man3/tqgridview.3qt @@ -11,7 +11,7 @@ QGridView \- Abstract base for fixed-size grids .SH SYNOPSIS \fC#include \fR .PP -Inherits QScrollView. +Inherits TQScrollView. .PP .SS "Public Members" .in +1c @@ -110,14 +110,14 @@ If you need to monitor changes to the grid's dimensions (i.e. when numRows or nu .PP Note: the row and column indices are always given in the order, row (vertical offset) then column (horizontal offset). This order is the opposite of all pixel operations, which are given in the order x (horizontal offset), y (vertical offset). .PP -QGridView is a very simple abstract class based on QScrollView. It is designed to simplify the task of drawing many cells of the same size in a potentially scrollable canvas. If you need rows and columns with different sizes, use a QTable instead. If you need a simple list of items, use a QListBox. If you need to present hierachical data use a QListView, and if you need random objects at random positions, consider using either a TQIconView or a TQCanvas. +QGridView is a very simple abstract class based on TQScrollView. It is designed to simplify the task of drawing many cells of the same size in a potentially scrollable canvas. If you need rows and columns with different sizes, use a QTable instead. If you need a simple list of items, use a QListBox. If you need to present hierachical data use a QListView, and if you need random objects at random positions, consider using either a TQIconView or a TQCanvas. .PP See also Abstract Widget Classes. .SH MEMBER FUNCTION DOCUMENTATION .SH "QGridView::QGridView ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )" Constructs a grid view. .PP -The \fIparent\fR, \fIname\fR and widget flag, \fIf\fR, arguments are passed to the QScrollView constructor. +The \fIparent\fR, \fIname\fR and widget flag, \fIf\fR, arguments are passed to the TQScrollView constructor. .SH "QGridView::~QGridView ()" Destroys the grid view. .SH "TQRect QGridView::cellGeometry ( int row, int column )" diff --git a/doc/man/man3/tqiconview.3qt b/doc/man/man3/tqiconview.3qt index 0bad304d0..c084e5c13 100644 --- a/doc/man/man3/tqiconview.3qt +++ b/doc/man/man3/tqiconview.3qt @@ -11,7 +11,7 @@ TQIconView \- Area with movable labelled icons .SH SYNOPSIS \fC#include \fR .PP -Inherits QScrollView. +Inherits TQScrollView. .PP .SS "Public Members" .in +1c diff --git a/doc/man/man3/tqinputdialog.3qt b/doc/man/man3/tqinputdialog.3qt index 4ea3e4315..03b6e4f7f 100644 --- a/doc/man/man3/tqinputdialog.3qt +++ b/doc/man/man3/tqinputdialog.3qt @@ -11,10 +11,10 @@ QInputDialog \- Simple convenience dialog to get a single value from the user .SH SYNOPSIS \fC#include \fR .PP -Inherits QDialog. +Inherits TQDialog. .PP .SS "Static Public Members" -
        9. TQString \fBgetText\fR ( const TQString & caption, const TQString & label, QLineEdit::EchoMode mode = QLineEdit::Normal, const TQString & text = TQString::null, bool * ok = 0, TQWidget * parent = 0, const char * name = 0 )
        10. int \fBgetInteger\fR ( const TQString & caption, const TQString & label, int value = 0, int minValue = -2147483647, int maxValue = 2147483647, int step = 1, bool * ok = 0, TQWidget * parent = 0, const char * name = 0 )
        11. double \fBgetDouble\fR ( const TQString & caption, const TQString & label, double value = 0, double minValue = -2147483647, double maxValue = 2147483647, int decimals = 1, bool * ok = 0, TQWidget * parent = 0, const char * name = 0 )
        12. TQString \fBgetItem\fR ( const TQString & caption, const TQString & label, const TQStringList & list, int current = 0, bool editable = TRUE, bool * ok = 0, TQWidget * parent = 0, const char * name = 0 ) +
        13. TQString \fBgetText\fR ( const TQString & caption, const TQString & label, TQLineEdit::EchoMode mode = TQLineEdit::Normal, const TQString & text = TQString::null, bool * ok = 0, TQWidget * parent = 0, const char * name = 0 )
        14. int \fBgetInteger\fR ( const TQString & caption, const TQString & label, int value = 0, int minValue = -2147483647, int maxValue = 2147483647, int step = 1, bool * ok = 0, TQWidget * parent = 0, const char * name = 0 )
        15. double \fBgetDouble\fR ( const TQString & caption, const TQString & label, double value = 0, double minValue = -2147483647, double maxValue = 2147483647, int decimals = 1, bool * ok = 0, TQWidget * parent = 0, const char * name = 0 )
        16. TQString \fBgetItem\fR ( const TQString & caption, const TQString & label, const TQStringList & list, int current = 0, bool editable = TRUE, bool * ok = 0, TQWidget * parent = 0, const char * name = 0 ) .SH DESCRIPTION The QInputDialog class provides a simple convenience dialog to get a single value from the user. .PP @@ -28,7 +28,7 @@ Four static convenience functions are provided: getText(), getInteger(), getDoub .br TQString text = QInputDialog::getText( .br - "MyApp 3000", "Enter your name:", QLineEdit::Normal, + "MyApp 3000", "Enter your name:", TQLineEdit::Normal, .br TQString::null, &ok, this ); .br @@ -146,7 +146,7 @@ Use this static function like this: } .br .fi -.SH "TQString QInputDialog::getText ( const TQString & caption, const TQString & label, QLineEdit::EchoMode mode = QLineEdit::Normal, const TQString & text = TQString::null, bool * ok = 0, TQWidget * parent = 0, const char * name = 0 )\fC [static]\fR" +.SH "TQString QInputDialog::getText ( const TQString & caption, const TQString & label, TQLineEdit::EchoMode mode = TQLineEdit::Normal, const TQString & text = TQString::null, bool * ok = 0, TQWidget * parent = 0, const char * name = 0 )\fC [static]\fR" Static convenience function to get a string from the user. \fIcaption\fR is the text which is displayed in the title bar of the dialog. \fIlabel\fR is the text which is shown to the user (it should say what should be entered). \fItext\fR is the default text which is placed in the line edit. The \fImode\fR is the echo mode the line edit will use. If \fIok\fR is not-null \fI*\fR\fIok\fR will be set to TRUE if the user pressed OK and to FALSE if the user pressed Cancel. The dialog's parent is \fIparent\fR; the dialog is called \fIname\fR. The dialog will be modal. .PP This function returns the text which has been entered in the line edit. It will not return an empty string. @@ -159,7 +159,7 @@ Use this static function like this: .br TQString text = QInputDialog::getText( .br - "MyApp 3000", "Enter your name:", QLineEdit::Normal, + "MyApp 3000", "Enter your name:", TQLineEdit::Normal, .br TQString::null, &ok, this ); .br diff --git a/doc/man/man3/tqintdict.3qt b/doc/man/man3/tqintdict.3qt index 7e97f6d69..d38f85605 100644 --- a/doc/man/man3/tqintdict.3qt +++ b/doc/man/man3/tqintdict.3qt @@ -95,11 +95,11 @@ Example: .PP .nf .br - TQIntDict fields; // long int keys, QLineEdit* values + TQIntDict fields; // long int keys, TQLineEdit* values .br for ( int i = 0; i < 3; i++ ) .br - fields.insert( i, new QLineEdit( this ) ); + fields.insert( i, new TQLineEdit( this ) ); .br .br fields[0]->setText( "Homer" ); @@ -109,7 +109,7 @@ Example: fields[2]->setText( "45" ); .br .br - TQIntDictIterator it( fields ); + TQIntDictIterator it( fields ); .br for ( ; it.current(); ++it ) .br diff --git a/doc/man/man3/tqintdictiterator.3qt b/doc/man/man3/tqintdictiterator.3qt index 71211a65c..89720ceb7 100644 --- a/doc/man/man3/tqintdictiterator.3qt +++ b/doc/man/man3/tqintdictiterator.3qt @@ -56,11 +56,11 @@ Example: .PP .nf .br - TQIntDict fields; + TQIntDict fields; .br for ( int i = 0; i < 3; i++ ) .br - fields.insert( i, new QLineEdit( this ) ); + fields.insert( i, new TQLineEdit( this ) ); .br .br fields[0]->setText( "Homer" ); @@ -70,7 +70,7 @@ Example: fields[2]->setText( "45" ); .br .br - TQIntDictIterator it( fields ); + TQIntDictIterator it( fields ); .br .br for ( ; it.current(); ++it ) diff --git a/doc/man/man3/tqintvalidator.3qt b/doc/man/man3/tqintvalidator.3qt index 7d1f527a4..31c868d97 100644 --- a/doc/man/man3/tqintvalidator.3qt +++ b/doc/man/man3/tqintvalidator.3qt @@ -61,7 +61,7 @@ Example of use: .br QValidator* validator = new QIntValidator( 100, 999, this ); .br - QLineEdit* edit = new QLineEdit( this ); + TQLineEdit* edit = new TQLineEdit( this ); .br .br // the edit lineedit will only accept integers between 100 and 999 diff --git a/doc/man/man3/tqlabel.3qt b/doc/man/man3/tqlabel.3qt index c3e5cc25c..f0a10914a 100644 --- a/doc/man/man3/tqlabel.3qt +++ b/doc/man/man3/tqlabel.3qt @@ -165,13 +165,13 @@ A TQLabel is often used as a label for an interactive widget. For this use TQLab .PP .nf .br - QLineEdit* phoneEdit = new QLineEdit( this, "phoneEdit" ); + TQLineEdit* phoneEdit = new TQLineEdit( this, "phoneEdit" ); .br TQLabel* phoneLabel = new TQLabel( phoneEdit, "&Phone:", this, "phoneLabel" ); .br .fi .PP -In this example, keyboard focus is transferred to the label's buddy (the QLineEdit) when the user presses Alt+P. You can also use the setBuddy() function to accomplish the same thing. +In this example, keyboard focus is transferred to the label's buddy (the TQLineEdit) when the user presses Alt+P. You can also use the setBuddy() function to accomplish the same thing. .PP .ce 1 .B "[Image Omitted]" @@ -180,7 +180,7 @@ In this example, keyboard focus is transferred to the label's buddy (the QLineEd .ce 1 .B "[Image Omitted]" .PP -See also QLineEdit, TQTextEdit, TQPixmap, TQMovie, GUI Design Handbook: Label, Basic Widgets, and Text Related Classes. +See also TQLineEdit, TQTextEdit, TQPixmap, TQMovie, GUI Design Handbook: Label, Basic Widgets, and Text Related Classes. .SH MEMBER FUNCTION DOCUMENTATION .SH "TQLabel::TQLabel ( TQWidget * parent, const char * name = 0, WFlags f = 0 )" Constructs an empty label. @@ -259,13 +259,13 @@ In a dialog, you might create two data entry widgets and a label for each, and s .PP .nf .br - QLineEdit *nameEd = new QLineEdit( this ); + TQLineEdit *nameEd = new TQLineEdit( this ); .br TQLabel *nameLb = new TQLabel( "&Name:", this ); .br nameLb->setBuddy( nameEd ); .br - QLineEdit *phoneEd = new QLineEdit( this ); + TQLineEdit *phoneEd = new TQLineEdit( this ); .br TQLabel *phoneLb = new TQLabel( "&Phone:", this ); .br diff --git a/doc/man/man3/tqlcdnumber.3qt b/doc/man/man3/tqlcdnumber.3qt index e9b215ec1..4804a8dc1 100644 --- a/doc/man/man3/tqlcdnumber.3qt +++ b/doc/man/man3/tqlcdnumber.3qt @@ -1,5 +1,5 @@ '\" t -.TH QLCDNumber 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQLCDNumber 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,22 +7,22 @@ .ad l .nh .SH NAME -QLCDNumber \- Displays a number with LCD-like digits +TQLCDNumber \- Displays a number with LCD-like digits .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP Inherits QFrame. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQLCDNumber\fR ( TQWidget * parent = 0, const char * name = 0 )" +.BI "\fBTQLCDNumber\fR ( TQWidget * parent = 0, const char * name = 0 )" .br .ti -1c -.BI "\fBQLCDNumber\fR ( uint numDigits, TQWidget * parent = 0, const char * name = 0 )" +.BI "\fBTQLCDNumber\fR ( uint numDigits, TQWidget * parent = 0, const char * name = 0 )" .br .ti -1c -.BI "\fB~QLCDNumber\fR ()" +.BI "\fB~TQLCDNumber\fR ()" .br .ti -1c .BI "enum \fBMode\fR { Hex, Dec, Oct, Bin, HEX = Hex, DEC = Dec, OCT = Oct, BIN = Bin }" @@ -125,19 +125,19 @@ Inherits QFrame. .br .in -1c .SH DESCRIPTION -The QLCDNumber widget displays a number with LCD-like digits. +The TQLCDNumber widget displays a number with LCD-like digits. .PP It can display a number in just about any size. It can display decimal, hexadecimal, octal or binary numbers. It is easy to connect to data sources using the display() slot, which is overloaded to take any of five argument types. .PP There are also slots to change the base with setMode() and the decimal point with setSmallDecimalPoint(). .PP -QLCDNumber emits the overflow() signal when it is asked to display something beyond its range. The range is set by setNumDigits(), but setSmallDecimalPoint() also influences it. If the display is set to hexadecimal, octal or binary, the integer equivalent of the value is displayed. +TQLCDNumber emits the overflow() signal when it is asked to display something beyond its range. The range is set by setNumDigits(), but setSmallDecimalPoint() also influences it. If the display is set to hexadecimal, octal or binary, the integer equivalent of the value is displayed. .PP -These digits and other symbols can be shown: 0/O, 1, 2, 3, 4, 5/S, 6, 7, 8, 9/g, minus, decimal point, A, B, C, D, E, F, h, H, L, o, P, r, u, U, Y, colon, degree sign (which is specified as single quote in the string) and space. QLCDNumber substitutes spaces for illegal characters. +These digits and other symbols can be shown: 0/O, 1, 2, 3, 4, 5/S, 6, 7, 8, 9/g, minus, decimal point, A, B, C, D, E, F, h, H, L, o, P, r, u, U, Y, colon, degree sign (which is specified as single quote in the string) and space. TQLCDNumber substitutes spaces for illegal characters. .PP -It is not possible to retrieve the contents of a QLCDNumber object, although you can retrieve the numeric value with value(). If you really need the text, we recommend that you connect the signals that feed the display() slot to another slot as well and store the value there. +It is not possible to retrieve the contents of a TQLCDNumber object, although you can retrieve the numeric value with value(). If you really need the text, we recommend that you connect the signals that feed the display() slot to another slot as well and store the value there. .PP -Incidentally, QLCDNumber is the very oldest part of Qt, tracing back to a BASIC program on the Sinclair Spectrum. +Incidentally, TQLCDNumber is the very oldest part of Qt, tracing back to a BASIC program on the Sinclair Spectrum. .PP .ce 1 .B "[Image Omitted]" @@ -148,109 +148,109 @@ Incidentally, QLCDNumber is the very oldest part of Qt, tracing back to a BASIC .PP See also TQLabel, QFrame, and Basic Widgets. .SS "Member Type Documentation" -.SH "QLCDNumber::Mode" +.SH "TQLCDNumber::Mode" This type determines how numbers are shown. .TP -\fCQLCDNumber::Hex\fR - Hexadecimal +\fCTQLCDNumber::Hex\fR - Hexadecimal .TP -\fCQLCDNumber::Dec\fR - Decimal +\fCTQLCDNumber::Dec\fR - Decimal .TP -\fCQLCDNumber::Oct\fR - Octal +\fCTQLCDNumber::Oct\fR - Octal .TP -\fCQLCDNumber::Bin\fR - Binary +\fCTQLCDNumber::Bin\fR - Binary .PP If the display is set to hexadecimal, octal or binary, the integer equivalent of the value is displayed. -.SH "QLCDNumber::SegmentStyle" -This type determines the visual appearance of the QLCDNumber widget. +.SH "TQLCDNumber::SegmentStyle" +This type determines the visual appearance of the TQLCDNumber widget. .TP -\fCQLCDNumber::Outline\fR - gives raised segments filled with the background brush. +\fCTQLCDNumber::Outline\fR - gives raised segments filled with the background brush. .TP -\fCQLCDNumber::Filled\fR - gives raised segments filled with the foreground brush. +\fCTQLCDNumber::Filled\fR - gives raised segments filled with the foreground brush. .TP -\fCQLCDNumber::Flat\fR - gives flat segments filled with the foreground brush. +\fCTQLCDNumber::Flat\fR - gives flat segments filled with the foreground brush. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QLCDNumber::QLCDNumber ( TQWidget * parent = 0, const char * name = 0 )" +.SH "TQLCDNumber::TQLCDNumber ( TQWidget * parent = 0, const char * name = 0 )" Constructs an LCD number, sets the number of digits to 5, the base to decimal, the decimal point mode to 'small' and the frame style to a raised box. The segmentStyle() is set to Outline. .PP The \fIparent\fR and \fIname\fR arguments are passed to the QFrame constructor. .PP See also numDigits and smallDecimalPoint. -.SH "QLCDNumber::QLCDNumber ( uint numDigits, TQWidget * parent = 0, const char * name = 0 )" +.SH "TQLCDNumber::TQLCDNumber ( uint numDigits, TQWidget * parent = 0, const char * name = 0 )" Constructs an LCD number, sets the number of digits to \fInumDigits\fR, the base to decimal, the decimal point mode to 'small' and the frame style to a raised box. The segmentStyle() is set to Outline. .PP The \fIparent\fR and \fIname\fR arguments are passed to the QFrame constructor. .PP See also numDigits and smallDecimalPoint. -.SH "QLCDNumber::~QLCDNumber ()" +.SH "TQLCDNumber::~TQLCDNumber ()" Destroys the LCD number. -.SH "bool QLCDNumber::checkOverflow ( double num ) const" +.SH "bool TQLCDNumber::checkOverflow ( double num ) const" Returns TRUE if \fInum\fR is too big to be displayed in its entirety; otherwise returns FALSE. .PP See also display(), numDigits, and smallDecimalPoint. -.SH "bool QLCDNumber::checkOverflow ( int num ) const" +.SH "bool TQLCDNumber::checkOverflow ( int num ) const" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Returns TRUE if \fInum\fR is too big to be displayed in its entirety; otherwise returns FALSE. .PP See also display(), numDigits, and smallDecimalPoint. -.SH "void QLCDNumber::display ( const TQString & s )\fC [slot]\fR" +.SH "void TQLCDNumber::display ( const TQString & s )\fC [slot]\fR" Displays the number represented by the string \fIs\fR. .PP This version of the function disregards mode() and smallDecimalPoint(). .PP -These digits and other symbols can be shown: 0/O, 1, 2, 3, 4, 5/S, 6, 7, 8, 9/g, minus, decimal point, A, B, C, D, E, F, h, H, L, o, P, r, u, U, Y, colon, degree sign (which is specified as single quote in the string) and space. QLCDNumber substitutes spaces for illegal characters. +These digits and other symbols can be shown: 0/O, 1, 2, 3, 4, 5/S, 6, 7, 8, 9/g, minus, decimal point, A, B, C, D, E, F, h, H, L, o, P, r, u, U, Y, colon, degree sign (which is specified as single quote in the string) and space. TQLCDNumber substitutes spaces for illegal characters. .PP Examples: .)l rangecontrols/rangecontrols.cpp, t12/lcdrange.cpp, t13/gamebrd.cpp, t5/main.cpp, t6/main.cpp, t7/lcdrange.cpp, and xform/xform.cpp. -.SH "void QLCDNumber::display ( int num )\fC [slot]\fR" +.SH "void TQLCDNumber::display ( int num )\fC [slot]\fR" Sets the displayed value rounded to the nearest integer to \fInum\fR. See the "intValue" property for details. -.SH "void QLCDNumber::display ( double num )\fC [slot]\fR" +.SH "void TQLCDNumber::display ( double num )\fC [slot]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Displays the number \fInum\fR. -.SH "void QLCDNumber::drawContents ( TQPainter * p )\fC [virtual protected]\fR" +.SH "void TQLCDNumber::drawContents ( TQPainter * p )\fC [virtual protected]\fR" Draws the LCD number using painter \fIp\fR. This function is called from QFrame::paintEvent(). .PP Reimplemented from QFrame. -.SH "int QLCDNumber::intValue () const" +.SH "int TQLCDNumber::intValue () const" Returns the displayed value rounded to the nearest integer. See the "intValue" property for details. -.SH "Mode QLCDNumber::mode () const" +.SH "Mode TQLCDNumber::mode () const" Returns the current display mode (number base). See the "mode" property for details. -.SH "int QLCDNumber::numDigits () const" +.SH "int TQLCDNumber::numDigits () const" Returns the current number of digits displayed. See the "numDigits" property for details. -.SH "void QLCDNumber::overflow ()\fC [signal]\fR" -This signal is emitted whenever the QLCDNumber is asked to display a too-large number or a too-long string. +.SH "void TQLCDNumber::overflow ()\fC [signal]\fR" +This signal is emitted whenever the TQLCDNumber is asked to display a too-large number or a too-long string. .PP It is never emitted by setNumDigits(). -.SH "SegmentStyle QLCDNumber::segmentStyle () const" +.SH "SegmentStyle TQLCDNumber::segmentStyle () const" Returns the style of the LCDNumber. See the "segmentStyle" property for details. -.SH "void QLCDNumber::setBinMode ()\fC [virtual slot]\fR" +.SH "void TQLCDNumber::setBinMode ()\fC [virtual slot]\fR" Calls setMode( BIN ). Provided for convenience (e.g. for connecting buttons to it). .PP See also mode, setHexMode(), setDecMode(), setOctMode(), and mode. -.SH "void QLCDNumber::setDecMode ()\fC [virtual slot]\fR" +.SH "void TQLCDNumber::setDecMode ()\fC [virtual slot]\fR" Calls setMode( DEC ). Provided for convenience (e.g. for connecting buttons to it). .PP See also mode, setHexMode(), setOctMode(), setBinMode(), and mode. -.SH "void QLCDNumber::setHexMode ()\fC [virtual slot]\fR" +.SH "void TQLCDNumber::setHexMode ()\fC [virtual slot]\fR" Calls setMode( HEX ). Provided for convenience (e.g. for connecting buttons to it). .PP See also mode, setDecMode(), setOctMode(), setBinMode(), and mode. -.SH "void QLCDNumber::setMode ( Mode )\fC [virtual]\fR" +.SH "void TQLCDNumber::setMode ( Mode )\fC [virtual]\fR" Sets the current display mode (number base). See the "mode" property for details. -.SH "void QLCDNumber::setNumDigits ( int nDigits )\fC [virtual]\fR" +.SH "void TQLCDNumber::setNumDigits ( int nDigits )\fC [virtual]\fR" Sets the current number of digits displayed to \fInDigits\fR. See the "numDigits" property for details. -.SH "void QLCDNumber::setOctMode ()\fC [virtual slot]\fR" +.SH "void TQLCDNumber::setOctMode ()\fC [virtual slot]\fR" Calls setMode( OCT ). Provided for convenience (e.g. for connecting buttons to it). .PP See also mode, setHexMode(), setDecMode(), setBinMode(), and mode. -.SH "void QLCDNumber::setSegmentStyle ( SegmentStyle )\fC [virtual]\fR" +.SH "void TQLCDNumber::setSegmentStyle ( SegmentStyle )\fC [virtual]\fR" Sets the style of the LCDNumber. See the "segmentStyle" property for details. -.SH "void QLCDNumber::setSmallDecimalPoint ( bool )\fC [virtual slot]\fR" +.SH "void TQLCDNumber::setSmallDecimalPoint ( bool )\fC [virtual slot]\fR" Sets the style of the decimal point. See the "smallDecimalPoint" property for details. -.SH "bool QLCDNumber::smallDecimalPoint () const" +.SH "bool TQLCDNumber::smallDecimalPoint () const" Returns the style of the decimal point. See the "smallDecimalPoint" property for details. -.SH "double QLCDNumber::value () const" +.SH "double TQLCDNumber::value () const" Returns the displayed value. See the "value" property for details. .SS "Property Documentation" .SH "int intValue" @@ -272,7 +272,7 @@ Set this property's value with setMode() and get this property's value with mode .SH "int numDigits" This property holds the current number of digits displayed. .PP -Corresponds to the current number of digits. If QLCDNumber::smallDecimalPoint is FALSE, the decimal point occupies one digit position. +Corresponds to the current number of digits. If TQLCDNumber::smallDecimalPoint is FALSE, the decimal point occupies one digit position. .PP See also smallDecimalPoint. .PP @@ -310,7 +310,7 @@ If the displayed value is not a number, the property has a value of 0. Set this property's value with display() and get this property's value with value(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqlcdnumber.html +.BR http://doc.trolltech.com/tqlcdnumber.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqlineedit.3qt b/doc/man/man3/tqlineedit.3qt index a0fd587a4..7c4d19367 100644 --- a/doc/man/man3/tqlineedit.3qt +++ b/doc/man/man3/tqlineedit.3qt @@ -1,5 +1,5 @@ '\" t -.TH QLineEdit 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQLineEdit 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,25 +7,25 @@ .ad l .nh .SH NAME -QLineEdit \- One-line text editor +TQLineEdit \- One-line text editor .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP Inherits QFrame. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQLineEdit\fR ( TQWidget * parent, const char * name = 0 )" +.BI "\fBTQLineEdit\fR ( TQWidget * parent, const char * name = 0 )" .br .ti -1c -.BI "\fBQLineEdit\fR ( const TQString & contents, TQWidget * parent, const char * name = 0 )" +.BI "\fBTQLineEdit\fR ( const TQString & contents, TQWidget * parent, const char * name = 0 )" .br .ti -1c -.BI "\fBQLineEdit\fR ( const TQString & contents, const TQString & inputMask, TQWidget * parent, const char * name = 0 )" +.BI "\fBTQLineEdit\fR ( const TQString & contents, const TQString & inputMask, TQWidget * parent, const char * name = 0 )" .br .ti -1c -.BI "\fB~QLineEdit\fR ()" +.BI "\fB~TQLineEdit\fR ()" .br .ti -1c .BI "TQString \fBtext\fR () const" @@ -278,7 +278,7 @@ Inherits QFrame. .br .in -1c .SH DESCRIPTION -The QLineEdit widget is a one-line text editor. +The TQLineEdit widget is a one-line text editor. .PP A line edit allows the user to enter and edit a single line of plain text with a useful collection of editing functions, including undo and redo, cut and paste, and drag and drop. .PP @@ -292,7 +292,7 @@ You can change the text with setText() or insert(). The text is retrieved with t .PP When the text changes the textChanged() signal is emitted; when the Return or Enter key is pressed the returnPressed() signal is emitted. Note that if there is a validator set on the line edit, the returnPressed() signal will only be emitted if the validator returns \fCAcceptable\fR. .PP -By default, QLineEdits have a frame as specified by the Windows and Motif style guides; you can turn it off by calling setFrame(FALSE). +By default, TQLineEdits have a frame as specified by the Windows and Motif style guides; you can turn it off by calling setFrame(FALSE). .PP The default key bindings are described below. The line edit also provides a context menu (usually invoked by a right mouse click) that presents some of these editing options.
          .nf .TS @@ -310,20 +310,20 @@ Any other key sequence that represents a valid character, will cause the charact .ce 1 .B "[Image Omitted]" .PP -See also TQTextEdit, TQLabel, QComboBox, GUI Design Handbook: Field, Entry, and Basic Widgets. +See also TQTextEdit, TQLabel, TQComboBox, GUI Design Handbook: Field, Entry, and Basic Widgets. .SS "Member Type Documentation" -.SH "QLineEdit::EchoMode" +.SH "TQLineEdit::EchoMode" This enum type describes how a line edit should display its contents. .TP -\fCQLineEdit::Normal\fR - Display characters as they are entered. This is the default. +\fCTQLineEdit::Normal\fR - Display characters as they are entered. This is the default. .TP -\fCQLineEdit::NoEcho\fR - Do not display anything. This may be appropriate for passwords where even the length of the password should be kept secret. +\fCTQLineEdit::NoEcho\fR - Do not display anything. This may be appropriate for passwords where even the length of the password should be kept secret. .TP -\fCQLineEdit::Password\fR - Display asterisks instead of the characters actually entered. +\fCTQLineEdit::Password\fR - Display asterisks instead of the characters actually entered. .PP See also echoMode and echoMode. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QLineEdit::QLineEdit ( TQWidget * parent, const char * name = 0 )" +.SH "TQLineEdit::TQLineEdit ( TQWidget * parent, const char * name = 0 )" Constructs a line edit with no text. .PP The maximum text length is set to 32767 characters. @@ -331,7 +331,7 @@ The maximum text length is set to 32767 characters. The \fIparent\fR and \fIname\fR arguments are sent to the TQWidget constructor. .PP See also text and maxLength. -.SH "QLineEdit::QLineEdit ( const TQString & contents, TQWidget * parent, const char * name = 0 )" +.SH "TQLineEdit::TQLineEdit ( const TQString & contents, TQWidget * parent, const char * name = 0 )" Constructs a line edit containing the text \fIcontents\fR. .PP The cursor position is set to the end of the line and the maximum text length to 32767 characters. @@ -339,7 +339,7 @@ The cursor position is set to the end of the line and the maximum text length to The \fIparent\fR and \fIname\fR arguments are sent to the TQWidget constructor. .PP See also text and maxLength. -.SH "QLineEdit::QLineEdit ( const TQString & contents, const TQString & inputMask, TQWidget * parent, const char * name = 0 )" +.SH "TQLineEdit::TQLineEdit ( const TQString & contents, const TQString & inputMask, TQWidget * parent, const char * name = 0 )" Constructs a line edit with an input \fIinputMask\fR and the text \fIcontents\fR. .PP The cursor position is set to the end of the line and the maximum text length is set to the length of the mask (the number of mask characters and separators). @@ -347,99 +347,99 @@ The cursor position is set to the end of the line and the maximum text length is The \fIparent\fR and \fIname\fR arguments are sent to the TQWidget constructor. .PP See also setMask() and text. -.SH "QLineEdit::~QLineEdit ()" +.SH "TQLineEdit::~TQLineEdit ()" Destroys the line edit. -.SH "int QLineEdit::alignment () const" +.SH "int TQLineEdit::alignment () const" Returns the alignment of the line edit. See the "alignment" property for details. -.SH "void QLineEdit::backspace ()" +.SH "void TQLineEdit::backspace ()" If no text is selected, deletes the character to the left of the text cursor and moves the cursor one position to the left. If any text is selected, the cursor is moved to the beginning of the selected text and the selected text is deleted. .PP See also del(). -.SH "int QLineEdit::characterAt ( int xpos, TQChar * chr ) const" +.SH "int TQLineEdit::characterAt ( int xpos, TQChar * chr ) const" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. -.SH "void QLineEdit::clear ()\fC [virtual slot]\fR" +.SH "void TQLineEdit::clear ()\fC [virtual slot]\fR" Clears the contents of the line edit. -.SH "void QLineEdit::clearModified ()" +.SH "void TQLineEdit::clearModified ()" Resets the modified flag to FALSE. .PP See also modified. -.SH "void QLineEdit::clearValidator ()\fC [virtual slot]\fR" +.SH "void TQLineEdit::clearValidator ()\fC [virtual slot]\fR" This slot is equivalent to setValidator(0). -.SH "void QLineEdit::copy () const\fC [virtual slot]\fR" +.SH "void TQLineEdit::copy () const\fC [virtual slot]\fR" Copies the selected text to the clipboard, if there is any, and if echoMode() is Normal. .PP See also cut() and paste(). -.SH "TQPopupMenu * QLineEdit::createPopupMenu ()\fC [virtual protected]\fR" +.SH "TQPopupMenu * TQLineEdit::createPopupMenu ()\fC [virtual protected]\fR" This function is called to create the popup menu which is shown when the user clicks on the line edit with the right mouse button. If you want to create a custom popup menu, reimplement this function and return the popup menu you create. The popup menu's ownership is transferred to the caller. -.SH "void QLineEdit::cursorBackward ( bool mark, int steps = 1 )" +.SH "void TQLineEdit::cursorBackward ( bool mark, int steps = 1 )" Moves the cursor back \fIsteps\fR characters. If \fImark\fR is TRUE each character moved over is added to the selection; if \fImark\fR is FALSE the selection is cleared. .PP See also cursorForward(). -.SH "void QLineEdit::cursorForward ( bool mark, int steps = 1 )" +.SH "void TQLineEdit::cursorForward ( bool mark, int steps = 1 )" Moves the cursor forward \fIsteps\fR characters. If \fImark\fR is TRUE each character moved over is added to the selection; if \fImark\fR is FALSE the selection is cleared. .PP See also cursorBackward(). -.SH "int QLineEdit::cursorPosition () const" +.SH "int TQLineEdit::cursorPosition () const" Returns the current cursor position for this line edit. See the "cursorPosition" property for details. -.SH "void QLineEdit::cursorWordBackward ( bool mark )" +.SH "void TQLineEdit::cursorWordBackward ( bool mark )" Moves the cursor one word backward. If \fImark\fR is TRUE, the word is also selected. .PP See also cursorWordForward(). -.SH "void QLineEdit::cursorWordForward ( bool mark )" +.SH "void TQLineEdit::cursorWordForward ( bool mark )" Moves the cursor one word forward. If \fImark\fR is TRUE, the word is also selected. .PP See also cursorWordBackward(). -.SH "void QLineEdit::cut ()\fC [virtual slot]\fR" +.SH "void TQLineEdit::cut ()\fC [virtual slot]\fR" Copies the selected text to the clipboard and deletes it, if there is any, and if echoMode() is Normal. .PP If the current validator disallows deleting the selected text, cut() will copy without deleting. .PP See also copy(), paste(), and setValidator(). -.SH "void QLineEdit::del ()" +.SH "void TQLineEdit::del ()" If no text is selected, deletes the character to the right of the text cursor. If any text is selected, the cursor is moved to the beginning of the selected text and the selected text is deleted. .PP See also backspace(). -.SH "void QLineEdit::deselect ()\fC [virtual slot]\fR" +.SH "void TQLineEdit::deselect ()\fC [virtual slot]\fR" Deselects any selected text. .PP See also setSelection() and selectAll(). -.SH "TQString QLineEdit::displayText () const" +.SH "TQString TQLineEdit::displayText () const" Returns the displayed text. See the "displayText" property for details. -.SH "bool QLineEdit::dragEnabled () const" +.SH "bool TQLineEdit::dragEnabled () const" Returns TRUE if the lineedit starts a drag if the user presses and moves the mouse on some selected text; otherwise returns FALSE. See the "dragEnabled" property for details. -.SH "EchoMode QLineEdit::echoMode () const" +.SH "EchoMode TQLineEdit::echoMode () const" Returns the line edit's echo mode. See the "echoMode" property for details. -.SH "bool QLineEdit::edited () const" +.SH "bool TQLineEdit::edited () const" Returns TRUE if the line edit has been edited. Use modified instead; otherwise returns FALSE. See the "edited" property for details. -.SH "void QLineEdit::end ( bool mark )" +.SH "void TQLineEdit::end ( bool mark )" Moves the text cursor to the end of the line unless it is already there. If \fImark\fR is TRUE, text is selected towards the last position; otherwise, any selected text is unselected if the cursor is moved. .PP See also home(). -.SH "bool QLineEdit::frame () const" +.SH "bool TQLineEdit::frame () const" Returns TRUE if the line edit draws itself with a frame; otherwise returns FALSE. See the "frame" property for details. -.SH "bool QLineEdit::getSelection ( int * start, int * end )" +.SH "bool TQLineEdit::getSelection ( int * start, int * end )" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. use selectedText(), selectionStart() -.SH "bool QLineEdit::hasAcceptableInput () const" +.SH "bool TQLineEdit::hasAcceptableInput () const" Returns TRUE if the input satisfies the inputMask and the validator; otherwise returns FALSE. See the "acceptableInput" property for details. -.SH "bool QLineEdit::hasSelectedText () const" +.SH "bool TQLineEdit::hasSelectedText () const" Returns TRUE if there is any text selected; otherwise returns FALSE. See the "hasSelectedText" property for details. -.SH "void QLineEdit::home ( bool mark )" +.SH "void TQLineEdit::home ( bool mark )" Moves the text cursor to the beginning of the line unless it is already there. If \fImark\fR is TRUE, text is selected towards the first position; otherwise, any selected text is unselected if the cursor is moved. .PP See also end(). -.SH "TQString QLineEdit::inputMask () const" +.SH "TQString TQLineEdit::inputMask () const" Returns the validation input mask. See the "inputMask" property for details. -.SH "void QLineEdit::insert ( const TQString & newText )\fC [virtual slot]\fR" +.SH "void TQLineEdit::insert ( const TQString & newText )\fC [virtual slot]\fR" Deletes any selected text, inserts \fInewText\fR, and validates the result. If it is valid, it sets it as the new contents of the line edit. -.SH "bool QLineEdit::isModified () const" +.SH "bool TQLineEdit::isModified () const" Returns TRUE if the line edit's contents has been modified by the user; otherwise returns FALSE. See the "modified" property for details. -.SH "bool QLineEdit::isReadOnly () const" +.SH "bool TQLineEdit::isReadOnly () const" Returns TRUE if the line edit is read only; otherwise returns FALSE. See the "readOnly" property for details. -.SH "bool QLineEdit::isRedoAvailable () const" +.SH "bool TQLineEdit::isRedoAvailable () const" Returns TRUE if redo is available; otherwise returns FALSE. See the "redoAvailable" property for details. -.SH "bool QLineEdit::isUndoAvailable () const" +.SH "bool TQLineEdit::isUndoAvailable () const" Returns TRUE if undo is available; otherwise returns FALSE. See the "undoAvailable" property for details. -.SH "void QLineEdit::keyPressEvent ( QKeyEvent * e )\fC [virtual protected]\fR" +.SH "void TQLineEdit::keyPressEvent ( QKeyEvent * e )\fC [virtual protected]\fR" Converts key press event \fIe\fR into a line edit action. .PP If Return or Enter is pressed and the current text is valid (or can be made valid by the validator), the signal returnPressed() is emitted. @@ -447,71 +447,71 @@ If Return or Enter is pressed and the current text is valid (or can be made vali The default key bindings are listed in the detailed description. .PP Reimplemented from TQWidget. -.SH "void QLineEdit::lostFocus ()\fC [signal]\fR" +.SH "void TQLineEdit::lostFocus ()\fC [signal]\fR" This signal is emitted when the line edit has lost focus. .PP See also focus, TQWidget::focusInEvent(), and TQWidget::focusOutEvent(). -.SH "int QLineEdit::maxLength () const" +.SH "int TQLineEdit::maxLength () const" Returns the maximum permitted length of the text. See the "maxLength" property for details. -.SH "TQSize QLineEdit::minimumSizeHint () const\fC [virtual]\fR" +.SH "TQSize TQLineEdit::minimumSizeHint () const\fC [virtual]\fR" Returns a minimum size for the line edit. .PP The width returned is enough for at least one character. .PP Reimplemented from TQWidget. -.SH "void QLineEdit::paste ()\fC [virtual slot]\fR" +.SH "void TQLineEdit::paste ()\fC [virtual slot]\fR" Inserts the clipboard's text at the cursor position, deleting any selected text, providing the line edit is not read-only. .PP If the end result would not be acceptable to the current validator, nothing happens. .PP See also copy() and cut(). -.SH "void QLineEdit::redo ()\fC [virtual slot]\fR" +.SH "void TQLineEdit::redo ()\fC [virtual slot]\fR" Redoes the last operation if redo is available. -.SH "void QLineEdit::returnPressed ()\fC [signal]\fR" +.SH "void TQLineEdit::returnPressed ()\fC [signal]\fR" This signal is emitted when the Return or Enter key is pressed. Note that if there is a validator() or inputMask() set on the line edit, the returnPressed() signal will only be emitted if the input follows the inputMask() and the validator() returns \fCAcceptable\fR. .PP Example: popup/popup.cpp. -.SH "void QLineEdit::selectAll ()\fC [virtual slot]\fR" +.SH "void TQLineEdit::selectAll ()\fC [virtual slot]\fR" Selects all the text (i.e. highlights it) and moves the cursor to the end. This is useful when a default value has been inserted because if the user types before clicking on the widget, the selected text will be deleted. .PP See also setSelection() and deselect(). -.SH "TQString QLineEdit::selectedText () const" +.SH "TQString TQLineEdit::selectedText () const" Returns the selected text. See the "selectedText" property for details. -.SH "void QLineEdit::selectionChanged ()\fC [signal]\fR" +.SH "void TQLineEdit::selectionChanged ()\fC [signal]\fR" This signal is emitted whenever the selection changes. .PP See also hasSelectedText and selectedText. -.SH "int QLineEdit::selectionStart () const" +.SH "int TQLineEdit::selectionStart () const" selectionStart() returns the index of the first selected character in the line edit or -1 if no text is selected. .PP See also selectedText. -.SH "void QLineEdit::setAlignment ( int flag )\fC [virtual slot]\fR" +.SH "void TQLineEdit::setAlignment ( int flag )\fC [virtual slot]\fR" Sets the alignment of the line edit to \fIflag\fR. See the "alignment" property for details. -.SH "void QLineEdit::setCursorPosition ( int )\fC [virtual slot]\fR" +.SH "void TQLineEdit::setCursorPosition ( int )\fC [virtual slot]\fR" Sets the current cursor position for this line edit. See the "cursorPosition" property for details. -.SH "void QLineEdit::setDragEnabled ( bool b )\fC [virtual slot]\fR" +.SH "void TQLineEdit::setDragEnabled ( bool b )\fC [virtual slot]\fR" Sets whether the lineedit starts a drag if the user presses and moves the mouse on some selected text to \fIb\fR. See the "dragEnabled" property for details. -.SH "void QLineEdit::setEchoMode ( EchoMode )\fC [virtual slot]\fR" +.SH "void TQLineEdit::setEchoMode ( EchoMode )\fC [virtual slot]\fR" Sets the line edit's echo mode. See the "echoMode" property for details. -.SH "void QLineEdit::setEdited ( bool )" +.SH "void TQLineEdit::setEdited ( bool )" Sets whether the line edit has been edited. Use modified instead. See the "edited" property for details. -.SH "void QLineEdit::setFrame ( bool )\fC [virtual slot]\fR" +.SH "void TQLineEdit::setFrame ( bool )\fC [virtual slot]\fR" Sets whether the line edit draws itself with a frame. See the "frame" property for details. -.SH "void QLineEdit::setInputMask ( const TQString & inputMask )" +.SH "void TQLineEdit::setInputMask ( const TQString & inputMask )" Sets the validation input mask to \fIinputMask\fR. See the "inputMask" property for details. -.SH "void QLineEdit::setMaxLength ( int )\fC [virtual slot]\fR" +.SH "void TQLineEdit::setMaxLength ( int )\fC [virtual slot]\fR" Sets the maximum permitted length of the text. See the "maxLength" property for details. -.SH "void QLineEdit::setReadOnly ( bool )\fC [virtual slot]\fR" +.SH "void TQLineEdit::setReadOnly ( bool )\fC [virtual slot]\fR" Sets whether the line edit is read only. See the "readOnly" property for details. -.SH "void QLineEdit::setSelection ( int start, int length )\fC [virtual slot]\fR" +.SH "void TQLineEdit::setSelection ( int start, int length )\fC [virtual slot]\fR" Selects text from position \fIstart\fR and for \fIlength\fR characters. .PP Note that this function sets the cursor's position to the end of the selection regardless of its current position. .PP See also deselect(), selectAll(), getSelection(), cursorForward(), and cursorBackward(). -.SH "void QLineEdit::setText ( const TQString & )\fC [virtual slot]\fR" +.SH "void TQLineEdit::setText ( const TQString & )\fC [virtual slot]\fR" Sets the line edit's text. See the "text" property for details. -.SH "void QLineEdit::setValidator ( const QValidator * v )\fC [virtual slot]\fR" +.SH "void TQLineEdit::setValidator ( const QValidator * v )\fC [virtual slot]\fR" Sets this line edit to only accept input that the validator, \fIv\fR, will accept. This allows you to place any arbitrary constraints on the text which may be entered. .PP If \fIv\fR == 0, setValidator() removes the current input validator. The initial setting is to have no input validator (i.e. any input is accepted up to maxLength()). @@ -520,24 +520,24 @@ See also validator(), QIntValidator, QDoubleValidator, and TQRegExpValidator. .PP Examples: .)l lineedits/lineedits.cpp and wizard/wizard.cpp. -.SH "TQSize QLineEdit::sizeHint () const\fC [virtual]\fR" +.SH "TQSize TQLineEdit::sizeHint () const\fC [virtual]\fR" Returns a recommended size for the widget. .PP The width returned, in pixels, is usually enough for about 15 to 20 characters. .PP Example: addressbook/centralwidget.cpp. -.SH "TQString QLineEdit::text () const" +.SH "TQString TQLineEdit::text () const" Returns the line edit's text. See the "text" property for details. -.SH "void QLineEdit::textChanged ( const TQString & )\fC [signal]\fR" +.SH "void TQLineEdit::textChanged ( const TQString & )\fC [signal]\fR" This signal is emitted whenever the text changes. The argument is the new text. .PP Examples: .)l simple/main.cpp, wizard/wizard.cpp, and xform/xform.cpp. -.SH "void QLineEdit::undo ()\fC [virtual slot]\fR" +.SH "void TQLineEdit::undo ()\fC [virtual slot]\fR" Undoes the last operation if undo is available. Deselects any current selection, and updates the selection start to the current cursor position. -.SH "bool QLineEdit::validateAndSet ( const TQString & newText, int newPos, int newMarkAnchor, int newMarkDrag )" +.SH "bool TQLineEdit::validateAndSet ( const TQString & newText, int newPos, int newMarkAnchor, int newMarkDrag )" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. Use setText(), setCursorPosition() and setSelection() instead. -.SH "const QValidator * QLineEdit::validator () const" +.SH "const QValidator * TQLineEdit::validator () const" Returns a pointer to the current input validator, or 0 if no validator has been set. .PP See also setValidator(). @@ -581,7 +581,7 @@ Set this property's value with setDragEnabled() and get this property's value wi .SH "EchoMode echoMode" This property holds the line edit's echo mode. .PP -The initial setting is Normal, but QLineEdit also supports NoEcho and Password modes. +The initial setting is Normal, but TQLineEdit also supports NoEcho and Password modes. .PP The widget's display and the ability to copy or drag the text is affected by this setting. .PP @@ -613,9 +613,9 @@ This property holds the validation input mask. .PP If no mask is set, inputMask() returns TQString::null. .PP -Sets the QLineEdit's validation mask. Validators can be used instead of, or in conjunction with masks; see setValidator(). +Sets the TQLineEdit's validation mask. Validators can be used instead of, or in conjunction with masks; see setValidator(). .PP -Unset the mask and return to normal QLineEdit operation by passing an empty string ("") or just calling setInputMask() with no arguments. +Unset the mask and return to normal TQLineEdit operation by passing an empty string ("") or just calling setInputMask() with no arguments. .PP The mask format understands these mask characters:
          .nf .TS @@ -655,7 +655,7 @@ Set this property's value with setMaxLength() and get this property's value with .SH "bool modified" This property holds whether the line edit's contents has been modified by the user. .PP -The modified flag is never read by QLineEdit; it has a default value of FALSE and is changed to TRUE whenever the user changes the line edit's contents. +The modified flag is never read by TQLineEdit; it has a default value of FALSE and is changed to TRUE whenever the user changes the line edit's contents. .PP This is useful for things that need to provide a default value but do not start out knowing what the default should be (perhaps it depends on other fields on the form). Start the line edit without the best default, and when the default is known, if modified() returns FALSE (the user hasn't entered any text), insert the default value. .PP @@ -667,7 +667,7 @@ This property holds whether the line edit is read only. .PP In read-only mode, the user can still copy the text to the clipboard or drag-and-drop the text (if echoMode() is Normal), but cannot edit it. .PP -QLineEdit does not show a cursor in read-only mode. +TQLineEdit does not show a cursor in read-only mode. .PP See also enabled. .PP @@ -700,7 +700,7 @@ This property holds whether undo is available. Get this property's value with isUndoAvailable(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqlineedit.html +.BR http://doc.trolltech.com/tqlineedit.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqlistbox.3qt b/doc/man/man3/tqlistbox.3qt index 6935b4a3b..0e1188008 100644 --- a/doc/man/man3/tqlistbox.3qt +++ b/doc/man/man3/tqlistbox.3qt @@ -11,7 +11,7 @@ QListBox \- List of selectable, read-only items .SH SYNOPSIS \fC#include \fR .PP -Inherits QScrollView. +Inherits TQScrollView. .PP .SS "Public Members" .in +1c @@ -456,7 +456,7 @@ If you need to insert types other than strings and pixmaps, you must define new .ce 1 .B "[Image Omitted]" .PP -See also QListView, QComboBox, QButtonGroup, GUI Design Handbook: List Box (two sections), and Advanced Widgets. +See also QListView, TQComboBox, QButtonGroup, GUI Design Handbook: List Box (two sections), and Advanced Widgets. .SS "Member Type Documentation" .SH "QListBox::LayoutMode" This enum type is used to specify how QListBox lays out its rows and columns. diff --git a/doc/man/man3/tqlistview.3qt b/doc/man/man3/tqlistview.3qt index 75d4154cf..bf273525f 100644 --- a/doc/man/man3/tqlistview.3qt +++ b/doc/man/man3/tqlistview.3qt @@ -11,7 +11,7 @@ QListView \- Implements a list/tree view .SH SYNOPSIS \fC#include \fR .PP -Inherits QScrollView. +Inherits TQScrollView. .PP .SS "Public Members" .in +1c @@ -399,7 +399,7 @@ The QListView class implements a list/tree view. .PP It can display and control a hierarchy of multi-column items, and provides the ability to add new items at any time. The user may select one or many items (depending on the SelectionMode) and sort the list in increasing or decreasing order by any column. .PP -The simplest pattern of use is to create a QListView, add some column headers using addColumn() and create one or more QListViewItem or QCheckListItem objects with the QListView as parent: +The simplest pattern of use is to create a QListView, add some column headers using addColumn() and create one or more QListViewItem or TQCheckListItem objects with the QListView as parent: .PP .nf .br @@ -438,7 +438,7 @@ l - l. Function Action addColumn() Adds a column with a text label and perhaps w .fi
          .PP -To handle events such as mouse presses on the list view, derived classes can reimplement the QScrollView functions: contentsMousePressEvent, contentsMouseReleaseEvent, contentsMouseDoubleClickEvent, contentsMouseMoveEvent, contentsDragEnterEvent, contentsDragMoveEvent, contentsDragLeaveEvent, contentsDropEvent, and contentsWheelEvent. +To handle events such as mouse presses on the list view, derived classes can reimplement the TQScrollView functions: contentsMousePressEvent, contentsMouseReleaseEvent, contentsMouseDoubleClickEvent, contentsMouseMoveEvent, contentsDragEnterEvent, contentsDragMoveEvent, contentsDragLeaveEvent, contentsDropEvent, and contentsWheelEvent. .PP There are also several functions for mapping between items and coordinates. itemAt() returns the item at a position on-screen, itemRect() returns the rectangle an item occupies on the screen, and itemPos() returns the position of any item (whether it is on-screen or not). firstChild() returns the list view's first item (not necessarily visible on-screen). .PP @@ -476,7 +476,7 @@ If the user starts typing letters with the focus in the list view an incremental .ce 1 .B "[Image Omitted]" .PP -See also QListViewItem, QCheckListItem, and Advanced Widgets. +See also QListViewItem, TQCheckListItem, and Advanced Widgets. .SS "Member Type Documentation" .SH "QListView::RenameAction" This enum describes whether a rename operation is accepted if the rename editor loses focus without the user pressing Enter. @@ -598,25 +598,25 @@ Returns the number of columns in this list view. See the "columns" property for .SH "void QListView::contentsMouseDoubleClickEvent ( QMouseEvent * e )\fC [virtual protected]\fR" Processes the mouse double-click event \fIe\fR on behalf of the viewed widget. .PP -Reimplemented from QScrollView. +Reimplemented from TQScrollView. .SH "void QListView::contentsMouseMoveEvent ( QMouseEvent * e )\fC [virtual protected]\fR" Processes the mouse move event \fIe\fR on behalf of the viewed widget. .PP Example: dirview/dirview.cpp. .PP -Reimplemented from QScrollView. +Reimplemented from TQScrollView. .SH "void QListView::contentsMousePressEvent ( QMouseEvent * e )\fC [virtual protected]\fR" Processes the mouse press event \fIe\fR on behalf of the viewed widget. .PP Example: dirview/dirview.cpp. .PP -Reimplemented from QScrollView. +Reimplemented from TQScrollView. .SH "void QListView::contentsMouseReleaseEvent ( QMouseEvent * e )\fC [virtual protected]\fR" Processes the mouse release event \fIe\fR on behalf of the viewed widget. .PP Example: dirview/dirview.cpp. .PP -Reimplemented from QScrollView. +Reimplemented from TQScrollView. .SH "void QListView::contextMenuRequested ( QListViewItem * item, const TQPoint & pos, int col )\fC [signal]\fR" This signal is emitted when the user invokes a context menu with the right mouse button or with special system keys. If the keyboard was used \fIitem\fR is the current item; if the mouse was used, \fIitem\fR is the item under the mouse pointer or 0 if there is no item under the mouse pointer. If no item is clicked, the column index emitted is -1. .PP @@ -661,7 +661,7 @@ By default this function returns 0. You should reimplement it and create a TQDra .SH "void QListView::drawContentsOffset ( TQPainter * p, int ox, int oy, int cx, int cy, int cw, int ch )\fC [virtual protected]\fR" Calls QListViewItem::paintCell() and QListViewItem::paintBranches() as necessary for all list view items that require repainting in the \fIcw\fR pixels wide and \fIch\fR pixels high bounding rectangle starting at position \fIcx\fR, \fIcy\fR with offset \fIox\fR, \fIoy\fR. Uses the painter \fIp\fR. .PP -Reimplemented from QScrollView. +Reimplemented from TQScrollView. .SH "void QListView::dropped ( TQDropEvent * e )\fC [signal]\fR" This signal is emitted, when a drop event occurred on the viewport (not onto an item). .PP @@ -669,11 +669,11 @@ This signal is emitted, when a drop event occurred on the viewport (not onto an .SH "void QListView::ensureItemVisible ( const QListViewItem * i )" Ensures that item \fIi\fR is visible, scrolling the list view vertically if necessary and opening (expanding) any parent items if this is required to show the item. .PP -See also itemRect() and QScrollView::ensureVisible(). +See also itemRect() and TQScrollView::ensureVisible(). .SH "bool QListView::eventFilter ( TQObject * o, TQEvent * e )\fC [virtual]\fR" Redirects the event \fIe\fR relating to object \fIo\fR, for the viewport to mousePressEvent(), keyPressEvent() and friends. .PP -Reimplemented from QScrollView. +Reimplemented from TQScrollView. .SH "void QListView::expanded ( QListViewItem * item )\fC [signal]\fR" This signal is emitted when \fIitem\fR has been expanded, i.e. when the children of \fIitem\fR are shown. .PP diff --git a/doc/man/man3/tqlistviewitem.3qt b/doc/man/man3/tqlistviewitem.3qt index a432851df..00b38945f 100644 --- a/doc/man/man3/tqlistviewitem.3qt +++ b/doc/man/man3/tqlistviewitem.3qt @@ -13,7 +13,7 @@ QListViewItem \- Implements a list view item .PP Inherits Qt. .PP -Inherited by QCheckListItem. +Inherited by TQCheckListItem. .PP .SS "Public Members" .in +1c @@ -259,7 +259,7 @@ If you keep the pointer, you can set or change the texts using setText(), add pi .PP If you call \fCdelete\fR on a list view item, it will be deleted as expected, and as usual for TQObjects, if it has any child items (to any depth), all these will be deleted too. .PP -QCheckListItems are list view items that have a checkbox or radio button and can be used in place of plain QListViewItems. +TQCheckListItems are list view items that have a checkbox or radio button and can be used in place of plain QListViewItems. .PP You can traverse the tree as if it were a doubly-linked list using itemAbove() and itemBelow(); they return pointers to the items directly above and below this item on the screen (even if none of them are actually visible at the moment). .PP @@ -314,7 +314,7 @@ Some subclasses call setExpandable(TRUE) even when they have no children, and po .PP
          .PP -See also QCheckListItem, QListView, and Advanced Widgets. +See also TQCheckListItem, QListView, and Advanced Widgets. .SH MEMBER FUNCTION DOCUMENTATION .SH "QListViewItem::QListViewItem ( QListView * parent )" Constructs a new top-level list view item in the QListView \fIparent\fR. @@ -355,7 +355,7 @@ This virtual function is called whenever the user presses the mouse on this item .PP See also activatedPos(). .PP -Reimplemented in QCheckListItem. +Reimplemented in TQCheckListItem. .SH "bool QListViewItem::activatedPos ( TQPoint & pos )\fC [protected]\fR" When called from a reimplementation of activate(), this function gives information on how the item was activated. Otherwise the behavior is undefined. .PP @@ -538,7 +538,7 @@ See also paintBranches() and QListView::drawContentsOffset(). .PP Example: listviews/listviews.cpp. .PP -Reimplemented in QCheckListItem. +Reimplemented in TQCheckListItem. .SH "void QListViewItem::paintFocus ( TQPainter * p, const TQColorGroup & cg, const TQRect & r )\fC [virtual]\fR" Paints a focus indicator on the rectangle \fIr\fR using painter \fIp\fR and colors \fIcg\fR. .PP @@ -546,7 +546,7 @@ Paints a focus indicator on the rectangle \fIr\fR using painter \fIp\fR and colo .PP See also paintCell(), paintBranches(), and QListView::allColumnsShowFocus. .PP -Reimplemented in QCheckListItem. +Reimplemented in TQCheckListItem. .SH "QListViewItem * QListViewItem::parent () const" Returns the parent of this item, or 0 if this item has no parent. .PP @@ -575,7 +575,7 @@ Returns 0. .PP Make your derived classes return their own values for rtti(), so that you can distinguish between different kinds of list view items. You should use values greater than 1000 to allow for extensions to this class. .PP -Reimplemented in QCheckListItem. +Reimplemented in TQCheckListItem. .SH "void QListViewItem::setDragEnabled ( bool allow )\fC [virtual]\fR" If \fIallow\fR is TRUE, the list view starts a drag (see QListView::dragObject()) when the user presses and moves the mouse on this item. .SH "void QListViewItem::setDropEnabled ( bool allow )\fC [virtual]\fR" diff --git a/doc/man/man3/tqmacstyle.3qt b/doc/man/man3/tqmacstyle.3qt index 93b4a71c1..f3886234a 100644 --- a/doc/man/man3/tqmacstyle.3qt +++ b/doc/man/man3/tqmacstyle.3qt @@ -57,7 +57,7 @@ Layout - The restrictions on window layout are such that some aspects of layout Widget size - Aqua allows widgets to have specific fixed sizes. TQt does not fully implement this behaviour so as to maintain multiplatform compatibility. As a result some widgets sizes may be inappropriate (and subsequently not rendered correctly by the Appearance Manager).The TQWidget::sizeHint() will return the appropriate size for many managed widgets (widgets enumerated in TQStyle::ContentsType). .IP .TP -Effects - QMacStyle (in contrast to QAquaStyle) is not emulating (except where Appearance Manager does not provide certain capabilities), for example QPushButton pulsing effects. In this case a near matching emulation has been implemented, but naturally this will not be identical to the similar functionality built into the Appearance Manager. Please report any issues you see in effects or non-standard widgets. +Effects - QMacStyle (in contrast to QAquaStyle) is not emulating (except where Appearance Manager does not provide certain capabilities), for example TQPushButton pulsing effects. In this case a near matching emulation has been implemented, but naturally this will not be identical to the similar functionality built into the Appearance Manager. Please report any issues you see in effects or non-standard widgets. .IP .PP There are other issues that need to be considered in the feel of your application (including the general color scheme to match the Aqua colors). The Guidelines mentioned above will remain current with new advances and design suggestions for Mac OS X. @@ -73,7 +73,7 @@ This type is used to signify a widget's focus rectangle policy. .TP \fCQMacStyle::FocusDisabled\fR - never show a focus rectangle for the widget. .TP -\fCQMacStyle::FocusDefault\fR - show a focus rectangle when the widget has focus and the widget is a QSpinWidget, TQDateTimeEdit, QLineEdit, QListBox, QListView, editable TQTextEdit, or one of their subclasses. +\fCQMacStyle::FocusDefault\fR - show a focus rectangle when the widget has focus and the widget is a TQSpinWidget, TQDateTimeEdit, TQLineEdit, QListBox, QListView, editable TQTextEdit, or one of their subclasses. .SH "QMacStyle::WidgetSizePolicy" .TP \fCQMacStyle::SizeSmall\fR diff --git a/doc/man/man3/tqmainwindow.3qt b/doc/man/man3/tqmainwindow.3qt index d09ffec84..87b715d82 100644 --- a/doc/man/man3/tqmainwindow.3qt +++ b/doc/man/man3/tqmainwindow.3qt @@ -465,7 +465,7 @@ Adding dock windows, e.g. toolbars, to TQMainWindow's dock areas is straightforw .ce 1 .B "[Image Omitted]" .PP -See also TQToolBar, QDockWindow, TQStatusBar, TQAction, TQMenuBar, TQPopupMenu, TQToolTipGroup, QDialog, and Main Window and Related Classes. +See also TQToolBar, QDockWindow, TQStatusBar, TQAction, TQMenuBar, TQPopupMenu, TQToolTipGroup, TQDialog, and Main Window and Related Classes. .SS "Member Type Documentation" .SH "TQMainWindow::DockWindows" Right-clicking a dock area will pop-up the dock window menu (createDockWindowMenu() is called automatically). When called in code you can specify what items should appear on the menu with this enum. diff --git a/doc/man/man3/tqmenubar.3qt b/doc/man/man3/tqmenubar.3qt index 50e597908..394dad78e 100644 --- a/doc/man/man3/tqmenubar.3qt +++ b/doc/man/man3/tqmenubar.3qt @@ -447,7 +447,7 @@ Theoretically, any widget can be inserted into a popup menu. In practice, this o .PP If a widget is not focus-enabled (see TQWidget::isFocusEnabled()), the menu treats it as a separator; this means that the item is not selectable and will never get focus. In this way you can, for example, simply insert a TQLabel if you need a popup menu with a title. .PP -If the widget is focus-enabled it will get focus when the user traverses the popup menu with the arrow keys. If the widget does not accept \fCArrowUp\fR and \fCArrowDown\fR in its key event handler, the focus will move back to the menu when the respective arrow key is hit one more time. This works with a QLineEdit, for example. If the widget accepts the arrow key itself, it must also provide the possibility to put the focus back on the menu again by calling TQWidget::focusNextPrevChild(). Futhermore, if the embedded widget closes the menu when the user made a selection, this can be done safely by calling: +If the widget is focus-enabled it will get focus when the user traverses the popup menu with the arrow keys. If the widget does not accept \fCArrowUp\fR and \fCArrowDown\fR in its key event handler, the focus will move back to the menu when the respective arrow key is hit one more time. This works with a TQLineEdit, for example. If the widget accepts the arrow key itself, it must also provide the possibility to put the focus back on the menu again by calling TQWidget::focusNextPrevChild(). Futhermore, if the embedded widget closes the menu when the user made a selection, this can be done safely by calling: .PP .nf .br diff --git a/doc/man/man3/tqmenudata.3qt b/doc/man/man3/tqmenudata.3qt index 6a0d238f3..6966df77e 100644 --- a/doc/man/man3/tqmenudata.3qt +++ b/doc/man/man3/tqmenudata.3qt @@ -487,7 +487,7 @@ Theoretically, any widget can be inserted into a popup menu. In practice, this o .PP If a widget is not focus-enabled (see TQWidget::isFocusEnabled()), the menu treats it as a separator; this means that the item is not selectable and will never get focus. In this way you can, for example, simply insert a TQLabel if you need a popup menu with a title. .PP -If the widget is focus-enabled it will get focus when the user traverses the popup menu with the arrow keys. If the widget does not accept \fCArrowUp\fR and \fCArrowDown\fR in its key event handler, the focus will move back to the menu when the respective arrow key is hit one more time. This works with a QLineEdit, for example. If the widget accepts the arrow key itself, it must also provide the possibility to put the focus back on the menu again by calling TQWidget::focusNextPrevChild(). Futhermore, if the embedded widget closes the menu when the user made a selection, this can be done safely by calling: +If the widget is focus-enabled it will get focus when the user traverses the popup menu with the arrow keys. If the widget does not accept \fCArrowUp\fR and \fCArrowDown\fR in its key event handler, the focus will move back to the menu when the respective arrow key is hit one more time. This works with a TQLineEdit, for example. If the widget accepts the arrow key itself, it must also provide the possibility to put the focus back on the menu again by calling TQWidget::focusNextPrevChild(). Futhermore, if the embedded widget closes the menu when the user made a selection, this can be done safely by calling: .PP .nf .br diff --git a/doc/man/man3/tqmessagebox.3qt b/doc/man/man3/tqmessagebox.3qt index 0349f029d..903aa367c 100644 --- a/doc/man/man3/tqmessagebox.3qt +++ b/doc/man/man3/tqmessagebox.3qt @@ -11,7 +11,7 @@ QMessageBox \- Modal dialog with a short message, an icon, and some buttons .SH SYNOPSIS \fC#include \fR .PP -Inherits QDialog. +Inherits TQDialog. .PP .SS "Public Members" .in +1c @@ -421,7 +421,7 @@ QMessageBox has no signals or slots. .ce 1 .B "[Image Omitted]" .PP -See also QDialog, Isys on error messages, GUI Design Handbook: Message Box, and Dialog Classes. +See also TQDialog, Isys on error messages, GUI Design Handbook: Message Box, and Dialog Classes. .SS "Member Type Documentation" .SH "QMessageBox::Icon" This enum has the following values: @@ -442,7 +442,7 @@ Constructs a message box with no text and a button with the label" OK". .PP If \fIparent\fR is 0, the message box becomes an application-global modal dialog box. If \fIparent\fR is a widget, the message box becomes modal relative to \fIparent\fR. .PP -The \fIparent\fR and \fIname\fR arguments are passed to the QDialog constructor. +The \fIparent\fR and \fIname\fR arguments are passed to the TQDialog constructor. .SH "QMessageBox::QMessageBox ( const TQString & caption, const TQString & text, Icon icon, int button0, int button1, int button2, TQWidget * parent = 0, const char * name = 0, bool modal = TRUE, WFlags f = WStyle_DialogBorder )" Constructs a message box with a \fIcaption\fR, a \fItext\fR, an \fIicon\fR, and up to three buttons. .PP @@ -512,7 +512,7 @@ If \fIparent\fR is 0, the message box becomes an application-global modal dialog .PP If \fImodal\fR is TRUE the message box is modal; otherwise it is modeless. .PP -The \fIparent\fR, \fIname\fR, \fImodal\fR, and \fIf\fR arguments are passed to the QDialog constructor. +The \fIparent\fR, \fIname\fR, \fImodal\fR, and \fIf\fR arguments are passed to the TQDialog constructor. .PP See also caption, text, and icon. .SH "QMessageBox::~QMessageBox ()" @@ -548,7 +548,7 @@ See also QApplication::aboutTQt(). Examples: .)l action/application.cpp, application/application.cpp, chart/chartform.cpp, helpviewer/helpwindow.cpp, menu/menu.cpp, themes/themes.cpp, and trivial/trivial.cpp. .SH "void QMessageBox::adjustSize ()\fC [virtual]\fR" -Adjusts the size of the message box to fit the contents just before QDialog::exec() or QDialog::show() is called. +Adjusts the size of the message box to fit the contents just before TQDialog::exec() or TQDialog::show() is called. .PP This function will not be called if the message box has been explicitly resized before showing it. .PP diff --git a/doc/man/man3/tqmotifdialog.3qt b/doc/man/man3/tqmotifdialog.3qt index a8f99940c..cb2ad0816 100644 --- a/doc/man/man3/tqmotifdialog.3qt +++ b/doc/man/man3/tqmotifdialog.3qt @@ -7,13 +7,13 @@ .ad l .nh .SH NAME -QMotifDialog \- The QDialog API for Motif-based dialogs +QMotifDialog \- The TQDialog API for Motif-based dialogs .SH SYNOPSIS This class is part of the \fBQt Motif Extension\fR. .PP \fC#include \fR .PP -Inherits QDialog. +Inherits TQDialog. .PP .SS "Public Members" .in +1c @@ -54,7 +54,7 @@ Inherits QDialog. .SH DESCRIPTION This class is defined in the \fBQt Motif Extension\fR, which can be found in the \fCqt/extensions\fR directory. It is not included in the main TQt API. .PP -The QMotifDialog class provides the QDialog API for Motif-based dialogs. +The QMotifDialog class provides the TQDialog API for Motif-based dialogs. .PP QMotifDialog provides two separate modes of operation. The application programmer can use QMotifDialog with an existing Motif-based dialog and a TQWidget parent, or the application programmer can use QMotifDialog with a custom Qt-based dialog and a Motif-based parent. Modality continues to work as expected. .PP @@ -62,9 +62,9 @@ Motif-based dialogs must have a \fCShell\fR widget parent with a single child, d .PP The single child of the \fCShell\fR can be accessed using the dialog() member function \fIafter\fR it has been created. .PP -The acceptCallback() and rejectCallback() functions provide a convenient way to call QDialog::accept() and QDialog::reject() through callbacks. A pointer to the QMotifDialog should be passed as the \fCclient_data\fR argument to the callback. +The acceptCallback() and rejectCallback() functions provide a convenient way to call TQDialog::accept() and TQDialog::reject() through callbacks. A pointer to the QMotifDialog should be passed as the \fCclient_data\fR argument to the callback. .PP -The API and behavior QMotifDialog is identical to that of QDialog when using a custom Qt-based dialog with a Motif-based parent. The only difference is that a Motif-based \fIparent\fR argument is passed to the constructor, instead of a TQWidget parent. +The API and behavior QMotifDialog is identical to that of TQDialog when using a custom Qt-based dialog with a Motif-based parent. The only difference is that a Motif-based \fIparent\fR argument is passed to the constructor, instead of a TQWidget parent. .SS "Member Type Documentation" .SH "QMotifDialog::DialogType" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. @@ -96,7 +96,7 @@ This enum lists the predefined Motif dialog types. .SH "QMotifDialog::QMotifDialog ( DialogType dialogtype, Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP -Creates a QMotifDialog using one of the predefined Motif dialog types. The \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the QDialog constructor. +Creates a QMotifDialog using one of the predefined Motif dialog types. The \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the TQDialog constructor. .PP This constructor creates a Shell widget, which is a special subclass of XmDialogShell. The \fIparent\fR, \fIargs\fR and \fIargcount\fR arguments are passed to XtCreatePopupShell() when creating the subclass. You can access the Shell widget with the shell() member function. .PP @@ -108,7 +108,7 @@ See also DialogType, shell(), and dialog(). .SH "QMotifDialog::QMotifDialog ( Widget parent, ArgList args = NULL, Cardinal argcount = 0, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP -Creates a QMotifDialog which allows the application programmer to use the Motif-based \fIparent\fR for a custom QDialog. The \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the QDialog constructor. +Creates a QMotifDialog which allows the application programmer to use the Motif-based \fIparent\fR for a custom TQDialog. The \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the TQDialog constructor. .PP This constructor creates a Shell widget, which is a special subclass of XmDialogShell. The \fIargs\fR and \fIargcount\fR arguments are passed to XtCreatePopupShell() when creating the subclass. You can access the Shell widget with the shell() member function. .PP @@ -120,13 +120,13 @@ A dialog widget is not created by this constructor. Instead, you should create t .PP See also shell() and dialog(). .SH "QMotifDialog::QMotifDialog ( Widget parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" -Creates a QMotifDialog which allows the application programmer to use the Motif-based \fIparent\fR for a custom QDialog. The \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the QDialog constructor. +Creates a QMotifDialog which allows the application programmer to use the Motif-based \fIparent\fR for a custom TQDialog. The \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the TQDialog constructor. .PP This constructor creates a \fCShell\fR widget, which is a special subclass of \fCXmDialogShell\fR. You can access the \fCShell\fR widget with the shell() member function. .PP See also shell(). .SH "QMotifDialog::QMotifDialog ( TQWidget * parent, const char * name = 0, bool modal = FALSE, WFlags flags = 0 )" -Creates a QMotifDialog which allows the application programmer to use a TQWidget parent for an existing Motif-based dialog. The \fIparent\fR, \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the QDialog constructor. +Creates a QMotifDialog which allows the application programmer to use a TQWidget parent for an existing Motif-based dialog. The \fIparent\fR, \fIname\fR, \fImodal\fR and \fIflags\fR arguments are passed to the TQDialog constructor. .PP This constructor creates a \fCShell\fR widget, which is a special subclass of \fCXmDialogShell\fR. You can access the \fCShell\fR widget with the shell() member functon. .PP @@ -136,7 +136,7 @@ A dialog widget is not created by this constructor. Instead, you should create t .PP See also shell() and dialog(). .SH "QMotifDialog::~QMotifDialog ()\fC [virtual]\fR" -Destroys the QDialog, dialog widget and \fCShell\fR widget. +Destroys the TQDialog, dialog widget and \fCShell\fR widget. .SH "void QMotifDialog::acceptCallback ( Widget, XtPointer client_data, XtPointer )\fC [static]\fR" Convenient Xt/Motif callback to accept the QMotifDialog. .PP diff --git a/doc/man/man3/tqmotifwidget.3qt b/doc/man/man3/tqmotifwidget.3qt index 0f3c0c076..623544351 100644 --- a/doc/man/man3/tqmotifwidget.3qt +++ b/doc/man/man3/tqmotifwidget.3qt @@ -40,7 +40,7 @@ The QMotifWidget class provides the TQWidget API for Xt/Motif widgets. .PP QMotifWidget exists to provide a TQWidget that can act as a parent for any Xt/Motif widget. Since the QMotifWidget is a proper TQWidget, it can be used as a top-level widget (e.g. 0 parent) or as a child of any other TQWidget. Note: Since QMotifWidget acts as a parent for Xt/Motif widgets, you should not create TQWidgets with a QMotifWidget parent. .PP -An Xt/Motif widget with a top-level QMotifWidget parent can begin using the standard TQt dialogs and custom QDialogs while keeping the main Xt/Motif interface of the application. Using a QMotifWidget as the parent for the various QDialogs will ensure that modality and stacking works properly throughout the entire application. +An Xt/Motif widget with a top-level QMotifWidget parent can begin using the standard TQt dialogs and custom TQDialogs while keeping the main Xt/Motif interface of the application. Using a QMotifWidget as the parent for the various TQDialogs will ensure that modality and stacking works properly throughout the entire application. .PP Applications moving to TQt may have custom Xt/Motif widgets that will take time to rewrite with Qt. Such applications can use these custom widgets as QMotifWidget with TQWidget parents. This allows the application's interface to be replaced gradually. .PP diff --git a/doc/man/man3/tqobject.3qt b/doc/man/man3/tqobject.3qt index 64367ea3a..81f079cf3 100644 --- a/doc/man/man3/tqobject.3qt +++ b/doc/man/man3/tqobject.3qt @@ -304,7 +304,7 @@ You must use the TQ_SIGNAL() and TQ_SLOT() macros when specifying the \fIsignal\ .br TQLabel *label = new TQLabel; .br - QScrollBar *scroll = new QScrollBar; + TQScrollBar *scroll = new TQScrollBar; .br TQObject::connect( scroll, TQ_SIGNAL(valueChanged(int)), .br @@ -336,7 +336,7 @@ A signal can also be connected to another signal: .br private: .br - QPushButton *aButton; + TQPushButton *aButton; .br }; .br @@ -345,7 +345,7 @@ A signal can also be connected to another signal: .br { .br - aButton = new QPushButton( this ); + aButton = new TQPushButton( this ); .br connect( aButton, TQ_SIGNAL(clicked()), TQ_SIGNAL(myUsefulSignal()) ); .br @@ -583,7 +583,7 @@ Notice in the example above that unhandled events are passed to the base class's .PP See also installEventFilter(). .PP -Reimplemented in QAccel, QScrollView, and QSpinBox. +Reimplemented in QAccel, TQScrollView, and TQSpinBox. .SH "bool TQObject::highPriority () const" Returns TRUE if the object is a high-priority object, or FALSE if it is a standard-priority object. .PP @@ -606,9 +606,9 @@ Example: t->inherits( "QButton" ); // returns FALSE .br .br - // QScrollBar inherits TQWidget and QRangeControl + // TQScrollBar inherits TQWidget and QRangeControl .br - QScrollBar *s = new QScrollBar( 0 ); + TQScrollBar *s = new TQScrollBar( 0 ); .br s->inherits( "TQWidget" ); // returns TRUE .br @@ -690,7 +690,7 @@ And here's how to install it on two widgets: .br KeyPressEater *keyPressEater = new KeyPressEater( this ); .br - QPushButton *pushButton = new QPushButton( this ); + TQPushButton *pushButton = new TQPushButton( this ); .br QListView *listView = new QListView( this ); .br diff --git a/doc/man/man3/tqpixmapcache.3qt b/doc/man/man3/tqpixmapcache.3qt index df41068cc..7054206ec 100644 --- a/doc/man/man3/tqpixmapcache.3qt +++ b/doc/man/man3/tqpixmapcache.3qt @@ -18,7 +18,7 @@ The TQPixmapCache class provides an application-global cache for pixmaps. .PP This class is a tool for optimized drawing with TQPixmap. You can use it to store temporary pixmaps that are expensive to generate without using more storage space than cacheLimit(). Use insert() to insert pixmaps, find() to find them and clear() to empty the cache. .PP -For example, QRadioButton has a non-trivial visual representation so we don't want to regenerate a pixmap whenever a radio button is displayed or changes state. In the function QRadioButton::drawButton(), we do not draw the radio button directly. Instead, we first check the global pixmap cache for a pixmap with the key "$qt_radio_nnn_", where \fCnnn\fR is a numerical value that specifies the the radio button state. If a pixmap is found, we bitBlt() it onto the widget and return. Otherwise, we create a new pixmap, draw the radio button in the pixmap, and finally insert the pixmap in the global pixmap cache, using the key above. The bitBlt() is ten times faster than drawing the radio button. All radio buttons in the program share the cached pixmap since TQPixmapCache is application-global. +For example, TQRadioButton has a non-trivial visual representation so we don't want to regenerate a pixmap whenever a radio button is displayed or changes state. In the function TQRadioButton::drawButton(), we do not draw the radio button directly. Instead, we first check the global pixmap cache for a pixmap with the key "$qt_radio_nnn_", where \fCnnn\fR is a numerical value that specifies the the radio button state. If a pixmap is found, we bitBlt() it onto the widget and return. Otherwise, we create a new pixmap, draw the radio button in the pixmap, and finally insert the pixmap in the global pixmap cache, using the key above. The bitBlt() is ten times faster than drawing the radio button. All radio buttons in the program share the cached pixmap since TQPixmapCache is application-global. .PP TQPixmapCache contains no member data, only static functions to access the global pixmap cache. It creates an internal TQCache for caching the pixmaps. .PP diff --git a/doc/man/man3/tqpopupmenu.3qt b/doc/man/man3/tqpopupmenu.3qt index d17106a5e..f0dd47470 100644 --- a/doc/man/man3/tqpopupmenu.3qt +++ b/doc/man/man3/tqpopupmenu.3qt @@ -575,7 +575,7 @@ Theoretically, any widget can be inserted into a popup menu. In practice, this o .PP If a widget is not focus-enabled (see TQWidget::isFocusEnabled()), the menu treats it as a separator; this means that the item is not selectable and will never get focus. In this way you can, for example, simply insert a TQLabel if you need a popup menu with a title. .PP -If the widget is focus-enabled it will get focus when the user traverses the popup menu with the arrow keys. If the widget does not accept \fCArrowUp\fR and \fCArrowDown\fR in its key event handler, the focus will move back to the menu when the respective arrow key is hit one more time. This works with a QLineEdit, for example. If the widget accepts the arrow key itself, it must also provide the possibility to put the focus back on the menu again by calling TQWidget::focusNextPrevChild(). Futhermore, if the embedded widget closes the menu when the user made a selection, this can be done safely by calling: +If the widget is focus-enabled it will get focus when the user traverses the popup menu with the arrow keys. If the widget does not accept \fCArrowUp\fR and \fCArrowDown\fR in its key event handler, the focus will move back to the menu when the respective arrow key is hit one more time. This works with a TQLineEdit, for example. If the widget accepts the arrow key itself, it must also provide the possibility to put the focus back on the menu again by calling TQWidget::focusNextPrevChild(). Futhermore, if the embedded widget closes the menu when the user made a selection, this can be done safely by calling: .PP .nf .br diff --git a/doc/man/man3/tqprogressdialog.3qt b/doc/man/man3/tqprogressdialog.3qt index fb458da73..5d261d81b 100644 --- a/doc/man/man3/tqprogressdialog.3qt +++ b/doc/man/man3/tqprogressdialog.3qt @@ -11,7 +11,7 @@ QProgressDialog \- Feedback on the progress of a slow operation .SH SYNOPSIS \fC#include \fR .PP -Inherits QDialog. +Inherits TQDialog. .PP .SS "Public Members" .in +1c @@ -28,7 +28,7 @@ Inherits QDialog. .BI "void \fBsetLabel\fR ( TQLabel * label )" .br .ti -1c -.BI "void \fBsetCancelButton\fR ( QPushButton * cancelButton )" +.BI "void \fBsetCancelButton\fR ( TQPushButton * cancelButton )" .br .ti -1c .BI "void \fBsetBar\fR ( QProgressBar * bar )" @@ -237,7 +237,7 @@ In both modes the progress dialog may be customized by replacing the child widge .ce 1 .B "[Image Omitted]" .PP -See also QDialog, QProgressBar, GUI Design Handbook: Progress Indicator, and Dialog Classes. +See also TQDialog, QProgressBar, GUI Design Handbook: Progress Indicator, and Dialog Classes. .SH MEMBER FUNCTION DOCUMENTATION .SH "QProgressDialog::QProgressDialog ( TQWidget * creator = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )" Constructs a progress dialog. @@ -250,7 +250,7 @@ The cancel button text is (translated) "Cancel". .TP The total number of steps is 100. .PP -The \fIcreator\fR argument is the widget to use as the dialog's parent. The \fIname\fR, \fImodal\fR, and the widget flags, \fIf\fR, are passed to the QDialog::QDialog() constructor. If \fImodal\fR is FALSE (the default), you must have an event loop proceeding for any redrawing of the dialog to occur. If \fImodal\fR is TRUE, the dialog ensures that events are processed when needed. +The \fIcreator\fR argument is the widget to use as the dialog's parent. The \fIname\fR, \fImodal\fR, and the widget flags, \fIf\fR, are passed to the TQDialog::TQDialog() constructor. If \fImodal\fR is FALSE (the default), you must have an event loop proceeding for any redrawing of the dialog to occur. If \fImodal\fR is TRUE, the dialog ensures that events are processed when needed. .PP See also labelText, setLabel(), setCancelButtonText(), setCancelButton(), and totalSteps. .SH "QProgressDialog::QProgressDialog ( const TQString & labelText, const TQString & cancelButtonText, int totalSteps, TQWidget * creator = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )" @@ -262,7 +262,7 @@ The \fIcancelButtonText\fR is the text to display on the cancel button, or 0 if .PP The \fItotalSteps\fR is the total number of steps in the operation for which this progress dialog shows progress. For example, if the operation is to examine 50 files, this value would be 50. Before examining the first file, call setProgress(0). As each file is processed call setProgress(1), setProgress(2), etc., finally calling setProgress(50) after examining the last file. .PP -The \fIcreator\fR argument is the widget to use as the dialog's parent. The \fIname\fR, \fImodal\fR, and widget flags, \fIf\fR, are passed to the QDialog::QDialog() constructor. If \fImodal\fR is FALSE (the default), you will must have an event loop proceeding for any redrawing of the dialog to occur. If \fImodal\fR is TRUE, the dialog ensures that events are processed when needed. +The \fIcreator\fR argument is the widget to use as the dialog's parent. The \fIname\fR, \fImodal\fR, and widget flags, \fIf\fR, are passed to the TQDialog::TQDialog() constructor. If \fImodal\fR is FALSE (the default), you will must have an event loop proceeding for any redrawing of the dialog to occur. If \fImodal\fR is TRUE, the dialog ensures that events are processed when needed. .PP See also labelText, setLabel(), setCancelButtonText(), setCancelButton(), and totalSteps. .SH "QProgressDialog::~QProgressDialog ()" @@ -306,7 +306,7 @@ Sets whether the dialog gets hidden by reset() to \fIb\fR. See the "autoClose" p Sets whether the progress dialog calls reset() as soon as progress() equals totalSteps() to \fIb\fR. See the "autoReset" property for details. .SH "void QProgressDialog::setBar ( QProgressBar * bar )" Sets the progress bar widget to \fIbar\fR. The progress dialog resizes to fit. The progress dialog takes ownership of the progress \fIbar\fR which will be deleted when necessary, so do not use a progress bar allocated on the stack. -.SH "void QProgressDialog::setCancelButton ( QPushButton * cancelButton )" +.SH "void QProgressDialog::setCancelButton ( TQPushButton * cancelButton )" Sets the cancel button to the push button, \fIcancelButton\fR. The progress dialog takes ownership of this button which will be deleted when necessary, so do not pass the address of an object that is on the stack, i.e. use new() to create the button. .PP See also setCancelButtonText(). diff --git a/doc/man/man3/tqptrdict.3qt b/doc/man/man3/tqptrdict.3qt index ec5fb95c5..20b47f229 100644 --- a/doc/man/man3/tqptrdict.3qt +++ b/doc/man/man3/tqptrdict.3qt @@ -96,15 +96,15 @@ Example: TQPtrDict fields; // void* keys, char* values .br .br - QLineEdit *le1 = new QLineEdit( this ); + TQLineEdit *le1 = new TQLineEdit( this ); .br le1->setText( "Simpson" ); .br - QLineEdit *le2 = new QLineEdit( this ); + TQLineEdit *le2 = new TQLineEdit( this ); .br le2->setText( "Homer" ); .br - QLineEdit *le3 = new QLineEdit( this ); + TQLineEdit *le3 = new TQLineEdit( this ); .br le3->setText( "45" ); .br diff --git a/doc/man/man3/tqptrdictiterator.3qt b/doc/man/man3/tqptrdictiterator.3qt index e5a8e7448..253395f8d 100644 --- a/doc/man/man3/tqptrdictiterator.3qt +++ b/doc/man/man3/tqptrdictiterator.3qt @@ -59,15 +59,15 @@ Example: TQPtrDict fields; .br .br - QLineEdit *le1 = new QLineEdit( this ); + TQLineEdit *le1 = new TQLineEdit( this ); .br le1->setText( "Simpson" ); .br - QLineEdit *le2 = new QLineEdit( this ); + TQLineEdit *le2 = new TQLineEdit( this ); .br le2->setText( "Homer" ); .br - QLineEdit *le3 = new QLineEdit( this ); + TQLineEdit *le3 = new TQLineEdit( this ); .br le3->setText( "45" ); .br @@ -83,7 +83,7 @@ Example: .br for( ; it.current(); ++it ) { .br - QLineEdit *le = (QLineEdit)it.currentKey(); + TQLineEdit *le = (TQLineEdit)it.currentKey(); .br cout << it.current() << ": " << le->text() << endl; .br diff --git a/doc/man/man3/tqpushbutton.3qt b/doc/man/man3/tqpushbutton.3qt index 7ac93748c..082e51d84 100644 --- a/doc/man/man3/tqpushbutton.3qt +++ b/doc/man/man3/tqpushbutton.3qt @@ -1,5 +1,5 @@ '\" t -.TH QPushButton 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQPushButton 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,25 +7,25 @@ .ad l .nh .SH NAME -QPushButton \- Command button +TQPushButton \- Command button .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP Inherits QButton. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQPushButton\fR ( TQWidget * parent, const char * name = 0 )" +.BI "\fBTQPushButton\fR ( TQWidget * parent, const char * name = 0 )" .br .ti -1c -.BI "\fBQPushButton\fR ( const TQString & text, TQWidget * parent, const char * name = 0 )" +.BI "\fBTQPushButton\fR ( const TQString & text, TQWidget * parent, const char * name = 0 )" .br .ti -1c -.BI "\fBQPushButton\fR ( const TQIconSet & icon, const TQString & text, TQWidget * parent, const char * name = 0 )" +.BI "\fBTQPushButton\fR ( const TQIconSet & icon, const TQString & text, TQWidget * parent, const char * name = 0 )" .br .ti -1c -.BI "\fB~QPushButton\fR ()" +.BI "\fB~TQPushButton\fR ()" .br .ti -1c .BI "void \fBsetToggleButton\fR ( bool )" @@ -167,7 +167,7 @@ Inherits QButton. .br .in -1c .SH DESCRIPTION -The QPushButton widget provides a command button. +The TQPushButton widget provides a command button. .PP The push button, or command button, is perhaps the most commonly used widget in any graphical user interface. Push (click) a button to command the computer to perform some action, or to answer a question. Typical buttons are OK, Apply, Cancel, Close, Yes, No and Help. .PP @@ -175,7 +175,7 @@ A command button is rectangular and typically displays a text label describing i .PP .nf .br - QPushButton *pb = new QPushButton( "&Download", this ); + TQPushButton *pb = new TQPushButton( "&Download", this ); .br .fi In this example the accelerator is \fIAlt+D\fR, and the label text will be displayed as \fBDownload\fR. @@ -208,7 +208,7 @@ If you need toggle behavior (see setToggleButton()) or a button that auto-repeat .PP A variation of a command button is a menu button. These provide not just one command, but several, since when they are clicked they pop up a menu of options. Use the method setPopup() to associate a popup menu with a push button. .PP -Other classes of buttons are option buttons (see QRadioButton) and check boxes (see QCheckBox). +Other classes of buttons are option buttons (see TQRadioButton) and check boxes (see TQCheckBox). .PP .ce 1 .B "[Image Omitted]" @@ -217,27 +217,27 @@ Other classes of buttons are option buttons (see QRadioButton) and check boxes ( .ce 1 .B "[Image Omitted]" .PP -In Qt, the QButton abstract base class provides most of the modes and other API, and QPushButton provides GUI logic. See QButton for more information about the API. +In Qt, the QButton abstract base class provides most of the modes and other API, and TQPushButton provides GUI logic. See QButton for more information about the API. .PP -See also TQToolButton, QRadioButton, QCheckBox, GUI Design Handbook: Push Button, and Basic Widgets. +See also TQToolButton, TQRadioButton, TQCheckBox, GUI Design Handbook: Push Button, and Basic Widgets. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QPushButton::QPushButton ( TQWidget * parent, const char * name = 0 )" +.SH "TQPushButton::TQPushButton ( TQWidget * parent, const char * name = 0 )" Constructs a push button with no text. .PP The \fIparent\fR and \fIname\fR arguments are sent on to the TQWidget constructor. -.SH "QPushButton::QPushButton ( const TQString & text, TQWidget * parent, const char * name = 0 )" +.SH "TQPushButton::TQPushButton ( const TQString & text, TQWidget * parent, const char * name = 0 )" Constructs a push button called \fIname\fR with the parent \fIparent\fR and the text \fItext\fR. -.SH "QPushButton::QPushButton ( const TQIconSet & icon, const TQString & text, TQWidget * parent, const char * name = 0 )" +.SH "TQPushButton::TQPushButton ( const TQIconSet & icon, const TQString & text, TQWidget * parent, const char * name = 0 )" Constructs a push button with an \fIicon\fR and a \fItext\fR. .PP Note that you can also pass a TQPixmap object as an icon (thanks to the implicit type conversion provided by C++). .PP The \fIparent\fR and \fIname\fR arguments are sent to the TQWidget constructor. -.SH "QPushButton::~QPushButton ()" +.SH "TQPushButton::~TQPushButton ()" Destroys the push button. .SH "QKeySequence QButton::accel () const" Returns the accelerator associated with the button. See the "accel" property for details. -.SH "bool QPushButton::autoDefault () const" +.SH "bool TQPushButton::autoDefault () const" Returns TRUE if the push button is the auto default button; otherwise returns FALSE. See the "autoDefault" property for details. .SH "bool QButton::autoRepeat () const" Returns TRUE if autoRepeat is enabled; otherwise returns FALSE. See the "autoRepeat" property for details. @@ -258,17 +258,17 @@ Returns the group that this button belongs to. If the button is not a member of any QButtonGroup, this function returns 0. .PP See also QButtonGroup. -.SH "TQIconSet * QPushButton::iconSet () const" +.SH "TQIconSet * TQPushButton::iconSet () const" Returns the icon set on the push button. See the "iconSet" property for details. -.SH "bool QPushButton::isDefault () const" +.SH "bool TQPushButton::isDefault () const" Returns TRUE if the push button is the default button; otherwise returns FALSE. See the "default" property for details. .SH "bool QButton::isDown () const" Returns TRUE if the button is pressed; otherwise returns FALSE. See the "down" property for details. .SH "bool QButton::isExclusiveToggle () const" Returns TRUE if the button is an exclusive toggle; otherwise returns FALSE. See the "exclusiveToggle" property for details. -.SH "bool QPushButton::isFlat () const" +.SH "bool TQPushButton::isFlat () const" Returns TRUE if the border is disabled; otherwise returns FALSE. See the "flat" property for details. -.SH "bool QPushButton::isMenuButton () const" +.SH "bool TQPushButton::isMenuButton () const" Returns TRUE if the push button has a menu button on it; otherwise returns FALSE. See the "menuButton" property for details. .SH "bool QButton::isOn () const" Returns TRUE if the button is toggled; otherwise returns FALSE. See the "on" property for details. @@ -276,7 +276,7 @@ Returns TRUE if the button is toggled; otherwise returns FALSE. See the "on" pro Returns TRUE if the button is a toggle button; otherwise returns FALSE. See the "toggleButton" property for details. .SH "const TQPixmap * QButton::pixmap () const" Returns the pixmap shown on the button. See the "pixmap" property for details. -.SH "TQPopupMenu * QPushButton::popup () const" +.SH "TQPopupMenu * TQPushButton::popup () const" Returns the button's associated popup menu or 0 if no popup menu has been set. .PP See also setPopup(). @@ -293,25 +293,25 @@ This signal is emitted when the button is released. See also pressed(), clicked(), and toggled(). .SH "void QButton::setAccel ( const QKeySequence & )\fC [virtual]\fR" Sets the accelerator associated with the button. See the "accel" property for details. -.SH "void QPushButton::setAutoDefault ( bool autoDef )\fC [virtual]\fR" +.SH "void TQPushButton::setAutoDefault ( bool autoDef )\fC [virtual]\fR" Sets whether the push button is the auto default button to \fIautoDef\fR. See the "autoDefault" property for details. .SH "void QButton::setAutoRepeat ( bool )\fC [virtual]\fR" Sets whether autoRepeat is enabled. See the "autoRepeat" property for details. -.SH "void QPushButton::setDefault ( bool def )\fC [virtual]\fR" +.SH "void TQPushButton::setDefault ( bool def )\fC [virtual]\fR" Sets whether the push button is the default button to \fIdef\fR. See the "default" property for details. .SH "void QButton::setDown ( bool )\fC [virtual]\fR" Sets whether the button is pressed. See the "down" property for details. -.SH "void QPushButton::setFlat ( bool )" +.SH "void TQPushButton::setFlat ( bool )" Sets whether the border is disabled. See the "flat" property for details. -.SH "void QPushButton::setIconSet ( const TQIconSet & )" +.SH "void TQPushButton::setIconSet ( const TQIconSet & )" Sets the icon set on the push button. See the "iconSet" property for details. -.SH "void QPushButton::setIsMenuButton ( bool enable )\fC [virtual]\fR" +.SH "void TQPushButton::setIsMenuButton ( bool enable )\fC [virtual]\fR" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. -.SH "void QPushButton::setOn ( bool )\fC [virtual slot]\fR" +.SH "void TQPushButton::setOn ( bool )\fC [virtual slot]\fR" Sets whether the push button is toggled. See the "on" property for details. .SH "void QButton::setPixmap ( const TQPixmap & )\fC [virtual]\fR" Sets the pixmap shown on the button. See the "pixmap" property for details. -.SH "void QPushButton::setPopup ( TQPopupMenu * popup )" +.SH "void TQPushButton::setPopup ( TQPopupMenu * popup )" Associates the popup menu \fIpopup\fR with this push button. This turns the button into a menu button. .PP Ownership of the popup menu is \fInot\fR transferred to the push button. @@ -322,7 +322,7 @@ Examples: .)l buttongroups/buttongroups.cpp and tqdir/tqdir.cpp. .SH "void QButton::setText ( const TQString & )\fC [virtual]\fR" Sets the text shown on the button. See the "text" property for details. -.SH "void QPushButton::setToggleButton ( bool )" +.SH "void TQPushButton::setToggleButton ( bool )" Sets whether the button is a toggle button. See the "toggleButton" property for details. .SH "ToggleState QButton::state () const" Returns the state of the toggle button. See the "toggleState" property for details. @@ -360,7 +360,7 @@ If this property is set to TRUE then the push button is the auto default button .PP In some GUI styles a default button is drawn with an extra frame around it, up to 3 pixels or more. TQt automatically keeps this space free around auto-default buttons, i.e. auto-default buttons may have a slightly larger size hint. .PP -This property's default is TRUE for buttons that have a QDialog parent; otherwise it defaults to FALSE. +This property's default is TRUE for buttons that have a TQDialog parent; otherwise it defaults to FALSE. .PP See the default property for details of how default and auto-default interact. .PP @@ -443,7 +443,7 @@ See also on, toggle(), toggleButton, and toggled(). Set this property's value with setToggleButton(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqpushbutton.html +.BR http://doc.trolltech.com/tqpushbutton.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqradiobutton.3qt b/doc/man/man3/tqradiobutton.3qt index 3bd8f0833..e7d50575d 100644 --- a/doc/man/man3/tqradiobutton.3qt +++ b/doc/man/man3/tqradiobutton.3qt @@ -1,5 +1,5 @@ '\" t -.TH QRadioButton 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQRadioButton 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,19 +7,19 @@ .ad l .nh .SH NAME -QRadioButton \- Radio button with a text or pixmap label +TQRadioButton \- Radio button with a text or pixmap label .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP Inherits QButton. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQRadioButton\fR ( TQWidget * parent, const char * name = 0 )" +.BI "\fBTQRadioButton\fR ( TQWidget * parent, const char * name = 0 )" .br .ti -1c -.BI "\fBQRadioButton\fR ( const TQString & text, TQWidget * parent, const char * name = 0 )" +.BI "\fBTQRadioButton\fR ( const TQString & text, TQWidget * parent, const char * name = 0 )" .br .ti -1c .BI "bool \fBisChecked\fR () const" @@ -107,15 +107,15 @@ Inherits QButton. .br .in -1c .SH DESCRIPTION -The QRadioButton widget provides a radio button with a text or pixmap label. +The TQRadioButton widget provides a radio button with a text or pixmap label. .PP -QRadioButton and QCheckBox are both option buttons. That is, they can be switched on (checked) or off (unchecked). The classes differ in how the choices for the user are restricted. Check boxes define "many of many" choices, whereas radio buttons provide a" one of many" choice. In a group of radio buttons only one radio button at a time can be checked; if the user selects another button, the previously selected button is switched off. +TQRadioButton and TQCheckBox are both option buttons. That is, they can be switched on (checked) or off (unchecked). The classes differ in how the choices for the user are restricted. Check boxes define "many of many" choices, whereas radio buttons provide a" one of many" choice. In a group of radio buttons only one radio button at a time can be checked; if the user selects another button, the previously selected button is switched off. .PP The easiest way to implement a "one of many" choice is simply to put the radio buttons into QButtonGroup. .PP Whenever a button is switched on or off it emits the signal toggled(). Connect to this signal if you want to trigger an action each time the button changes state. Otherwise, use isChecked() to see if a particular button is selected. .PP -Just like QPushButton, a radio button can display text or a pixmap. The text can be set in the constructor or with setText(); the pixmap is set with setPixmap(). +Just like TQPushButton, a radio button can display text or a pixmap. The text can be set in the constructor or with setText(); the pixmap is set with setPixmap(). .PP .ce 1 .B "[Image Omitted]" @@ -124,13 +124,13 @@ Just like QPushButton, a radio button can display text or a pixmap. The text can .ce 1 .B "[Image Omitted]" .PP -See also QPushButton, TQToolButton, GUI Design Handbook: Radio Button, and Basic Widgets. +See also TQPushButton, TQToolButton, GUI Design Handbook: Radio Button, and Basic Widgets. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QRadioButton::QRadioButton ( TQWidget * parent, const char * name = 0 )" +.SH "TQRadioButton::TQRadioButton ( TQWidget * parent, const char * name = 0 )" Constructs a radio button with no text. .PP The \fIparent\fR and \fIname\fR arguments are sent on to the TQWidget constructor. -.SH "QRadioButton::QRadioButton ( const TQString & text, TQWidget * parent, const char * name = 0 )" +.SH "TQRadioButton::TQRadioButton ( const TQString & text, TQWidget * parent, const char * name = 0 )" Constructs a radio button with the text \fItext\fR. .PP The \fIparent\fR and \fIname\fR arguments are sent on to the TQWidget constructor. @@ -155,7 +155,7 @@ Returns the group that this button belongs to. If the button is not a member of any QButtonGroup, this function returns 0. .PP See also QButtonGroup. -.SH "bool QRadioButton::isChecked () const" +.SH "bool TQRadioButton::isChecked () const" Returns TRUE if the radio button is checked; otherwise returns FALSE. See the "checked" property for details. .SH "bool QButton::isDown () const" Returns TRUE if the button is pressed; otherwise returns FALSE. See the "down" property for details. @@ -182,7 +182,7 @@ See also pressed(), clicked(), and toggled(). Sets the accelerator associated with the button. See the "accel" property for details. .SH "void QButton::setAutoRepeat ( bool )\fC [virtual]\fR" Sets whether autoRepeat is enabled. See the "autoRepeat" property for details. -.SH "void QRadioButton::setChecked ( bool check )\fC [virtual slot]\fR" +.SH "void TQRadioButton::setChecked ( bool check )\fC [virtual slot]\fR" Sets whether the radio button is checked to \fIcheck\fR. See the "checked" property for details. .SH "void QButton::setDown ( bool )\fC [virtual]\fR" Sets whether the button is pressed. See the "down" property for details. @@ -253,7 +253,7 @@ There is no default text. Set this property's value with setText() and get this property's value with text(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqradiobutton.html +.BR http://doc.trolltech.com/tqradiobutton.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqrangecontrol.3qt b/doc/man/man3/tqrangecontrol.3qt index 317ffb139..681b8f1ce 100644 --- a/doc/man/man3/tqrangecontrol.3qt +++ b/doc/man/man3/tqrangecontrol.3qt @@ -11,7 +11,7 @@ QRangeControl \- Integer value within a range .SH SYNOPSIS \fC#include \fR .PP -Inherited by QDial, QScrollBar, QSlider, and QSpinBox. +Inherited by TQDial, TQScrollBar, TQSlider, and TQSpinBox. .PP .SS "Public Members" .in +1c @@ -97,7 +97,7 @@ Inherited by QDial, QScrollBar, QSlider, and QSpinBox. .SH DESCRIPTION The QRangeControl class provides an integer value within a range. .PP -Although originally designed for the QScrollBar widget, the QRangeControl can also be used in conjunction with other widgets such as QSlider and QSpinBox. Here are the five main concepts in the class: +Although originally designed for the TQScrollBar widget, the QRangeControl can also be used in conjunction with other widgets such as TQSlider and TQSpinBox. Here are the five main concepts in the class: .PP
            .IP 1 @@ -177,7 +177,7 @@ Converts \fIlogical_val\fR to a pixel position. minValue() maps to 0, maxValue() .PP This function can handle the entire integer range without overflow, providing \fIspan\fR is <= 4096. .PP -Calling this method is useful when actually drawing a range control such as a QScrollBar on-screen. +Calling this method is useful when actually drawing a range control such as a TQScrollBar on-screen. .PP See also valueFromPosition(). .SH "int QRangeControl::prevValue () const\fC [protected]\fR" @@ -193,7 +193,7 @@ Note that this method is called after the range has changed. .PP See also setRange(), valueChange(), and stepChange(). .PP -Reimplemented in QDial, QSlider, and QSpinBox. +Reimplemented in TQDial, TQSlider, and TQSpinBox. .SH "void QRangeControl::setMaxValue ( int maxVal )" Sets the minimum value of the range to \fImaxVal\fR. .PP @@ -258,13 +258,13 @@ Note that this method is called after the value has changed. The previous value .PP See also setValue(), addPage(), subtractPage(), addLine(), subtractLine(), rangeChange(), and stepChange(). .PP -Reimplemented in QDial, QSlider, and QSpinBox. +Reimplemented in TQDial, TQSlider, and TQSpinBox. .SH "int QRangeControl::valueFromPosition ( int pos, int span ) const\fC [protected]\fR" Converts the pixel position \fIpos\fR to a value. 0 maps to minValue(), \fIspan\fR maps to maxValue() and other values are distributed evenly in-between. .PP This function can handle the entire integer range without overflow. .PP -Calling this method is useful if you actually implemented a range control widget such as QScrollBar and want to handle mouse press events. This function then maps screen coordinates to the logical values. +Calling this method is useful if you actually implemented a range control widget such as TQScrollBar and want to handle mouse press events. This function then maps screen coordinates to the logical values. .PP See also positionFromValue(). diff --git a/doc/man/man3/tqregexpvalidator.3qt b/doc/man/man3/tqregexpvalidator.3qt index ceac7a236..a567f4952 100644 --- a/doc/man/man3/tqregexpvalidator.3qt +++ b/doc/man/man3/tqregexpvalidator.3qt @@ -54,7 +54,7 @@ Example of use: QValidator* validator = new TQRegExpValidator( rx, this ); .br .br - QLineEdit* edit = new QLineEdit( this ); + TQLineEdit* edit = new TQLineEdit( this ); .br edit->setValidator( validator ); .br diff --git a/doc/man/man3/tqscrollbar.3qt b/doc/man/man3/tqscrollbar.3qt index ab64ac032..c8d0dc37d 100644 --- a/doc/man/man3/tqscrollbar.3qt +++ b/doc/man/man3/tqscrollbar.3qt @@ -1,5 +1,5 @@ '\" t -.TH QScrollBar 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQScrollBar 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,25 +7,25 @@ .ad l .nh .SH NAME -QScrollBar \- Vertical or horizontal scroll bar +TQScrollBar \- Vertical or horizontal scroll bar .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP Inherits TQWidget and QRangeControl. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQScrollBar\fR ( TQWidget * parent, const char * name = 0 )" +.BI "\fBTQScrollBar\fR ( TQWidget * parent, const char * name = 0 )" .br .ti -1c -.BI "\fBQScrollBar\fR ( Orientation orientation, TQWidget * parent, const char * name = 0 )" +.BI "\fBTQScrollBar\fR ( Orientation orientation, TQWidget * parent, const char * name = 0 )" .br .ti -1c -.BI "\fBQScrollBar\fR ( int minValue, int maxValue, int lineStep, int pageStep, int value, Orientation orientation, TQWidget * parent, const char * name = 0 )" +.BI "\fBTQScrollBar\fR ( int minValue, int maxValue, int lineStep, int pageStep, int value, Orientation orientation, TQWidget * parent, const char * name = 0 )" .br .ti -1c -.BI "\fB~QScrollBar\fR ()" +.BI "\fB~TQScrollBar\fR ()" .br .ti -1c .BI "virtual void \fBsetOrientation\fR ( Orientation )" @@ -146,7 +146,7 @@ Inherits TQWidget and QRangeControl. .br .in -1c .SH DESCRIPTION -The QScrollBar widget provides a vertical or horizontal scroll bar. +The TQScrollBar widget provides a vertical or horizontal scroll bar. .PP A scroll bar allows the user to control a value within a program-definable range and gives users a visible indication of the current value of a range control. .PP @@ -162,22 +162,22 @@ The \fIslider\fR is the handle that indicates the current value of the scroll ba The \fIpage-up/page-down\fR control is the area on which the slider slides (the scroll bar's background). Clicking here moves the scroll bar towards the click. The meaning of "page" is also configurable: in editors and list boxes it means as many lines as there is space for in the widget. .IP .PP -QScrollBar has very few of its own functions; it mostly relies on QRangeControl. The most useful functions are setValue() to set the scroll bar directly to some value; addPage(), addLine(), subtractPage(), and subtractLine() to simulate the effects of clicking (useful for accelerator keys); setSteps() to define the values of pageStep() and lineStep(); and setRange() to set the minValue() and maxValue() of the scroll bar. QScrollBar has a convenience constructor with which you can set most of these properties. +TQScrollBar has very few of its own functions; it mostly relies on QRangeControl. The most useful functions are setValue() to set the scroll bar directly to some value; addPage(), addLine(), subtractPage(), and subtractLine() to simulate the effects of clicking (useful for accelerator keys); setSteps() to define the values of pageStep() and lineStep(); and setRange() to set the minValue() and maxValue() of the scroll bar. TQScrollBar has a convenience constructor with which you can set most of these properties. .PP Some GUI styles (for example, the Windows and Motif styles provided with Qt), also use the pageStep() value to calculate the size of the slider. .PP -In addition to the access functions from QRangeControl, QScrollBar provides a comprehensive set of signals:
            .nf +In addition to the access functions from QRangeControl, TQScrollBar provides a comprehensive set of signals:
            .nf .TS l - l. Signal Emitted when valueChanged() the scroll bar's value has changed. The tracking() determines whether this signal is emitted during user interaction. sliderPressed() the user starts to drag the slider. sliderMoved() the user drags the slider. sliderReleased() the user releases the slider. nextLine() the scroll bar has moved one line down or right. Line is defined in QRangeControl. prevLine() the scroll bar has moved one line up or left. nextPage() the scroll bar has moved one page down or right. prevPage() .TE .fi
            .PP -QScrollBar only provides integer ranges. Note that although QScrollBar handles very large numbers, scroll bars on current screens cannot usefully control ranges above about 100,000 pixels. Beyond that, it becomes difficult for the user to control the scroll bar using either the keyboard or the mouse. +TQScrollBar only provides integer ranges. Note that although TQScrollBar handles very large numbers, scroll bars on current screens cannot usefully control ranges above about 100,000 pixels. Beyond that, it becomes difficult for the user to control the scroll bar using either the keyboard or the mouse. .PP A scroll bar can be controlled by the keyboard, but it has a default focusPolicy() of NoFocus. Use setFocusPolicy() to enable keyboard focus. See keyPressEvent() for a list of key bindings. .PP -If you need to add scroll bars to an interface, consider using the QScrollView class, which encapsulates the common uses for scroll bars. +If you need to add scroll bars to an interface, consider using the TQScrollView class, which encapsulates the common uses for scroll bars. .PP .ce 1 .B "[Image Omitted]" @@ -186,15 +186,15 @@ If you need to add scroll bars to an interface, consider using the QScrollView c .ce 1 .B "[Image Omitted]" .PP -See also QSlider, QSpinBox, QScrollView, GUI Design Handbook: Scroll Bar, and Basic Widgets. +See also TQSlider, TQSpinBox, TQScrollView, GUI Design Handbook: Scroll Bar, and Basic Widgets. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QScrollBar::QScrollBar ( TQWidget * parent, const char * name = 0 )" +.SH "TQScrollBar::TQScrollBar ( TQWidget * parent, const char * name = 0 )" Constructs a vertical scroll bar. .PP The \fIparent\fR and \fIname\fR arguments are sent on to the TQWidget constructor. .PP The minValue defaults to 0, the maxValue to 99, with a lineStep size of 1 and a pageStep size of 10, and an initial value of 0. -.SH "QScrollBar::QScrollBar ( Orientation orientation, TQWidget * parent, const char * name = 0 )" +.SH "TQScrollBar::TQScrollBar ( Orientation orientation, TQWidget * parent, const char * name = 0 )" Constructs a scroll bar. .PP The \fIorientation\fR must be TQt::Vertical or TQt::Horizontal. @@ -202,81 +202,81 @@ The \fIorientation\fR must be TQt::Vertical or TQt::Horizontal. The \fIparent\fR and \fIname\fR arguments are sent on to the TQWidget constructor. .PP The minValue defaults to 0, the maxValue to 99, with a lineStep size of 1 and a pageStep size of 10, and an initial value of 0. -.SH "QScrollBar::QScrollBar ( int minValue, int maxValue, int lineStep, int pageStep, int value, Orientation orientation, TQWidget * parent, const char * name = 0 )" +.SH "TQScrollBar::TQScrollBar ( int minValue, int maxValue, int lineStep, int pageStep, int value, Orientation orientation, TQWidget * parent, const char * name = 0 )" Constructs a scroll bar whose value can never be smaller than \fIminValue\fR or greater than \fImaxValue\fR, whose line step size is \fIlineStep\fR and page step size is \fIpageStep\fR and whose value is initially \fIvalue\fR (which is guaranteed to be in range using bound()). .PP If \fIorientation\fR is Vertical the scroll bar is vertical and if it is Horizontal the scroll bar is horizontal. .PP The \fIparent\fR and \fIname\fR arguments are sent on to the TQWidget constructor. -.SH "QScrollBar::~QScrollBar ()" +.SH "TQScrollBar::~TQScrollBar ()" Destructor. -.SH "bool QScrollBar::draggingSlider () const" +.SH "bool TQScrollBar::draggingSlider () const" Returns TRUE if the user has clicked the mouse on the slider and is currently dragging it; otherwise returns FALSE. See the "draggingSlider" property for details. -.SH "void QScrollBar::hideEvent ( QHideEvent * )\fC [virtual protected]\fR" +.SH "void TQScrollBar::hideEvent ( QHideEvent * )\fC [virtual protected]\fR" This function is called when the scrollbar is hidden. .PP Reimplemented from TQWidget. -.SH "int QScrollBar::lineStep () const" +.SH "int TQScrollBar::lineStep () const" Returns the line step. See the "lineStep" property for details. -.SH "int QScrollBar::maxValue () const" +.SH "int TQScrollBar::maxValue () const" Returns the scroll bar's maximum value. See the "maxValue" property for details. -.SH "int QScrollBar::minValue () const" +.SH "int TQScrollBar::minValue () const" Returns the scroll bar's minimum value. See the "minValue" property for details. -.SH "void QScrollBar::nextLine ()\fC [signal]\fR" +.SH "void TQScrollBar::nextLine ()\fC [signal]\fR" This signal is emitted when the scroll bar scrolls one line down or right. -.SH "void QScrollBar::nextPage ()\fC [signal]\fR" +.SH "void TQScrollBar::nextPage ()\fC [signal]\fR" This signal is emitted when the scroll bar scrolls one page down or right. -.SH "Orientation QScrollBar::orientation () const" +.SH "Orientation TQScrollBar::orientation () const" Returns the orientation of the scroll bar. See the "orientation" property for details. -.SH "int QScrollBar::pageStep () const" +.SH "int TQScrollBar::pageStep () const" Returns the page step. See the "pageStep" property for details. -.SH "void QScrollBar::prevLine ()\fC [signal]\fR" +.SH "void TQScrollBar::prevLine ()\fC [signal]\fR" This signal is emitted when the scroll bar scrolls one line up or left. -.SH "void QScrollBar::prevPage ()\fC [signal]\fR" +.SH "void TQScrollBar::prevPage ()\fC [signal]\fR" This signal is emitted when the scroll bar scrolls one page up or left. -.SH "void QScrollBar::setLineStep ( int )" +.SH "void TQScrollBar::setLineStep ( int )" Sets the line step. See the "lineStep" property for details. -.SH "void QScrollBar::setMaxValue ( int )" +.SH "void TQScrollBar::setMaxValue ( int )" Sets the scroll bar's maximum value. See the "maxValue" property for details. -.SH "void QScrollBar::setMinValue ( int )" +.SH "void TQScrollBar::setMinValue ( int )" Sets the scroll bar's minimum value. See the "minValue" property for details. -.SH "void QScrollBar::setOrientation ( Orientation )\fC [virtual]\fR" +.SH "void TQScrollBar::setOrientation ( Orientation )\fC [virtual]\fR" Sets the orientation of the scroll bar. See the "orientation" property for details. -.SH "void QScrollBar::setPageStep ( int )" +.SH "void TQScrollBar::setPageStep ( int )" Sets the page step. See the "pageStep" property for details. -.SH "void QScrollBar::setPalette ( const TQPalette & p )\fC [virtual]\fR" +.SH "void TQScrollBar::setPalette ( const TQPalette & p )\fC [virtual]\fR" Reimplements the virtual function TQWidget::setPalette(). .PP Sets the background color to the mid color for Motif style scroll bars using palette \fIp\fR. .PP Reimplemented from TQWidget. -.SH "void QScrollBar::setTracking ( bool enable )\fC [virtual]\fR" +.SH "void TQScrollBar::setTracking ( bool enable )\fC [virtual]\fR" Sets whether scroll bar tracking is enabled to \fIenable\fR. See the "tracking" property for details. -.SH "void QScrollBar::setValue ( int )\fC [slot]\fR" +.SH "void TQScrollBar::setValue ( int )\fC [slot]\fR" Sets the scroll bar's value. See the "value" property for details. -.SH "void QScrollBar::sliderMoved ( int value )\fC [signal]\fR" +.SH "void TQScrollBar::sliderMoved ( int value )\fC [signal]\fR" This signal is emitted when the slider is dragged by the user, with the new scroll bar \fIvalue\fR as an argument. .PP This signal is emitted even when tracking is turned off. .PP See also tracking, valueChanged(), nextLine(), prevLine(), nextPage(), and prevPage(). -.SH "void QScrollBar::sliderPressed ()\fC [signal]\fR" +.SH "void TQScrollBar::sliderPressed ()\fC [signal]\fR" This signal is emitted when the user presses the slider with the mouse. -.SH "TQRect QScrollBar::sliderRect () const" +.SH "TQRect TQScrollBar::sliderRect () const" Returns the scroll bar slider rectangle. .PP See also sliderStart(). -.SH "void QScrollBar::sliderReleased ()\fC [signal]\fR" +.SH "void TQScrollBar::sliderReleased ()\fC [signal]\fR" This signal is emitted when the user releases the slider with the mouse. -.SH "int QScrollBar::sliderStart () const" +.SH "int TQScrollBar::sliderStart () const" Returns the pixel position where the scroll bar slider starts. .PP This is equivalent to sliderRect().y() for vertical scroll bars or sliderRect().x() for horizontal scroll bars. -.SH "bool QScrollBar::tracking () const" +.SH "bool TQScrollBar::tracking () const" Returns TRUE if scroll bar tracking is enabled; otherwise returns FALSE. See the "tracking" property for details. -.SH "int QScrollBar::value () const" +.SH "int TQScrollBar::value () const" Returns the scroll bar's value. See the "value" property for details. -.SH "void QScrollBar::valueChanged ( int value )\fC [signal]\fR" +.SH "void TQScrollBar::valueChanged ( int value )\fC [signal]\fR" This signal is emitted when the scroll bar value has changed, with the new scroll bar \fIvalue\fR as an argument. .SS "Property Documentation" .SH "bool draggingSlider" @@ -294,7 +294,7 @@ Set this property's value with setLineStep() and get this property's value with .SH "int maxValue" This property holds the scroll bar's maximum value. .PP -When setting this property, the QScrollBar::minValue is adjusted if necessary to ensure that the range remains valid. +When setting this property, the TQScrollBar::minValue is adjusted if necessary to ensure that the range remains valid. .PP See also setRange(). .PP @@ -302,7 +302,7 @@ Set this property's value with setMaxValue() and get this property's value with .SH "int minValue" This property holds the scroll bar's minimum value. .PP -When setting this property, the QScrollBar::maxValue is adjusted if necessary to ensure that the range remains valid. +When setting this property, the TQScrollBar::maxValue is adjusted if necessary to ensure that the range remains valid. .PP See also setRange(). .PP @@ -335,7 +335,7 @@ Set this property's value with setValue() and get this property's value with val See also QRangeControl::value() and prevValue(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqscrollbar.html +.BR http://doc.trolltech.com/tqscrollbar.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqscrollview.3qt b/doc/man/man3/tqscrollview.3qt index 9841ac033..b1f1f07e1 100644 --- a/doc/man/man3/tqscrollview.3qt +++ b/doc/man/man3/tqscrollview.3qt @@ -1,5 +1,5 @@ '\" t -.TH QScrollView 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQScrollView 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,9 +7,9 @@ .ad l .nh .SH NAME -QScrollView \- Scrolling area with on-demand scroll bars +TQScrollView \- Scrolling area with on-demand scroll bars .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP Inherits QFrame. .PP @@ -18,10 +18,10 @@ Inherited by TQCanvasView, QTable, QGridView, TQIconView, QListBox, QListView, a .SS "Public Members" .in +1c .ti -1c -.BI "\fBQScrollView\fR ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )" +.BI "\fBTQScrollView\fR ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )" .br .ti -1c -.BI "\fB~QScrollView\fR ()" +.BI "\fB~TQScrollView\fR ()" .br .ti -1c .BI "enum \fBResizePolicy\fR { Default, Manual, AutoOne, AutoOneFit }" @@ -75,10 +75,10 @@ Inherited by TQCanvasView, QTable, QGridView, TQIconView, QListBox, QListView, a .BI "virtual void \fBsetCornerWidget\fR ( TQWidget * corner )" .br .ti -1c -.BI "QScrollBar * \fBhorizontalScrollBar\fR () const" +.BI "TQScrollBar * \fBhorizontalScrollBar\fR () const" .br .ti -1c -.BI "QScrollBar * \fBverticalScrollBar\fR () const" +.BI "TQScrollBar * \fBverticalScrollBar\fR () const" .br .ti -1c .BI "TQWidget * \fBviewport\fR () const" @@ -297,23 +297,23 @@ Inherited by TQCanvasView, QTable, QGridView, TQIconView, QListBox, QListView, a .BI "int \fBbottomMargin\fR () const" .br .ti -1c -.BI "virtual void \fBsetHBarGeometry\fR ( QScrollBar & hbar, int x, int y, int w, int h )" +.BI "virtual void \fBsetHBarGeometry\fR ( TQScrollBar & hbar, int x, int y, int w, int h )" .br .ti -1c -.BI "virtual void \fBsetVBarGeometry\fR ( QScrollBar & vbar, int x, int y, int w, int h )" +.BI "virtual void \fBsetVBarGeometry\fR ( TQScrollBar & vbar, int x, int y, int w, int h )" .br .ti -1c .BI "virtual bool \fBeventFilter\fR ( TQObject * obj, TQEvent * e )" .br .in -1c .SH DESCRIPTION -The QScrollView widget provides a scrolling area with on-demand scroll bars. +The TQScrollView widget provides a scrolling area with on-demand scroll bars. .PP -The QScrollView is a large canvas - potentially larger than the coordinate system normally supported by the underlying window system. This is important because it is quite easy to go beyond these limitations (e.g. many web pages are more than 32000 pixels high). Additionally, the QScrollView can have TQWidgets positioned on it that scroll around with the drawn content. These sub-widgets can also have positions outside the normal coordinate range (but they are still limited in size). +The TQScrollView is a large canvas - potentially larger than the coordinate system normally supported by the underlying window system. This is important because it is quite easy to go beyond these limitations (e.g. many web pages are more than 32000 pixels high). Additionally, the TQScrollView can have TQWidgets positioned on it that scroll around with the drawn content. These sub-widgets can also have positions outside the normal coordinate range (but they are still limited in size). .PP -To provide content for the widget, inherit from QScrollView, reimplement drawContents() and use resizeContents() to set the size of the viewed area. Use addChild() and moveChild() to position widgets on the view. +To provide content for the widget, inherit from TQScrollView, reimplement drawContents() and use resizeContents() to set the size of the viewed area. Use addChild() and moveChild() to position widgets on the view. .PP -To use QScrollView effectively it is important to understand its widget structure in the three styles of use: a single large child widget, a large panning area with some widgets and a large panning area with many widgets. +To use TQScrollView effectively it is important to understand its widget structure in the three styles of use: a single large child widget, a large panning area with some widgets and a large panning area with many widgets. .SH "Using One Big Widget"
            .ce 1 @@ -321,11 +321,11 @@ To use QScrollView effectively it is important to understand its widget structur .PP
            .PP -The first, simplest usage of QScrollView (depicted above), is appropriate for scrolling areas that are never more than about 4000 pixels in either dimension (this is about the maximum reliable size on X11 servers). In this usage, you just make one large child in the QScrollView. The child should be a child of the viewport() of the scrollview and be added with addChild(): +The first, simplest usage of TQScrollView (depicted above), is appropriate for scrolling areas that are never more than about 4000 pixels in either dimension (this is about the maximum reliable size on X11 servers). In this usage, you just make one large child in the TQScrollView. The child should be a child of the viewport() of the scrollview and be added with addChild(): .PP .nf .br - QScrollView* sv = new QScrollView(...); + TQScrollView* sv = new TQScrollView(...); .br QVBox* big_box = new QVBox(sv->viewport()); .br @@ -346,7 +346,7 @@ You can go on to add arbitrary child widgets to the single child in the scrollvi .br .fi .PP -Here the QScrollView has four children: the viewport(), the verticalScrollBar(), the horizontalScrollBar() and a small cornerWidget(). The viewport() has one child: the big QVBox. The QVBox has the three TQLabel objects as child widgets. When the view is scrolled, the QVBox is moved; its children move with it as child widgets normally do. +Here the TQScrollView has four children: the viewport(), the verticalScrollBar(), the horizontalScrollBar() and a small cornerWidget(). The viewport() has one child: the big QVBox. The QVBox has the three TQLabel objects as child widgets. When the view is scrolled, the QVBox is moved; its children move with it as child widgets normally do. .SH "Using a Very Big View with Some Widgets"
            .ce 1 @@ -354,11 +354,11 @@ Here the QScrollView has four children: the viewport(), the verticalScrollBar(), .PP
            .PP -The second usage of QScrollView (depicted above) is appropriate when few, if any, widgets are on a very large scrolling area that is potentially larger than 4000 pixels in either dimension. In this usage you call resizeContents() to set the size of the area and reimplement drawContents() to paint the contents. You may also add some widgets by making them children of the viewport() and adding them with addChild() (this is the same as the process for the single large widget in the previous example): +The second usage of TQScrollView (depicted above) is appropriate when few, if any, widgets are on a very large scrolling area that is potentially larger than 4000 pixels in either dimension. In this usage you call resizeContents() to set the size of the area and reimplement drawContents() to paint the contents. You may also add some widgets by making them children of the viewport() and adding them with addChild() (this is the same as the process for the single large widget in the previous example): .PP .nf .br - QScrollView* sv = new QScrollView(...); + TQScrollView* sv = new TQScrollView(...); .br TQLabel* child1 = new TQLabel("CHILD", sv->viewport()); .br @@ -373,7 +373,7 @@ The second usage of QScrollView (depicted above) is appropriate when few, if any sv->addChild(child3); .br .fi -Here, the QScrollView has the same four children: the viewport(), the verticalScrollBar(), the horizontalScrollBar() and a small cornerWidget(). The viewport() has the three TQLabel objects as child widgets. When the view is scrolled, the scrollview moves the child widgets individually. +Here, the TQScrollView has the same four children: the viewport(), the verticalScrollBar(), the horizontalScrollBar() and a small cornerWidget(). The viewport() has the three TQLabel objects as child widgets. When the view is scrolled, the scrollview moves the child widgets individually. .SH "Using a Very Big View with Many Widgets"
            .ce 1 @@ -381,11 +381,11 @@ Here, the QScrollView has the same four children: the viewport(), the verticalSc .PP
            .PP -The final usage of QScrollView (depicted above) is appropriate when many widgets are on a very large scrolling area that is potentially larger than 4000 pixels in either dimension. In this usage you call resizeContents() to set the size of the area and reimplement drawContents() to paint the contents. You then call enableClipper(TRUE) and add widgets, again by making them children of the viewport(), and adding them with addChild(): +The final usage of TQScrollView (depicted above) is appropriate when many widgets are on a very large scrolling area that is potentially larger than 4000 pixels in either dimension. In this usage you call resizeContents() to set the size of the area and reimplement drawContents() to paint the contents. You then call enableClipper(TRUE) and add widgets, again by making them children of the viewport(), and adding them with addChild(): .PP .nf .br - QScrollView* sv = new QScrollView(...); + TQScrollView* sv = new TQScrollView(...); .br sv->enableClipper(TRUE); .br @@ -403,17 +403,17 @@ The final usage of QScrollView (depicted above) is appropriate when many widgets .br .fi .PP -Here, the QScrollView has four children: the clipper() (not the viewport() this time), the verticalScrollBar(), the horizontalScrollBar() and a small cornerWidget(). The clipper() has one child: the viewport(). The viewport() has the same three labels as child widgets. When the view is scrolled the viewport() is moved; its children move with it as child widgets normally do. +Here, the TQScrollView has four children: the clipper() (not the viewport() this time), the verticalScrollBar(), the horizontalScrollBar() and a small cornerWidget(). The clipper() has one child: the viewport(). The viewport() has the same three labels as child widgets. When the view is scrolled the viewport() is moved; its children move with it as child widgets normally do. .SH "Details Relevant for All Views" Normally you will use the first or third method if you want any child widgets in the view. .PP -Note that the widget you see in the scrolled area is the viewport() widget, not the QScrollView itself. So to turn mouse tracking on, for example, use viewport()->setMouseTracking(TRUE). +Note that the widget you see in the scrolled area is the viewport() widget, not the TQScrollView itself. So to turn mouse tracking on, for example, use viewport()->setMouseTracking(TRUE). .PP -To enable drag-and-drop, you would setAcceptDrops(TRUE) on the QScrollView (because drag-and-drop events propagate to the parent). But to work out the logical position in the view, you would need to map the drop co-ordinate from being relative to the QScrollView to being relative to the contents; use the function viewportToContents() for this. +To enable drag-and-drop, you would setAcceptDrops(TRUE) on the TQScrollView (because drag-and-drop events propagate to the parent). But to work out the logical position in the view, you would need to map the drop co-ordinate from being relative to the TQScrollView to being relative to the contents; use the function viewportToContents() for this. .PP -To handle mouse events on the scrolling area, subclass scrollview as you would subclass other widgets, but rather than reimplementing mousePressEvent(), reimplement contentsMousePressEvent() instead. The contents specific event handlers provide translated events in the coordinate system of the scrollview. If you reimplement mousePressEvent(), you'll get called only when part of the QScrollView is clicked: and the only such part is the "corner" (if you don't set a cornerWidget()) and the frame; everything else is covered up by the viewport, clipper or scroll bars. +To handle mouse events on the scrolling area, subclass scrollview as you would subclass other widgets, but rather than reimplementing mousePressEvent(), reimplement contentsMousePressEvent() instead. The contents specific event handlers provide translated events in the coordinate system of the scrollview. If you reimplement mousePressEvent(), you'll get called only when part of the TQScrollView is clicked: and the only such part is the "corner" (if you don't set a cornerWidget()) and the frame; everything else is covered up by the viewport, clipper or scroll bars. .PP -When you construct a QScrollView, some of the widget flags apply to the viewport() instead of being sent to the TQWidget constructor for the QScrollView. This applies to WNoAutoErase, WStaticContents, and WPaintClever. See TQt::WidgetFlags for documentation about these flags. Here are some examples: +When you construct a TQScrollView, some of the widget flags apply to the viewport() instead of being sent to the TQWidget constructor for the TQScrollView. This applies to WNoAutoErase, WStaticContents, and WPaintClever. See TQt::WidgetFlags for documentation about these flags. Here are some examples: .IP .TP An image-manipulation widget would use \fCWNoAutoErase|WStaticContents\fR because the widget draws all pixels itself, and when its size increases, it only needs a paint event for the new part because the old part remains unchanged. @@ -435,7 +435,7 @@ Coordinate conversion is provided by contentsToViewport() and viewportToContents .PP The contentsMoving() signal is emitted just before the contents are moved to a new position. .PP -\fBWarning:\fR QScrollView currently does not erase the background when resized, i.e. you must always clear the background manually in scrollview subclasses. This will change in a future version of TQt and we recommend specifying the WNoAutoErase flag explicitly. +\fBWarning:\fR TQScrollView currently does not erase the background when resized, i.e. you must always clear the background manually in scrollview subclasses. This will change in a future version of TQt and we recommend specifying the WNoAutoErase flag explicitly. .PP .ce 1 .B "[Image Omitted]" @@ -446,48 +446,48 @@ The contentsMoving() signal is emitted just before the contents are moved to a n .PP See also Abstract Widget Classes. .SS "Member Type Documentation" -.SH "QScrollView::ResizePolicy" -This enum type is used to control a QScrollView's reaction to resize events. +.SH "TQScrollView::ResizePolicy" +This enum type is used to control a TQScrollView's reaction to resize events. .TP -\fCQScrollView::Default\fR - the QScrollView selects one of the other settings automatically when it has to. In this version of Qt, QScrollView changes to Manual if you resize the contents with resizeContents() and to AutoOne if a child is added. +\fCTQScrollView::Default\fR - the TQScrollView selects one of the other settings automatically when it has to. In this version of TQt, TQScrollView changes to Manual if you resize the contents with resizeContents() and to AutoOne if a child is added. .TP -\fCQScrollView::Manual\fR - the contents stays the size set by resizeContents(). +\fCTQScrollView::Manual\fR - the contents stays the size set by resizeContents(). .TP -\fCQScrollView::AutoOne\fR - if there is only one child widget the contents stays the size of that widget. Otherwise the behavior is undefined. +\fCTQScrollView::AutoOne\fR - if there is only one child widget the contents stays the size of that widget. Otherwise the behavior is undefined. .TP -\fCQScrollView::AutoOneFit\fR - if there is only one child widget the contents stays the size of that widget's sizeHint(). If the scrollview is resized larger than the child's sizeHint(), the child will be resized to fit. If there is more than one child, the behavior is undefined. -.SH "QScrollView::ScrollBarMode" -This enum type describes the various modes of QScrollView's scroll bars. +\fCTQScrollView::AutoOneFit\fR - if there is only one child widget the contents stays the size of that widget's sizeHint(). If the scrollview is resized larger than the child's sizeHint(), the child will be resized to fit. If there is more than one child, the behavior is undefined. +.SH "TQScrollView::ScrollBarMode" +This enum type describes the various modes of TQScrollView's scroll bars. .TP -\fCQScrollView::Auto\fR - QScrollView shows a scroll bar when the content is too large to fit and not otherwise. This is the default. +\fCTQScrollView::Auto\fR - TQScrollView shows a scroll bar when the content is too large to fit and not otherwise. This is the default. .TP -\fCQScrollView::AlwaysOff\fR - QScrollView never shows a scroll bar. +\fCTQScrollView::AlwaysOff\fR - TQScrollView never shows a scroll bar. .TP -\fCQScrollView::AlwaysOn\fR - QScrollView always shows a scroll bar. +\fCTQScrollView::AlwaysOn\fR - TQScrollView always shows a scroll bar. .PP (The modes for the horizontal and vertical scroll bars are independent.) .SH MEMBER FUNCTION DOCUMENTATION -.SH "QScrollView::QScrollView ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )" -Constructs a QScrollView called \fIname\fR with parent \fIparent\fR and widget flags \fIf\fR. +.SH "TQScrollView::TQScrollView ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )" +Constructs a TQScrollView called \fIname\fR with parent \fIparent\fR and widget flags \fIf\fR. .PP The widget flags WStaticContents, WNoAutoErase and WPaintClever are propagated to the viewport() widget. The other widget flags are propagated to the parent constructor as usual. -.SH "QScrollView::~QScrollView ()" -Destroys the QScrollView. Any children added with addChild() will be deleted. -.SH "void QScrollView::addChild ( TQWidget * child, int x = 0, int y = 0 )\fC [virtual]\fR" +.SH "TQScrollView::~TQScrollView ()" +Destroys the TQScrollView. Any children added with addChild() will be deleted. +.SH "void TQScrollView::addChild ( TQWidget * child, int x = 0, int y = 0 )\fC [virtual]\fR" Inserts the widget, \fIchild\fR, into the scrolled area positioned at (\fIx\fR, \fIy\fR). The position defaults to (0, 0). If the child is already in the view, it is just moved. .PP You may want to call enableClipper(TRUE) if you add a large number of widgets. .PP Example: scrollview/scrollview.cpp. -.SH "int QScrollView::bottomMargin () const\fC [protected]\fR" +.SH "int TQScrollView::bottomMargin () const\fC [protected]\fR" Returns the bottom margin. .PP See also setMargins(). -.SH "void QScrollView::center ( int x, int y )\fC [slot]\fR" +.SH "void TQScrollView::center ( int x, int y )\fC [slot]\fR" Scrolls the content so that the point \fI(x, y)\fR is in the center of visible area. .PP Example: scrollview/scrollview.cpp. -.SH "void QScrollView::center ( int x, int y, float xmargin, float ymargin )\fC [slot]\fR" +.SH "void TQScrollView::center ( int x, int y, float xmargin, float ymargin )\fC [slot]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Scrolls the content so that the point \fI(x, y)\fR is visible with the \fIxmargin\fR and \fIymargin\fR margins (as fractions of visible the area). @@ -499,97 +499,97 @@ Margin 0.0 allows (x, y) to be on the edge of the visible area. Margin 0.5 ensures that (x, y) is in middle 50% of the visible area. .TP Margin 1.0 ensures that (x, y) is in the center of the the visible area. -.SH "bool QScrollView::childIsVisible ( TQWidget * child )" +.SH "bool TQScrollView::childIsVisible ( TQWidget * child )" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP Returns TRUE if \fIchild\fR is visible. This is equivalent to child->isVisible(). -.SH "int QScrollView::childX ( TQWidget * child )" +.SH "int TQScrollView::childX ( TQWidget * child )" Returns the X position of the given \fIchild\fR widget. Use this rather than TQWidget::x() for widgets added to the view. .PP This function returns 0 if \fIchild\fR has not been added to the view. -.SH "int QScrollView::childY ( TQWidget * child )" +.SH "int TQScrollView::childY ( TQWidget * child )" Returns the Y position of the given \fIchild\fR widget. Use this rather than TQWidget::y() for widgets added to the view. .PP This function returns 0 if \fIchild\fR has not been added to the view. -.SH "TQWidget * QScrollView::clipper () const" +.SH "TQWidget * TQScrollView::clipper () const" Returns the clipper widget. Contents in the scrollview are ultimately clipped to be inside the clipper widget. .PP You should not need to use this function. .PP See also visibleWidth and visibleHeight. -.SH "void QScrollView::contentsContextMenuEvent ( QContextMenuEvent * e )\fC [virtual protected]\fR" -This event handler is called whenever the QScrollView receives a contextMenuEvent() in \fIe\fR: the mouse position is translated to be a point on the contents. +.SH "void TQScrollView::contentsContextMenuEvent ( QContextMenuEvent * e )\fC [virtual protected]\fR" +This event handler is called whenever the TQScrollView receives a contextMenuEvent() in \fIe\fR: the mouse position is translated to be a point on the contents. .PP Example: chart/canvasview.cpp. -.SH "void QScrollView::contentsDragEnterEvent ( TQDragEnterEvent * )\fC [virtual protected]\fR" -This event handler is called whenever the QScrollView receives a dragEnterEvent(): the drag position is translated to be a point on the contents. +.SH "void TQScrollView::contentsDragEnterEvent ( TQDragEnterEvent * )\fC [virtual protected]\fR" +This event handler is called whenever the TQScrollView receives a dragEnterEvent(): the drag position is translated to be a point on the contents. .PP Reimplemented in QTable. -.SH "void QScrollView::contentsDragLeaveEvent ( TQDragLeaveEvent * )\fC [virtual protected]\fR" -This event handler is called whenever the QScrollView receives a dragLeaveEvent(): the drag position is translated to be a point on the contents. +.SH "void TQScrollView::contentsDragLeaveEvent ( TQDragLeaveEvent * )\fC [virtual protected]\fR" +This event handler is called whenever the TQScrollView receives a dragLeaveEvent(): the drag position is translated to be a point on the contents. .PP Reimplemented in QTable. -.SH "void QScrollView::contentsDragMoveEvent ( TQDragMoveEvent * )\fC [virtual protected]\fR" -This event handler is called whenever the QScrollView receives a dragMoveEvent(): the drag position is translated to be a point on the contents. +.SH "void TQScrollView::contentsDragMoveEvent ( TQDragMoveEvent * )\fC [virtual protected]\fR" +This event handler is called whenever the TQScrollView receives a dragMoveEvent(): the drag position is translated to be a point on the contents. .PP Reimplemented in QTable. -.SH "void QScrollView::contentsDropEvent ( TQDropEvent * )\fC [virtual protected]\fR" -This event handler is called whenever the QScrollView receives a dropEvent(): the drop position is translated to be a point on the contents. +.SH "void TQScrollView::contentsDropEvent ( TQDropEvent * )\fC [virtual protected]\fR" +This event handler is called whenever the TQScrollView receives a dropEvent(): the drop position is translated to be a point on the contents. .PP Reimplemented in QTable. -.SH "int QScrollView::contentsHeight () const" +.SH "int TQScrollView::contentsHeight () const" Returns the height of the contents area. See the "contentsHeight" property for details. -.SH "void QScrollView::contentsMouseDoubleClickEvent ( QMouseEvent * e )\fC [virtual protected]\fR" -This event handler is called whenever the QScrollView receives a mouseDoubleClickEvent(): the click position in \fIe\fR is translated to be a point on the contents. +.SH "void TQScrollView::contentsMouseDoubleClickEvent ( QMouseEvent * e )\fC [virtual protected]\fR" +This event handler is called whenever the TQScrollView receives a mouseDoubleClickEvent(): the click position in \fIe\fR is translated to be a point on the contents. .PP The default implementation generates a normal mouse press event. .PP Reimplemented in QListView. -.SH "void QScrollView::contentsMouseMoveEvent ( QMouseEvent * e )\fC [virtual protected]\fR" -This event handler is called whenever the QScrollView receives a mouseMoveEvent(): the mouse position in \fIe\fR is translated to be a point on the contents. +.SH "void TQScrollView::contentsMouseMoveEvent ( QMouseEvent * e )\fC [virtual protected]\fR" +This event handler is called whenever the TQScrollView receives a mouseMoveEvent(): the mouse position in \fIe\fR is translated to be a point on the contents. .PP Examples: .)l canvas/canvas.cpp and chart/canvasview.cpp. .PP Reimplemented in QListView. -.SH "void QScrollView::contentsMousePressEvent ( QMouseEvent * e )\fC [virtual protected]\fR" -This event handler is called whenever the QScrollView receives a mousePressEvent(): the press position in \fIe\fR is translated to be a point on the contents. +.SH "void TQScrollView::contentsMousePressEvent ( QMouseEvent * e )\fC [virtual protected]\fR" +This event handler is called whenever the TQScrollView receives a mousePressEvent(): the press position in \fIe\fR is translated to be a point on the contents. .PP Examples: .)l canvas/canvas.cpp and chart/canvasview.cpp. .PP Reimplemented in QListView. -.SH "void QScrollView::contentsMouseReleaseEvent ( QMouseEvent * e )\fC [virtual protected]\fR" -This event handler is called whenever the QScrollView receives a mouseReleaseEvent(): the release position in \fIe\fR is translated to be a point on the contents. +.SH "void TQScrollView::contentsMouseReleaseEvent ( QMouseEvent * e )\fC [virtual protected]\fR" +This event handler is called whenever the TQScrollView receives a mouseReleaseEvent(): the release position in \fIe\fR is translated to be a point on the contents. .PP Reimplemented in QListView. -.SH "void QScrollView::contentsMoving ( int x, int y )\fC [signal]\fR" +.SH "void TQScrollView::contentsMoving ( int x, int y )\fC [signal]\fR" This signal is emitted just before the contents are moved to position \fI(x, y)\fR. .PP See also contentsX and contentsY. -.SH "void QScrollView::contentsToViewport ( int x, int y, int & vx, int & vy ) const" +.SH "void TQScrollView::contentsToViewport ( int x, int y, int & vx, int & vy ) const" Translates a point (\fIx\fR, \fIy\fR) in the contents to a point (\fIvx\fR, \fIvy\fR) on the viewport() widget. -.SH "TQPoint QScrollView::contentsToViewport ( const TQPoint & p ) const" +.SH "TQPoint TQScrollView::contentsToViewport ( const TQPoint & p ) const" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Returns the point \fIp\fR translated to a point on the viewport() widget. -.SH "void QScrollView::contentsWheelEvent ( QWheelEvent * e )\fC [virtual protected]\fR" -This event handler is called whenever the QScrollView receives a wheelEvent() in \fIe\fR: the mouse position is translated to be a point on the contents. -.SH "int QScrollView::contentsWidth () const" +.SH "void TQScrollView::contentsWheelEvent ( QWheelEvent * e )\fC [virtual protected]\fR" +This event handler is called whenever the TQScrollView receives a wheelEvent() in \fIe\fR: the mouse position is translated to be a point on the contents. +.SH "int TQScrollView::contentsWidth () const" Returns the width of the contents area. See the "contentsWidth" property for details. -.SH "int QScrollView::contentsX () const" +.SH "int TQScrollView::contentsX () const" Returns the X coordinate of the contents that are at the left edge of the viewport. See the "contentsX" property for details. -.SH "int QScrollView::contentsY () const" +.SH "int TQScrollView::contentsY () const" Returns the Y coordinate of the contents that are at the top edge of the viewport. See the "contentsY" property for details. -.SH "TQWidget * QScrollView::cornerWidget () const" +.SH "TQWidget * TQScrollView::cornerWidget () const" Returns the widget in the corner between the two scroll bars. .PP By default, no corner widget is present. .PP Example: scrollview/scrollview.cpp. -.SH "bool QScrollView::dragAutoScroll () const" +.SH "bool TQScrollView::dragAutoScroll () const" Returns TRUE if autoscrolling in drag move events is enabled; otherwise returns FALSE. See the "dragAutoScroll" property for details. -.SH "void QScrollView::drawContents ( TQPainter * p, int clipx, int clipy, int clipw, int cliph )\fC [virtual protected]\fR" +.SH "void TQScrollView::drawContents ( TQPainter * p, int clipx, int clipy, int clipw, int cliph )\fC [virtual protected]\fR" Reimplement this function if you are viewing a drawing area rather than a widget. .PP The function should draw the rectangle (\fIclipx\fR, \fIclipy\fR, \fIclipw\fR, \fIcliph\fR) of the contents using painter \fIp\fR. The clip rectangle is in the scrollview's coordinates. @@ -636,13 +636,13 @@ The clip rectangle and translation of the painter \fIp\fR is already set appropr Example: tqdir/tqdir.cpp. .PP Reimplemented in TQCanvasView and QTable. -.SH "void QScrollView::drawContentsOffset ( TQPainter * p, int offsetx, int offsety, int clipx, int clipy, int clipw, int cliph )\fC [virtual protected]\fR" +.SH "void TQScrollView::drawContentsOffset ( TQPainter * p, int offsetx, int offsety, int clipx, int clipy, int clipw, int cliph )\fC [virtual protected]\fR" For backward-compatibility only. It is easier to use drawContents(TQPainter*,int,int,int,int). .PP The default implementation translates the painter appropriately and calls drawContents(TQPainter*,int,int,int,int). See drawContents() for an explanation of the parameters \fIp\fR, \fIoffsetx\fR, \fIoffsety\fR, \fIclipx\fR, \fIclipy\fR, \fIclipw\fR and \fIcliph\fR. .PP Reimplemented in QListView. -.SH "void QScrollView::enableClipper ( bool y )" +.SH "void TQScrollView::enableClipper ( bool y )" When a large numbers of child widgets are in a scrollview, especially if they are close together, the scrolling performance can suffer greatly. If \fIy\fR is TRUE the scrollview will use an extra widget to group child widgets. .PP Note that you may only call enableClipper() prior to adding widgets. @@ -650,73 +650,73 @@ Note that you may only call enableClipper() prior to adding widgets. For a full discussion, see this class's detailed description. .PP Example: scrollview/scrollview.cpp. -.SH "void QScrollView::ensureVisible ( int x, int y )\fC [slot]\fR" +.SH "void TQScrollView::ensureVisible ( int x, int y )\fC [slot]\fR" Scrolls the content so that the point \fI(x, y)\fR is visible with at least 50-pixel margins (if possible, otherwise centered). -.SH "void QScrollView::ensureVisible ( int x, int y, int xmargin, int ymargin )\fC [slot]\fR" +.SH "void TQScrollView::ensureVisible ( int x, int y, int xmargin, int ymargin )\fC [slot]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Scrolls the content so that the point \fI(x, y)\fR is visible with at least the \fIxmargin\fR and \fIymargin\fR margins (if possible, otherwise centered). -.SH "bool QScrollView::eventFilter ( TQObject * obj, TQEvent * e )\fC [virtual protected]\fR" -This event filter ensures the scroll bars are updated when a single contents widget is resized, shown, hidden or destroyed; it passes mouse events to the QScrollView. The event is in \fIe\fR and the object is in \fIobj\fR. +.SH "bool TQScrollView::eventFilter ( TQObject * obj, TQEvent * e )\fC [virtual protected]\fR" +This event filter ensures the scroll bars are updated when a single contents widget is resized, shown, hidden or destroyed; it passes mouse events to the TQScrollView. The event is in \fIe\fR and the object is in \fIobj\fR. .PP Reimplemented from TQObject. .PP Reimplemented in QListView. -.SH "ScrollBarMode QScrollView::hScrollBarMode () const" +.SH "ScrollBarMode TQScrollView::hScrollBarMode () const" Returns the mode for the horizontal scroll bar. See the "hScrollBarMode" property for details. -.SH "bool QScrollView::hasStaticBackground () const" -Returns TRUE if QScrollView uses a static background; otherwise returns FALSE. +.SH "bool TQScrollView::hasStaticBackground () const" +Returns TRUE if TQScrollView uses a static background; otherwise returns FALSE. .PP See also setStaticBackground(). -.SH "QScrollBar * QScrollView::horizontalScrollBar () const" +.SH "TQScrollBar * TQScrollView::horizontalScrollBar () const" Returns the component horizontal scroll bar. It is made available to allow accelerators, autoscrolling, etc. .PP It should not be used for other purposes. .PP This function never returns 0. -.SH "void QScrollView::horizontalSliderPressed ()\fC [signal]\fR" +.SH "void TQScrollView::horizontalSliderPressed ()\fC [signal]\fR" This signal is emitted whenever the user presses the horizontal slider. -.SH "void QScrollView::horizontalSliderReleased ()\fC [signal]\fR" +.SH "void TQScrollView::horizontalSliderReleased ()\fC [signal]\fR" This signal is emitted whenever the user releases the horizontal slider. -.SH "bool QScrollView::isHorizontalSliderPressed ()" +.SH "bool TQScrollView::isHorizontalSliderPressed ()" Returns TRUE if horizontal slider is pressed by user; otherwise returns FALSE. -.SH "bool QScrollView::isVerticalSliderPressed ()" +.SH "bool TQScrollView::isVerticalSliderPressed ()" Returns TRUE if vertical slider is pressed by user; otherwise returns FALSE. -.SH "int QScrollView::leftMargin () const\fC [protected]\fR" +.SH "int TQScrollView::leftMargin () const\fC [protected]\fR" Returns the left margin. .PP See also setMargins(). -.SH "void QScrollView::moveChild ( TQWidget * child, int x, int y )\fC [virtual]\fR" +.SH "void TQScrollView::moveChild ( TQWidget * child, int x, int y )\fC [virtual]\fR" Repositions the \fIchild\fR widget to (\fIx\fR, \fIy\fR). This function is the same as addChild(). -.SH "void QScrollView::removeChild ( TQWidget * child )" +.SH "void TQScrollView::removeChild ( TQWidget * child )" Removes the \fIchild\fR widget from the scrolled area. Note that this happens automatically if the \fIchild\fR is deleted. -.SH "void QScrollView::repaintContents ( int x, int y, int w, int h, bool erase = TRUE )" +.SH "void TQScrollView::repaintContents ( int x, int y, int w, int h, bool erase = TRUE )" Calls repaint() on a rectangle defined by \fIx\fR, \fIy\fR, \fIw\fR, \fIh\fR, translated appropriately. If the rectangle is not visible, nothing is repainted. If \fIerase\fR is TRUE the background is cleared using the background color. .PP See also updateContents(). -.SH "void QScrollView::repaintContents ( const TQRect & r, bool erase = TRUE )" +.SH "void TQScrollView::repaintContents ( const TQRect & r, bool erase = TRUE )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Repaints the contents of rectangle \fIr\fR. If \fIerase\fR is TRUE the background is cleared using the background color. -.SH "void QScrollView::repaintContents ( bool erase = TRUE )" +.SH "void TQScrollView::repaintContents ( bool erase = TRUE )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Repaints the contents. If \fIerase\fR is TRUE the background is cleared using the background color. -.SH "void QScrollView::resizeContents ( int w, int h )\fC [virtual slot]\fR" +.SH "void TQScrollView::resizeContents ( int w, int h )\fC [virtual slot]\fR" Sets the size of the contents area to \fIw\fR pixels wide and \fIh\fR pixels high and updates the viewport accordingly. -.SH "ResizePolicy QScrollView::resizePolicy () const" +.SH "ResizePolicy TQScrollView::resizePolicy () const" Returns the resize policy. See the "resizePolicy" property for details. -.SH "int QScrollView::rightMargin () const\fC [protected]\fR" +.SH "int TQScrollView::rightMargin () const\fC [protected]\fR" Returns the right margin. .PP See also setMargins(). -.SH "void QScrollView::scrollBy ( int dx, int dy )\fC [slot]\fR" +.SH "void TQScrollView::scrollBy ( int dx, int dy )\fC [slot]\fR" Scrolls the content by \fIdx\fR to the left and \fIdy\fR upwards. -.SH "void QScrollView::setContentsPos ( int x, int y )\fC [virtual slot]\fR" +.SH "void TQScrollView::setContentsPos ( int x, int y )\fC [virtual slot]\fR" Scrolls the content so that the point \fI(x, y)\fR is in the top-left corner. .PP Example: process/process.cpp. -.SH "void QScrollView::setCornerWidget ( TQWidget * corner )\fC [virtual]\fR" +.SH "void TQScrollView::setCornerWidget ( TQWidget * corner )\fC [virtual]\fR" Sets the widget in the \fIcorner\fR between the two scroll bars. .PP You will probably also want to set at least one of the scroll bar modes to AlwaysOn. @@ -727,7 +727,7 @@ Any previous \fIcorner\fR widget is hidden. .PP You may call setCornerWidget() with the same widget at different times. .PP -All widgets set here will be deleted by the QScrollView when it is destroyed unless you separately reparent the widget after setting some other corner widget (or 0). +All widgets set here will be deleted by the TQScrollView when it is destroyed unless you separately reparent the widget after setting some other corner widget (or 0). .PP Any \fInewly\fR set widget should have no current parent. .PP @@ -736,98 +736,98 @@ By default, no corner widget is present. See also vScrollBarMode and hScrollBarMode. .PP Example: scrollview/scrollview.cpp. -.SH "void QScrollView::setDragAutoScroll ( bool b )\fC [virtual]\fR" +.SH "void TQScrollView::setDragAutoScroll ( bool b )\fC [virtual]\fR" Sets whether autoscrolling in drag move events is enabled to \fIb\fR. See the "dragAutoScroll" property for details. -.SH "void QScrollView::setHBarGeometry ( QScrollBar & hbar, int x, int y, int w, int h )\fC [virtual protected]\fR" +.SH "void TQScrollView::setHBarGeometry ( TQScrollBar & hbar, int x, int y, int w, int h )\fC [virtual protected]\fR" Called when the horizontal scroll bar geometry changes. This is provided as a protected function so that subclasses can do interesting things such as providing extra buttons in some of the space normally used by the scroll bars. .PP The default implementation simply gives all the space to \fIhbar\fR. The new geometry is given by \fIx\fR, \fIy\fR, \fIw\fR and \fIh\fR. .PP See also setVBarGeometry(). -.SH "void QScrollView::setHScrollBarMode ( ScrollBarMode )\fC [virtual]\fR" +.SH "void TQScrollView::setHScrollBarMode ( ScrollBarMode )\fC [virtual]\fR" Sets the mode for the horizontal scroll bar. See the "hScrollBarMode" property for details. -.SH "void QScrollView::setMargins ( int left, int top, int right, int bottom )\fC [virtual protected]\fR" +.SH "void TQScrollView::setMargins ( int left, int top, int right, int bottom )\fC [virtual protected]\fR" Sets the margins around the scrolling area to \fIleft\fR, \fItop\fR, \fIright\fR and \fIbottom\fR. This is useful for applications such as spreadsheets with "locked" rows and columns. The marginal space is \fIinside\fR the frameRect() and is left blank; reimplement drawFrame() or put widgets in the unused area. .PP By default all margins are zero. .PP See also frameChanged(). -.SH "void QScrollView::setResizePolicy ( ResizePolicy )\fC [virtual]\fR" +.SH "void TQScrollView::setResizePolicy ( ResizePolicy )\fC [virtual]\fR" Sets the resize policy. See the "resizePolicy" property for details. -.SH "void QScrollView::setStaticBackground ( bool y )" +.SH "void TQScrollView::setStaticBackground ( bool y )" Sets the scrollview to have a static background if \fIy\fR is TRUE, or a scrolling background if \fIy\fR is FALSE. By default, the background is scrolling. .PP Be aware that this mode is quite slow, as a full repaint of the visible area has to be triggered on every contents move. .PP See also hasStaticBackground(). -.SH "void QScrollView::setVBarGeometry ( QScrollBar & vbar, int x, int y, int w, int h )\fC [virtual protected]\fR" +.SH "void TQScrollView::setVBarGeometry ( TQScrollBar & vbar, int x, int y, int w, int h )\fC [virtual protected]\fR" Called when the vertical scroll bar geometry changes. This is provided as a protected function so that subclasses can do interesting things such as providing extra buttons in some of the space normally used by the scroll bars. .PP The default implementation simply gives all the space to \fIvbar\fR. The new geometry is given by \fIx\fR, \fIy\fR, \fIw\fR and \fIh\fR. .PP See also setHBarGeometry(). -.SH "void QScrollView::setVScrollBarMode ( ScrollBarMode )\fC [virtual]\fR" +.SH "void TQScrollView::setVScrollBarMode ( ScrollBarMode )\fC [virtual]\fR" Sets the mode for the vertical scroll bar. See the "vScrollBarMode" property for details. -.SH "void QScrollView::showChild ( TQWidget * child, bool y = TRUE )" +.SH "void TQScrollView::showChild ( TQWidget * child, bool y = TRUE )" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP Sets the visibility of \fIchild\fR. Equivalent to TQWidget::show() or TQWidget::hide(). -.SH "int QScrollView::topMargin () const\fC [protected]\fR" +.SH "int TQScrollView::topMargin () const\fC [protected]\fR" Returns the top margin. .PP See also setMargins(). -.SH "void QScrollView::updateContents ( int x, int y, int w, int h )" +.SH "void TQScrollView::updateContents ( int x, int y, int w, int h )" Calls update() on a rectangle defined by \fIx\fR, \fIy\fR, \fIw\fR, \fIh\fR, translated appropriately. If the rectangle is not visible, nothing is repainted. .PP See also repaintContents(). -.SH "void QScrollView::updateContents ( const TQRect & r )" +.SH "void TQScrollView::updateContents ( const TQRect & r )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Updates the contents in rectangle \fIr\fR -.SH "void QScrollView::updateContents ()" +.SH "void TQScrollView::updateContents ()" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -.SH "void QScrollView::updateScrollBars ()\fC [slot]\fR" +.SH "void TQScrollView::updateScrollBars ()\fC [slot]\fR" Updates scroll bars: all possibilities are considered. You should never need to call this in your code. -.SH "ScrollBarMode QScrollView::vScrollBarMode () const" +.SH "ScrollBarMode TQScrollView::vScrollBarMode () const" Returns the mode for the vertical scroll bar. See the "vScrollBarMode" property for details. -.SH "QScrollBar * QScrollView::verticalScrollBar () const" +.SH "TQScrollBar * TQScrollView::verticalScrollBar () const" Returns the component vertical scroll bar. It is made available to allow accelerators, autoscrolling, etc. .PP It should not be used for other purposes. .PP This function never returns 0. -.SH "void QScrollView::verticalSliderPressed ()\fC [signal]\fR" +.SH "void TQScrollView::verticalSliderPressed ()\fC [signal]\fR" This signal is emitted whenever the user presses the vertical slider. -.SH "void QScrollView::verticalSliderReleased ()\fC [signal]\fR" +.SH "void TQScrollView::verticalSliderReleased ()\fC [signal]\fR" This signal is emitted whenever the user releases the vertical slider. -.SH "TQWidget * QScrollView::viewport () const" +.SH "TQWidget * TQScrollView::viewport () const" Returns the viewport widget of the scrollview. This is the widget containing the contents widget or which is the drawing area. .PP Examples: .)l helpsystem/tooltip.cpp and scrollview/scrollview.cpp. -.SH "void QScrollView::viewportPaintEvent ( TQPaintEvent * pe )\fC [virtual protected]\fR" +.SH "void TQScrollView::viewportPaintEvent ( TQPaintEvent * pe )\fC [virtual protected]\fR" This is a low-level painting routine that draws the viewport contents. Reimplement this if drawContents() is too high-level (for example, if you don't want to open a TQPainter on the viewport). The paint event is passed in \fIpe\fR. -.SH "void QScrollView::viewportResizeEvent ( QResizeEvent * )\fC [virtual protected]\fR" +.SH "void TQScrollView::viewportResizeEvent ( QResizeEvent * )\fC [virtual protected]\fR" To provide simple processing of events on the contents, this function receives all resize events sent to the viewport. .PP See also TQWidget::resizeEvent(). .PP Example: chart/canvasview.cpp. -.SH "TQSize QScrollView::viewportSize ( int x, int y ) const" +.SH "TQSize TQScrollView::viewportSize ( int x, int y ) const" Returns the viewport size for size (\fIx\fR, \fIy\fR). .PP The viewport size depends on \fI(x, y)\fR (the size of the contents), the size of this widget and the modes of the horizontal and vertical scroll bars. .PP This function permits widgets that can trade vertical and horizontal space for each other to control scroll bar appearance better. For example, a word processor or web browser can control the width of the right margin accurately, whether or not there needs to be a vertical scroll bar. -.SH "void QScrollView::viewportToContents ( int vx, int vy, int & x, int & y ) const" +.SH "void TQScrollView::viewportToContents ( int vx, int vy, int & x, int & y ) const" Translates a point (\fIvx\fR, \fIvy\fR) on the viewport() widget to a point (\fIx\fR, \fIy\fR) in the contents. -.SH "TQPoint QScrollView::viewportToContents ( const TQPoint & vp ) const" +.SH "TQPoint TQScrollView::viewportToContents ( const TQPoint & vp ) const" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Returns the point on the viewport \fIvp\fR translated to a point in the contents. -.SH "int QScrollView::visibleHeight () const" +.SH "int TQScrollView::visibleHeight () const" Returns the vertical amount of the content that is visible. See the "visibleHeight" property for details. -.SH "int QScrollView::visibleWidth () const" +.SH "int TQScrollView::visibleWidth () const" Returns the horizontal amount of the content that is visible. See the "visibleWidth" property for details. .SS "Property Documentation" .SH "int contentsHeight" @@ -849,15 +849,15 @@ Get this property's value with contentsY(). .SH "bool dragAutoScroll" This property holds whether autoscrolling in drag move events is enabled. .PP -If this property is set to TRUE (the default), the QScrollView automatically scrolls the contents in drag move events if the user moves the cursor close to a border of the view. Of course this works only if the viewport accepts drops. Specifying FALSE disables this autoscroll feature. +If this property is set to TRUE (the default), the TQScrollView automatically scrolls the contents in drag move events if the user moves the cursor close to a border of the view. Of course this works only if the viewport accepts drops. Specifying FALSE disables this autoscroll feature. .PP -\fBWarning:\fR Enabling this property might not be enough to effectively turn on autoscrolling. If you put a custom widget in the QScrollView, you might need to call TQDragEvent::ignore() on the event in the dragEnterEvent() and dragMoveEvent() reimplementations. +\fBWarning:\fR Enabling this property might not be enough to effectively turn on autoscrolling. If you put a custom widget in the TQScrollView, you might need to call TQDragEvent::ignore() on the event in the dragEnterEvent() and dragMoveEvent() reimplementations. .PP Set this property's value with setDragAutoScroll() and get this property's value with dragAutoScroll(). .SH "ScrollBarMode hScrollBarMode" This property holds the mode for the horizontal scroll bar. .PP -The default mode is QScrollView::Auto. +The default mode is TQScrollView::Auto. .PP See also vScrollBarMode. .PP @@ -873,7 +873,7 @@ Set this property's value with setResizePolicy() and get this property's value w .SH "ScrollBarMode vScrollBarMode" This property holds the mode for the vertical scroll bar. .PP -The default mode is QScrollView::Auto. +The default mode is TQScrollView::Auto. .PP See also hScrollBarMode. .PP @@ -888,7 +888,7 @@ This property holds the horizontal amount of the content that is visible. Get this property's value with visibleWidth(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqscrollview.html +.BR http://doc.trolltech.com/tqscrollview.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqslider.3qt b/doc/man/man3/tqslider.3qt index a6382be60..adbdcbab2 100644 --- a/doc/man/man3/tqslider.3qt +++ b/doc/man/man3/tqslider.3qt @@ -1,5 +1,5 @@ '\" t -.TH QSlider 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQSlider 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,9 +7,9 @@ .ad l .nh .SH NAME -QSlider \- Vertical or horizontal slider +TQSlider \- Vertical or horizontal slider .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP Inherits TQWidget and QRangeControl. .PP @@ -28,7 +28,7 @@ Inherits TQWidget and QRangeControl. .BI "\fBQSlider\fR ( int minValue, int maxValue, int pageStep, int value, Orientation orientation, TQWidget * parent, const char * name = 0 )" .br .ti -1c -.BI "\fB~QSlider\fR ()" +.BI "\fB~TQSlider\fR ()" .br .ti -1c .BI "virtual void \fBsetOrientation\fR ( Orientation )" @@ -164,11 +164,11 @@ Inherits TQWidget and QRangeControl. .br .in -1c .SH DESCRIPTION -The QSlider widget provides a vertical or horizontal slider. +The TQSlider widget provides a vertical or horizontal slider. .PP The slider is the classic widget for controlling a bounded value. It lets the user move a slider along a horizontal or vertical groove and translates the slider's position into an integer value within the legal range. .PP -QSlider inherits QRangeControl, which provides the "integer" side of the slider. setRange() and value() are likely to be used by practically all slider users; see the QRangeControl documentation for information about the many other functions that class provides. +TQSlider inherits QRangeControl, which provides the "integer" side of the slider. setRange() and value() are likely to be used by practically all slider users; see the QRangeControl documentation for information about the many other functions that class provides. .PP The main functions offered by the slider itself are tickmark and orientation control; you can use setTickmarks() to indicate where you want the tickmarks to be, setTickInterval() to indicate how many of them you want and setOrientation() to indicate whether the slider is to be horizontal or vertical. .PP @@ -181,9 +181,9 @@ A slider accepts focus on Tab and uses the mouse wheel and a suitable keyboard i .ce 1 .B "[Image Omitted]" .PP -See also QScrollBar, QSpinBox, GUI Design Handbook: Slider, and Basic Widgets. +See also TQScrollBar, TQSpinBox, GUI Design Handbook: Slider, and Basic Widgets. .SS "Member Type Documentation" -.SH "QSlider::TickSetting" +.SH "TQSlider::TickSetting" This enum specifies where the tickmarks are to be drawn relative to the slider's groove and the handle the user moves. .TP \fCQSlider::NoMarks\fR - do not draw any tickmarks. @@ -198,51 +198,51 @@ This enum specifies where the tickmarks are to be drawn relative to the slider's .TP \fCQSlider::Right\fR - draw tickmarks to the right of the (vertical) slider .SH MEMBER FUNCTION DOCUMENTATION -.SH "QSlider::QSlider ( TQWidget * parent, const char * name = 0 )" +.SH "TQSlider::TQSlider ( TQWidget * parent, const char * name = 0 )" Constructs a vertical slider. .PP The \fIparent\fR and \fIname\fR arguments are sent on to the TQWidget constructor. -.SH "QSlider::QSlider ( Orientation orientation, TQWidget * parent, const char * name = 0 )" +.SH "TQSlider::TQSlider ( Orientation orientation, TQWidget * parent, const char * name = 0 )" Constructs a slider. .PP The \fIorientation\fR must be TQt::Vertical or TQt::Horizontal. .PP The \fIparent\fR and \fIname\fR arguments are sent on to the TQWidget constructor. -.SH "QSlider::QSlider ( int minValue, int maxValue, int pageStep, int value, Orientation orientation, TQWidget * parent, const char * name = 0 )" +.SH "TQSlider::TQSlider ( int minValue, int maxValue, int pageStep, int value, Orientation orientation, TQWidget * parent, const char * name = 0 )" Constructs a slider whose value can never be smaller than \fIminValue\fR or greater than \fImaxValue\fR, whose page step size is \fIpageStep\fR and whose value is initially \fIvalue\fR (which is guaranteed to be in range using bound()). .PP If \fIorientation\fR is TQt::Vertical the slider is vertical and if it is TQt::Horizontal the slider is horizontal. .PP The \fIparent\fR and \fIname\fR arguments are sent on to the TQWidget constructor. -.SH "QSlider::~QSlider ()" +.SH "TQSlider::~TQSlider ()" Destructor. -.SH "void QSlider::addStep ()\fC [slot]\fR" +.SH "void TQSlider::addStep ()\fC [slot]\fR" Moves the slider one pageStep() up or right. -.SH "int QSlider::lineStep () const" +.SH "int TQSlider::lineStep () const" Returns the current line step. See the "lineStep" property for details. -.SH "int QSlider::maxValue () const" +.SH "int TQSlider::maxValue () const" Returns the current maximum value of the slider. See the "maxValue" property for details. -.SH "int QSlider::minValue () const" +.SH "int TQSlider::minValue () const" Returns the current minimum value of the slider. See the "minValue" property for details. -.SH "Orientation QSlider::orientation () const" +.SH "Orientation TQSlider::orientation () const" Returns the slider's orientation. See the "orientation" property for details. -.SH "int QSlider::pageStep () const" +.SH "int TQSlider::pageStep () const" Returns the current page step. See the "pageStep" property for details. -.SH "void QSlider::rangeChange ()\fC [virtual protected]\fR" +.SH "void TQSlider::rangeChange ()\fC [virtual protected]\fR" Implements the virtual QRangeControl function. .PP Reimplemented from QRangeControl. -.SH "void QSlider::setLineStep ( int )" +.SH "void TQSlider::setLineStep ( int )" Sets the current line step. See the "lineStep" property for details. -.SH "void QSlider::setMaxValue ( int )" +.SH "void TQSlider::setMaxValue ( int )" Sets the current maximum value of the slider. See the "maxValue" property for details. -.SH "void QSlider::setMinValue ( int )" +.SH "void TQSlider::setMinValue ( int )" Sets the current minimum value of the slider. See the "minValue" property for details. -.SH "void QSlider::setOrientation ( Orientation )\fC [virtual]\fR" +.SH "void TQSlider::setOrientation ( Orientation )\fC [virtual]\fR" Sets the slider's orientation. See the "orientation" property for details. -.SH "void QSlider::setPageStep ( int )" +.SH "void TQSlider::setPageStep ( int )" Sets the current page step. See the "pageStep" property for details. -.SH "void QSlider::setPalette ( const TQPalette & p )\fC [virtual]\fR" +.SH "void TQSlider::setPalette ( const TQPalette & p )\fC [virtual]\fR" Reimplements the virtual function TQWidget::setPalette(). .PP Sets the background color to the mid color for Motif style sliders using palette \fIp\fR. @@ -259,39 +259,39 @@ See also minValue and maxValue. .PP Examples: .)l listbox/listbox.cpp, t12/lcdrange.cpp, t5/main.cpp, t6/main.cpp, t8/lcdrange.cpp, and xform/xform.cpp. -.SH "void QSlider::setTickInterval ( int )\fC [virtual]\fR" +.SH "void TQSlider::setTickInterval ( int )\fC [virtual]\fR" Sets the interval between tickmarks. See the "tickInterval" property for details. -.SH "void QSlider::setTickmarks ( TickSetting )\fC [virtual]\fR" +.SH "void TQSlider::setTickmarks ( TickSetting )\fC [virtual]\fR" Sets the tickmark settings for this slider. See the "tickmarks" property for details. -.SH "void QSlider::setTracking ( bool enable )\fC [virtual]\fR" +.SH "void TQSlider::setTracking ( bool enable )\fC [virtual]\fR" Sets whether slider tracking is enabled to \fIenable\fR. See the "tracking" property for details. -.SH "void QSlider::setValue ( int )\fC [virtual slot]\fR" +.SH "void TQSlider::setValue ( int )\fC [virtual slot]\fR" Sets the current slider value. See the "value" property for details. -.SH "void QSlider::sliderMoved ( int value )\fC [signal]\fR" +.SH "void TQSlider::sliderMoved ( int value )\fC [signal]\fR" This signal is emitted when the slider is dragged, with the new slider \fIvalue\fR as its argument. -.SH "void QSlider::sliderPressed ()\fC [signal]\fR" +.SH "void TQSlider::sliderPressed ()\fC [signal]\fR" This signal is emitted when the user presses the slider with the mouse. -.SH "TQRect QSlider::sliderRect () const" +.SH "TQRect TQSlider::sliderRect () const" Returns the slider handle rectangle. (This is the visual marker that the user can move.) -.SH "void QSlider::sliderReleased ()\fC [signal]\fR" +.SH "void TQSlider::sliderReleased ()\fC [signal]\fR" This signal is emitted when the user releases the slider with the mouse. -.SH "int QSlider::sliderStart () const" +.SH "int TQSlider::sliderStart () const" Returns the start position of the slider. -.SH "void QSlider::subtractStep ()\fC [slot]\fR" +.SH "void TQSlider::subtractStep ()\fC [slot]\fR" Moves the slider one pageStep() down or left. -.SH "int QSlider::tickInterval () const" +.SH "int TQSlider::tickInterval () const" Returns the interval between tickmarks. See the "tickInterval" property for details. -.SH "TickSetting QSlider::tickmarks () const" +.SH "TickSetting TQSlider::tickmarks () const" Returns the tickmark settings for this slider. See the "tickmarks" property for details. -.SH "bool QSlider::tracking () const" +.SH "bool TQSlider::tracking () const" Returns TRUE if slider tracking is enabled; otherwise returns FALSE. See the "tracking" property for details. -.SH "int QSlider::value () const" +.SH "int TQSlider::value () const" Returns the current slider value. See the "value" property for details. -.SH "void QSlider::valueChange ()\fC [virtual protected]\fR" +.SH "void TQSlider::valueChange ()\fC [virtual protected]\fR" Implements the virtual QRangeControl function. .PP Reimplemented from QRangeControl. -.SH "void QSlider::valueChanged ( int value )\fC [signal]\fR" +.SH "void TQSlider::valueChanged ( int value )\fC [signal]\fR" This signal is emitted when the slider value is changed, with the new slider \fIvalue\fR as its argument. .PP Examples: @@ -308,7 +308,7 @@ Set this property's value with setLineStep() and get this property's value with .SH "int maxValue" This property holds the current maximum value of the slider. .PP -When setting this property, the QSlider::minValue is adjusted, if necessary, to ensure that the range remains valid. +When setting this property, the TQSlider::minValue is adjusted, if necessary, to ensure that the range remains valid. .PP See also setRange(). .PP @@ -316,7 +316,7 @@ Set this property's value with setMaxValue() and get this property's value with .SH "int minValue" This property holds the current minimum value of the slider. .PP -When setting this property, the QSlider::maxValue is adjusted, if necessary, to ensure that the range remains valid. +When setting this property, the TQSlider::maxValue is adjusted, if necessary, to ensure that the range remains valid. .PP See also setRange(). .PP @@ -346,7 +346,7 @@ Set this property's value with setTickInterval() and get this property's value w .SH "TickSetting tickmarks" This property holds the tickmark settings for this slider. .PP -The valid values are in QSlider::TickSetting. The default is NoMarks. +The valid values are in TQSlider::TickSetting. The default is NoMarks. .PP See also tickInterval. .PP @@ -365,7 +365,7 @@ Set this property's value with setValue() and get this property's value with val See also QRangeControl::value() and prevValue(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqslider.html +.BR http://doc.trolltech.com/tqslider.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqspinbox.3qt b/doc/man/man3/tqspinbox.3qt index 4c126eb63..cc6c631d5 100644 --- a/doc/man/man3/tqspinbox.3qt +++ b/doc/man/man3/tqspinbox.3qt @@ -1,5 +1,5 @@ '\" t -.TH QSpinBox 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQSpinBox 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,22 +7,22 @@ .ad l .nh .SH NAME -QSpinBox \- Spin box widget (spin button) +TQSpinBox \- Spin box widget (spin button) .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP Inherits TQWidget and QRangeControl. .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQSpinBox\fR ( TQWidget * parent = 0, const char * name = 0 )" +.BI "\fBTQSpinBox\fR ( TQWidget * parent = 0, const char * name = 0 )" .br .ti -1c -.BI "\fBQSpinBox\fR ( int minValue, int maxValue, int step = 1, TQWidget * parent = 0, const char * name = 0 )" +.BI "\fBTQSpinBox\fR ( int minValue, int maxValue, int step = 1, TQWidget * parent = 0, const char * name = 0 )" .br .ti -1c -.BI "\fB~QSpinBox\fR ()" +.BI "\fB~TQSpinBox\fR ()" .br .ti -1c .BI "TQString \fBtext\fR () const" @@ -175,7 +175,7 @@ Inherits TQWidget and QRangeControl. .BI "virtual void \fBinterpretText\fR ()" .br .ti -1c -.BI "QLineEdit * \fBeditor\fR () const" +.BI "TQLineEdit * \fBeditor\fR () const" .br .ti -1c .BI "virtual void \fBvalueChange\fR ()" @@ -194,33 +194,33 @@ Inherits TQWidget and QRangeControl. .br .in -1c .SH DESCRIPTION -The QSpinBox class provides a spin box widget (spin button). +The TQSpinBox class provides a spin box widget (spin button). .PP -QSpinBox allows the user to choose a value either by clicking the up/down buttons to increase/decrease the value currently displayed or by typing the value directly into the spin box. If the value is entered directly into the spin box, Enter (or Return) must be pressed to apply the new value. The value is usually an integer. +TQSpinBox allows the user to choose a value either by clicking the up/down buttons to increase/decrease the value currently displayed or by typing the value directly into the spin box. If the value is entered directly into the spin box, Enter (or Return) must be pressed to apply the new value. The value is usually an integer. .PP -Every time the value changes QSpinBox emits the valueChanged() signal. The current value can be fetched with value() and set with setValue(). +Every time the value changes TQSpinBox emits the valueChanged() signal. The current value can be fetched with value() and set with setValue(). .PP The spin box keeps the value within a numeric range, and to multiples of the lineStep() size (see QRangeControl for details). Clicking the up/down buttons or using the keyboard accelerator's up and down arrows will increase or decrease the current value in steps of size lineStep(). The minimum and maximum value and the step size can be set using one of the constructors, and can be changed later with setMinValue(), setMaxValue() and setLineStep(). .PP -Most spin boxes are directional, but QSpinBox can also operate as a circular spin box, i.e. if the range is 0-99 and the current value is 99, clicking "up" will give 0. Use setWrapping() if you want circular behavior. +Most spin boxes are directional, but TQSpinBox can also operate as a circular spin box, i.e. if the range is 0-99 and the current value is 99, clicking "up" will give 0. Use setWrapping() if you want circular behavior. .PP The displayed value can be prepended and appended with arbitrary strings indicating, for example, currency or the unit of measurement. See setPrefix() and setSuffix(). The text in the spin box is retrieved with text() (which includes any prefix() and suffix()), or with cleanText() (which has no prefix(), no suffix() and no leading or trailing whitespace). currentValueText() returns the spin box's current value as text. .PP Normally the spin box displays up and down arrows in the buttons. You can use setButtonSymbols() to change the display to show \fB+\fR and \fB-\fR symbols if you prefer. In either case the up and down arrow keys work as expected. .PP -It is often desirable to give the user a special (often default) choice in addition to the range of numeric values. See setSpecialValueText() for how to do this with QSpinBox. +It is often desirable to give the user a special (often default) choice in addition to the range of numeric values. See setSpecialValueText() for how to do this with TQSpinBox. .PP The default TQWidget::focusPolicy() is StrongFocus. .PP -If using prefix(), suffix() and specialValueText() don't provide enough control, you can ignore them and subclass QSpinBox instead. +If using prefix(), suffix() and specialValueText() don't provide enough control, you can ignore them and subclass TQSpinBox instead. .PP -QSpinBox can easily be subclassed to allow the user to input things other than an integer value as long as the allowed input can be mapped to a range of integers. This can be done by overriding the virtual functions mapValueToText() and mapTextToValue(), and setting another suitable validator using setValidator(). +TQSpinBox can easily be subclassed to allow the user to input things other than an integer value as long as the allowed input can be mapped to a range of integers. This can be done by overriding the virtual functions mapValueToText() and mapTextToValue(), and setting another suitable validator using setValidator(). .PP For example, these functions could be changed so that the user provided values from 0.0 to 10.0, or -1 to signify 'Auto', while the range of integers used inside the program would be -1 to 100: .PP .nf .br - class MySpinBox : public QSpinBox + class MySpinBox : public TQSpinBox .br { .br @@ -271,52 +271,52 @@ For example, these functions could be changed so that the user provided values f .ce 1 .B "[Image Omitted]" .PP -See also QScrollBar, QSlider, GUI Design Handbook: Spin Box, and Basic Widgets. +See also TQScrollBar, TQSlider, GUI Design Handbook: Spin Box, and Basic Widgets. .SS "Member Type Documentation" -.SH "QSpinBox::ButtonSymbols" +.SH "TQSpinBox::ButtonSymbols" This enum type determines what the buttons in a spin box show. .TP -\fCQSpinBox::UpDownArrows\fR - the buttons show little arrows in the classic style. +\fCTQSpinBox::UpDownArrows\fR - the buttons show little arrows in the classic style. .TP -\fCQSpinBox::PlusMinus\fR - the buttons show \fB+\fR and \fB-\fR symbols. +\fCTQSpinBox::PlusMinus\fR - the buttons show \fB+\fR and \fB-\fR symbols. .PP -See also QSpinBox::buttonSymbols. +See also TQSpinBox::buttonSymbols. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QSpinBox::QSpinBox ( TQWidget * parent = 0, const char * name = 0 )" +.SH "TQSpinBox::TQSpinBox ( TQWidget * parent = 0, const char * name = 0 )" Constructs a spin box with the default QRangeControl range and step values. It is called \fIname\fR and has parent \fIparent\fR. .PP See also minValue, maxValue, setRange(), lineStep, and setSteps(). -.SH "QSpinBox::QSpinBox ( int minValue, int maxValue, int step = 1, TQWidget * parent = 0, const char * name = 0 )" +.SH "TQSpinBox::TQSpinBox ( int minValue, int maxValue, int step = 1, TQWidget * parent = 0, const char * name = 0 )" Constructs a spin box that allows values from \fIminValue\fR to \fImaxValue\fR inclusive, with step amount \fIstep\fR. The value is initially set to \fIminValue\fR. .PP The spin box is called \fIname\fR and has parent \fIparent\fR. .PP See also minValue, maxValue, setRange(), lineStep, and setSteps(). -.SH "QSpinBox::~QSpinBox ()" +.SH "TQSpinBox::~TQSpinBox ()" Destroys the spin box, freeing all memory and other resources. -.SH "ButtonSymbols QSpinBox::buttonSymbols () const" +.SH "ButtonSymbols TQSpinBox::buttonSymbols () const" Returns the current button symbol mode. See the "buttonSymbols" property for details. -.SH "TQString QSpinBox::cleanText () const\fC [virtual]\fR" +.SH "TQString TQSpinBox::cleanText () const\fC [virtual]\fR" Returns the spin box's text with no prefix(), suffix() or leading or trailing whitespace. See the "cleanText" property for details. -.SH "TQString QSpinBox::currentValueText ()\fC [protected]\fR" +.SH "TQString TQSpinBox::currentValueText ()\fC [protected]\fR" Returns the full text calculated from the current value, including any prefix and suffix. If there is special value text and the value is minValue() the specialValueText() is returned. -.SH "TQRect QSpinBox::downRect () const" +.SH "TQRect TQSpinBox::downRect () const" Returns the geometry of the "down" button. -.SH "QLineEdit * QSpinBox::editor () const\fC [protected]\fR" -Returns a pointer to the embedded QLineEdit. -.SH "bool QSpinBox::eventFilter ( TQObject * o, TQEvent * ev )\fC [virtual protected]\fR" -Intercepts and handles the events coming to the embedded QLineEdit that have special meaning for the QSpinBox. The object is passed as \fIo\fR and the event is passed as \fIev\fR. +.SH "TQLineEdit * TQSpinBox::editor () const\fC [protected]\fR" +Returns a pointer to the embedded TQLineEdit. +.SH "bool TQSpinBox::eventFilter ( TQObject * o, TQEvent * ev )\fC [virtual protected]\fR" +Intercepts and handles the events coming to the embedded TQLineEdit that have special meaning for the TQSpinBox. The object is passed as \fIo\fR and the event is passed as \fIev\fR. .PP Reimplemented from TQObject. -.SH "void QSpinBox::interpretText ()\fC [virtual protected]\fR" -QSpinBox calls this after the user has manually edited the contents of the spin box (i.e. by typing in the embedded QLineEdit, rather than using the up/down buttons/keys). +.SH "void TQSpinBox::interpretText ()\fC [virtual protected]\fR" +TQSpinBox calls this after the user has manually edited the contents of the spin box (i.e. by typing in the embedded TQLineEdit, rather than using the up/down buttons/keys). .PP The default implementation of this function interprets the new text using mapTextToValue(). If mapTextToValue() is successful, it changes the spin box's value; if not, the value is left unchanged. .PP See also editor(). -.SH "int QSpinBox::lineStep () const" +.SH "int TQSpinBox::lineStep () const" Returns the line step. See the "lineStep" property for details. -.SH "int QSpinBox::mapTextToValue ( bool * ok )\fC [virtual protected]\fR" +.SH "int TQSpinBox::mapTextToValue ( bool * ok )\fC [virtual protected]\fR" This virtual function is used by the spin box whenever it needs to interpret text entered by the user as a value. The text is available as text() and as cleanText(), and this function must parse it if possible. If \fIok\fR is not 0: if it parses the text successfully, \fI*ok\fR is set to TRUE; otherwise \fI*ok\fR is set to FALSE. .PP Subclasses that need to display spin box values in a non-numeric way need to reimplement this function. @@ -326,7 +326,7 @@ Note that TQt handles specialValueText() separately; this function is only conce The default implementation tries to interpret the text() as an integer in the standard way and returns the integer value. .PP See also interpretText() and mapValueToText(). -.SH "TQString QSpinBox::mapValueToText ( int v )\fC [virtual protected]\fR" +.SH "TQString TQSpinBox::mapValueToText ( int v )\fC [virtual protected]\fR" This virtual function is used by the spin box whenever it needs to display value \fIv\fR. The default implementation returns a string containing \fIv\fR printed in the standard way. Reimplementations may return anything. (See the example in the detailed description.) .PP Note that TQt does not call this function for specialValueText() and that neither prefix() nor suffix() are included in the return value. @@ -334,73 +334,73 @@ Note that TQt does not call this function for specialValueText() and that neithe If you reimplement this, you may also need to reimplement mapTextToValue(). .PP See also updateDisplay() and mapTextToValue(). -.SH "int QSpinBox::maxValue () const" +.SH "int TQSpinBox::maxValue () const" Returns the maximum value of the spin box. See the "maxValue" property for details. -.SH "int QSpinBox::minValue () const" +.SH "int TQSpinBox::minValue () const" Returns the minimum value of the spin box. See the "minValue" property for details. -.SH "TQString QSpinBox::prefix () const\fC [virtual]\fR" +.SH "TQString TQSpinBox::prefix () const\fC [virtual]\fR" Returns the spin box's prefix. See the "prefix" property for details. -.SH "void QSpinBox::rangeChange ()\fC [virtual protected]\fR" +.SH "void TQSpinBox::rangeChange ()\fC [virtual protected]\fR" This virtual function is called by QRangeControl whenever the range has changed. It adjusts the default validator and updates the display; if you need additional processing, you can reimplement this function. .PP Reimplemented from QRangeControl. -.SH "void QSpinBox::selectAll ()\fC [virtual slot]\fR" +.SH "void TQSpinBox::selectAll ()\fC [virtual slot]\fR" Selects all the text in the spin box's editor. -.SH "void QSpinBox::setButtonSymbols ( ButtonSymbols )\fC [virtual]\fR" +.SH "void TQSpinBox::setButtonSymbols ( ButtonSymbols )\fC [virtual]\fR" Sets the current button symbol mode. See the "buttonSymbols" property for details. -.SH "void QSpinBox::setLineStep ( int )" +.SH "void TQSpinBox::setLineStep ( int )" Sets the line step. See the "lineStep" property for details. -.SH "void QSpinBox::setMaxValue ( int )" +.SH "void TQSpinBox::setMaxValue ( int )" Sets the maximum value of the spin box. See the "maxValue" property for details. -.SH "void QSpinBox::setMinValue ( int )" +.SH "void TQSpinBox::setMinValue ( int )" Sets the minimum value of the spin box. See the "minValue" property for details. -.SH "void QSpinBox::setPrefix ( const TQString & text )\fC [virtual slot]\fR" +.SH "void TQSpinBox::setPrefix ( const TQString & text )\fC [virtual slot]\fR" Sets the spin box's prefix to \fItext\fR. See the "prefix" property for details. -.SH "void QSpinBox::setSpecialValueText ( const TQString & text )\fC [virtual]\fR" +.SH "void TQSpinBox::setSpecialValueText ( const TQString & text )\fC [virtual]\fR" Sets the special-value text to \fItext\fR. See the "specialValueText" property for details. -.SH "void QSpinBox::setSuffix ( const TQString & text )\fC [virtual slot]\fR" +.SH "void TQSpinBox::setSuffix ( const TQString & text )\fC [virtual slot]\fR" Sets the suffix of the spin box to \fItext\fR. See the "suffix" property for details. -.SH "void QSpinBox::setValidator ( const QValidator * v )\fC [virtual]\fR" +.SH "void TQSpinBox::setValidator ( const QValidator * v )\fC [virtual]\fR" Sets the validator to \fIv\fR. The validator controls what keyboard input is accepted when the user is editing in the value field. The default is to use a suitable QIntValidator. .PP Use setValidator(0) to turn off input validation (entered input will still be kept within the spin box's range). -.SH "void QSpinBox::setValue ( int value )\fC [virtual slot]\fR" +.SH "void TQSpinBox::setValue ( int value )\fC [virtual slot]\fR" Sets the value of the spin box to \fIvalue\fR. See the "value" property for details. -.SH "void QSpinBox::setWrapping ( bool on )\fC [virtual]\fR" +.SH "void TQSpinBox::setWrapping ( bool on )\fC [virtual]\fR" Sets whether it is possible to step the value from the highest value to the lowest value and vice versa to \fIon\fR. See the "wrapping" property for details. -.SH "TQString QSpinBox::specialValueText () const" +.SH "TQString TQSpinBox::specialValueText () const" Returns the special-value text. See the "specialValueText" property for details. -.SH "void QSpinBox::stepDown ()\fC [virtual slot]\fR" +.SH "void TQSpinBox::stepDown ()\fC [virtual slot]\fR" Decreases the spin box's value one lineStep(), wrapping as necessary if wrapping() is TRUE. This is the same as clicking on the pointing-down button and can be used for keyboard accelerators, for example. .PP See also stepUp(), subtractLine(), lineStep, setSteps(), value, and value. -.SH "void QSpinBox::stepUp ()\fC [virtual slot]\fR" +.SH "void TQSpinBox::stepUp ()\fC [virtual slot]\fR" Increases the spin box's value by one lineStep(), wrapping as necessary if wrapping() is TRUE. This is the same as clicking on the pointing-up button and can be used for keyboard accelerators, for example. .PP See also stepDown(), addLine(), lineStep, setSteps(), value, and value. -.SH "TQString QSpinBox::suffix () const\fC [virtual]\fR" +.SH "TQString TQSpinBox::suffix () const\fC [virtual]\fR" Returns the suffix of the spin box. See the "suffix" property for details. -.SH "TQString QSpinBox::text () const" +.SH "TQString TQSpinBox::text () const" Returns the spin box's text, including any prefix() and suffix(). See the "text" property for details. -.SH "void QSpinBox::textChanged ()\fC [protected slot]\fR" +.SH "void TQSpinBox::textChanged ()\fC [protected slot]\fR" This slot is called whenever the user edits the spin box's text. -.SH "TQRect QSpinBox::upRect () const" +.SH "TQRect TQSpinBox::upRect () const" Returns the geometry of the "up" button. -.SH "void QSpinBox::updateDisplay ()\fC [virtual protected]\fR" -Updates the contents of the embedded QLineEdit to reflect the current value using mapValueToText(). Also enables/disables the up/down push buttons accordingly. +.SH "void TQSpinBox::updateDisplay ()\fC [virtual protected]\fR" +Updates the contents of the embedded TQLineEdit to reflect the current value using mapValueToText(). Also enables/disables the up/down push buttons accordingly. .PP See also mapValueToText(). -.SH "const QValidator * QSpinBox::validator () const" +.SH "const QValidator * TQSpinBox::validator () const" Returns the validator that constrains editing for this spin box if there is any; otherwise returns 0. .PP See also setValidator() and QValidator. -.SH "int QSpinBox::value () const" +.SH "int TQSpinBox::value () const" Returns the value of the spin box. See the "value" property for details. -.SH "void QSpinBox::valueChange ()\fC [virtual protected]\fR" -This virtual function is called by QRangeControl whenever the value has changed. The QSpinBox reimplementation updates the display and emits the valueChanged() signals; if you need additional processing, either reimplement this or connect to one of the valueChanged() signals. +.SH "void TQSpinBox::valueChange ()\fC [virtual protected]\fR" +This virtual function is called by QRangeControl whenever the value has changed. The TQSpinBox reimplementation updates the display and emits the valueChanged() signals; if you need additional processing, either reimplement this or connect to one of the valueChanged() signals. .PP Reimplemented from QRangeControl. -.SH "void QSpinBox::valueChanged ( int value )\fC [signal]\fR" +.SH "void TQSpinBox::valueChanged ( int value )\fC [signal]\fR" This signal is emitted every time the value of the spin box changes; the new value is passed in \fIvalue\fR. This signal will be emitted as a result of a call to setValue(), or because the user changed the value by using a keyboard accelerator or mouse click, etc. .PP Note that the valueChanged() signal is emitted \fIevery\fR time, not just for the "last" step; i.e. if the user clicks "up" three times, this signal is emitted three times. @@ -409,7 +409,7 @@ See also value. .PP Examples: .)l listbox/listbox.cpp, qfd/fontdisplayer.cpp, and scribble/scribble.cpp. -.SH "void QSpinBox::valueChanged ( const TQString & valueText )\fC [signal]\fR" +.SH "void TQSpinBox::valueChanged ( const TQString & valueText )\fC [signal]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP This signal is emitted whenever the valueChanged( int ) signal is emitted, i.e. every time the value of the spin box changes (whatever the cause, e.g. by setValue(), by a keyboard accelerator, by mouse clicks, etc.). @@ -417,7 +417,7 @@ This signal is emitted whenever the valueChanged( int ) signal is emitted, i.e. The \fIvalueText\fR parameter is the same string that is displayed in the edit field of the spin box. .PP See also value, prefix, suffix, and specialValueText. -.SH "bool QSpinBox::wrapping () const" +.SH "bool TQSpinBox::wrapping () const" Returns TRUE if it is possible to step the value from the highest value to the lowest value and vice versa; otherwise returns FALSE. See the "wrapping" property for details. .SS "Property Documentation" .SH "ButtonSymbols buttonSymbols" @@ -447,7 +447,7 @@ Set this property's value with setLineStep() and get this property's value with .SH "int maxValue" This property holds the maximum value of the spin box. .PP -When setting this property, QSpinBox::minValue is adjusted, if necessary, to ensure that the range remains valid. +When setting this property, TQSpinBox::minValue is adjusted, if necessary, to ensure that the range remains valid. .PP See also setRange() and specialValueText. .PP @@ -455,7 +455,7 @@ Set this property's value with setMaxValue() and get this property's value with .SH "int minValue" This property holds the minimum value of the spin box. .PP -When setting this property, QSpinBox::maxValue is adjusted, if necessary, to ensure that the range remains valid. +When setting this property, TQSpinBox::maxValue is adjusted, if necessary, to ensure that the range remains valid. .PP See also setRange() and specialValueText. .PP @@ -487,7 +487,7 @@ For example, if your spin box allows the user to choose the margin width in a pr .PP .nf .br - QSpinBox marginBox( -1, 20, 1, parent, "marginBox" ); + TQSpinBox marginBox( -1, 20, 1, parent, "marginBox" ); .br marginBox->setSuffix( " mm" ); .br @@ -547,7 +547,7 @@ See also minValue, maxValue, and setRange(). Set this property's value with setWrapping() and get this property's value with wrapping(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqspinbox.html +.BR http://doc.trolltech.com/tqspinbox.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqsqleditorfactory.3qt b/doc/man/man3/tqsqleditorfactory.3qt index 33a8557d2..c468c09f9 100644 --- a/doc/man/man3/tqsqleditorfactory.3qt +++ b/doc/man/man3/tqsqleditorfactory.3qt @@ -40,7 +40,7 @@ Inherits TQEditorFactory. .SH DESCRIPTION The TQSqlEditorFactory class is used to create the editors used by TQDataTable and TQSqlForm. .PP -TQSqlEditorFactory is used by TQDataTable and TQSqlForm to automatically create appropriate editors for a given TQSqlField. For example if the field is a QVariant::String a QLineEdit would be the default editor, whereas a QVariant::Int's default editor would be a QSpinBox. +TQSqlEditorFactory is used by TQDataTable and TQSqlForm to automatically create appropriate editors for a given TQSqlField. For example if the field is a QVariant::String a TQLineEdit would be the default editor, whereas a QVariant::Int's default editor would be a TQSpinBox. .PP If you want to create different editors for fields with the same data type, subclass TQSqlEditorFactory and reimplement the createEditor() function. .PP diff --git a/doc/man/man3/tqsqlform.3qt b/doc/man/man3/tqsqlform.3qt index 73d2a1bfd..0ec8d2987 100644 --- a/doc/man/man3/tqsqlform.3qt +++ b/doc/man/man3/tqsqlform.3qt @@ -103,7 +103,7 @@ Some sample code to initialize a form successfully: .PP .nf .br - QLineEdit myEditor( this ); + TQLineEdit myEditor( this ); .br TQSqlForm myForm( this ); .br diff --git a/doc/man/man3/tqsqlpropertymap.3qt b/doc/man/man3/tqsqlpropertymap.3qt index a41aeb310..df317d2bb 100644 --- a/doc/man/man3/tqsqlpropertymap.3qt +++ b/doc/man/man3/tqsqlpropertymap.3qt @@ -48,7 +48,7 @@ The SQL module uses TQt object properties to insert and extract values from edit .PP This class is used to map editors to SQL fields. This works by associating SQL editor class names to the properties used to insert and extract values to/from the editor. .PP -For example, a QLineEdit can be used to edit text strings and other data types in TQDataTables or TQSqlForms. Several properties are defined in QLineEdit, but only the \fItext\fR property is used to insert and extract text from a QLineEdit. Both TQDataTable and TQSqlForm use the global TQSqlPropertyMap for inserting and extracting values to and from an editor widget. The global property map defines several common widgets and properties that are suitable for many applications. You can add and remove widget properties to suit your specific needs. +For example, a TQLineEdit can be used to edit text strings and other data types in TQDataTables or TQSqlForms. Several properties are defined in TQLineEdit, but only the \fItext\fR property is used to insert and extract text from a TQLineEdit. Both TQDataTable and TQSqlForm use the global TQSqlPropertyMap for inserting and extracting values to and from an editor widget. The global property map defines several common widgets and properties that are suitable for many applications. You can add and remove widget properties to suit your specific needs. .PP If you want to use custom editors with your TQDataTable or TQSqlForm, you must install your own TQSqlPropertyMap for that table or form. Example: .PP @@ -123,7 +123,7 @@ Constructs a TQSqlPropertyMap. .PP The default property mappings used by TQt widgets are:
            .nf .TS -l - l. Widgets Property QCheckBox, QRadioButton checked QComboBox, QListBox currentItem TQDateEdit date TQDateTimeEdit dateTime TQTextBrowser source QButton, QDial, TQLabel, QLineEdit, QMultiLineEdit, QPushButton, TQTextEdit, text TQTimeEdit time QLCDNumber, QScrollBar QSlider, QSpinBox +l - l. Widgets Property TQCheckBox, TQRadioButton checked TQComboBox, QListBox currentItem TQDateEdit date TQDateTimeEdit dateTime TQTextBrowser source QButton, TQDial, TQLabel, TQLineEdit, QMultiLineEdit, TQPushButton, TQTextEdit, text TQTimeEdit time TQLCDNumber, TQScrollBar TQSlider, TQSpinBox .TE .fi
            diff --git a/doc/man/man3/tqstyle.3qt b/doc/man/man3/tqstyle.3qt index 8f2ccd002..227736566 100644 --- a/doc/man/man3/tqstyle.3qt +++ b/doc/man/man3/tqstyle.3qt @@ -220,17 +220,17 @@ See also sizeFromContents(). .SH "TQStyle::ControlElement" This enum represents a ControlElement. A ControlElement is part of a widget that performs some action or displays information to the user. .TP -\fCTQStyle::CE_PushButton\fR - the bevel and default indicator of a QPushButton. +\fCTQStyle::CE_PushButton\fR - the bevel and default indicator of a TQPushButton. .TP -\fCTQStyle::CE_PushButtonLabel\fR - the label (iconset with text or pixmap) of a QPushButton. +\fCTQStyle::CE_PushButtonLabel\fR - the label (iconset with text or pixmap) of a TQPushButton. .TP -\fCTQStyle::CE_CheckBox\fR - the indicator of a QCheckBox. +\fCTQStyle::CE_CheckBox\fR - the indicator of a TQCheckBox. .TP -\fCTQStyle::CE_CheckBoxLabel\fR - the label (text or pixmap) of a QCheckBox. +\fCTQStyle::CE_CheckBoxLabel\fR - the label (text or pixmap) of a TQCheckBox. .TP -\fCTQStyle::CE_RadioButton\fR - the indicator of a QRadioButton. +\fCTQStyle::CE_RadioButton\fR - the indicator of a TQRadioButton. .TP -\fCTQStyle::CE_RadioButtonLabel\fR - the label (text or pixmap) of a QRadioButton. +\fCTQStyle::CE_RadioButtonLabel\fR - the label (text or pixmap) of a TQRadioButton. .TP \fCTQStyle::CE_TabBarTab\fR - the tab within a QTabBar (a QTab). .TP @@ -352,9 +352,9 @@ This enum represents a PixelMetric. A PixelMetric is a style dependent size repr .TP \fCTQStyle::PM_PopupMenuScrollerHeight\fR - height of the scroller area in a popupmenu. .TP -\fCTQStyle::PM_CheckListButtonSize\fR - area (width/height) of the checkbox/radiobutton in a QCheckListItem +\fCTQStyle::PM_CheckListButtonSize\fR - area (width/height) of the checkbox/radiobutton in a TQCheckListItem .TP -\fCTQStyle::PM_CheckListControllerSize\fR - area (width/height) of the controller in a QCheckListItem +\fCTQStyle::PM_CheckListControllerSize\fR - area (width/height) of the controller in a TQCheckListItem .TP \fCTQStyle::PM_DialogButtonsSeparator\fR - distance between buttons in a dialog buttons widget. .TP @@ -374,7 +374,7 @@ See also pixelMetric(). .SH "TQStyle::PrimitiveElement" This enum represents the PrimitiveElements of a style. A PrimitiveElement is a common GUI element, such as a checkbox indicator or pushbutton bevel. .TP -\fCTQStyle::PE_ButtonCommand\fR - button used to initiate an action, for example, a QPushButton. +\fCTQStyle::PE_ButtonCommand\fR - button used to initiate an action, for example, a TQPushButton. .TP \fCTQStyle::PE_ButtonDefault\fR - this button is the default button, e.g. in a dialog. .TP @@ -394,7 +394,7 @@ This enum represents the PrimitiveElements of a style. A PrimitiveElement is a c .TP \fCTQStyle::PE_ArrowLeft\fR - left arrow. .TP -\fCTQStyle::PE_SpinWidgetUp\fR - up symbol for a spin widget, for example a QSpinBox. +\fCTQStyle::PE_SpinWidgetUp\fR - up symbol for a spin widget, for example a TQSpinBox. .TP \fCTQStyle::PE_SpinWidgetDown\fR - down symbol for a spin widget. .TP @@ -402,11 +402,11 @@ This enum represents the PrimitiveElements of a style. A PrimitiveElement is a c .TP \fCTQStyle::PE_SpinWidgetMinus\fR - decrease symbol for a spin widget. .TP -\fCTQStyle::PE_Indicator\fR - on/off indicator, for example, a QCheckBox. +\fCTQStyle::PE_Indicator\fR - on/off indicator, for example, a TQCheckBox. .TP \fCTQStyle::PE_IndicatorMask\fR - bitmap mask for an indicator. .TP -\fCTQStyle::PE_ExclusiveIndicator\fR - exclusive on/off indicator, for example, a QRadioButton. +\fCTQStyle::PE_ExclusiveIndicator\fR - exclusive on/off indicator, for example, a TQRadioButton. .TP \fCTQStyle::PE_ExclusiveIndicatorMask\fR - bitmap mask for an exclusive indicator. .TP @@ -448,9 +448,9 @@ This enum represents the PrimitiveElements of a style. A PrimitiveElement is a c .TP \fCTQStyle::PE_SizeGrip\fR - window resize handle; see also TQSizeGrip. .TP -\fCTQStyle::PE_CheckMark\fR - generic check mark; see also QCheckBox. +\fCTQStyle::PE_CheckMark\fR - generic check mark; see also TQCheckBox. .TP -\fCTQStyle::PE_ScrollBarAddLine\fR - scrollbar line increase indicator (i.e. scroll down); see also QScrollBar. +\fCTQStyle::PE_ScrollBarAddLine\fR - scrollbar line increase indicator (i.e. scroll down); see also TQScrollBar. .TP \fCTQStyle::PE_ScrollBarSubLine\fR - scrollbar line decrease indicator (i.e. scroll up). .TP @@ -528,7 +528,7 @@ This enum represents a StyleHint. A StyleHint is a general look and/or feel hint .TP \fCTQStyle::SH_GUIStyle\fR - the GUI style to use. .TP -\fCTQStyle::SH_ScrollBar_BackgroundMode\fR - the background mode for a QScrollBar. Possible values are any of those in the BackgroundMode enum. +\fCTQStyle::SH_ScrollBar_BackgroundMode\fR - the background mode for a TQScrollBar. Possible values are any of those in the BackgroundMode enum. .TP \fCTQStyle::SH_ScrollBar_MiddleClickAbsolutePosition\fR - a boolean value. If TRUE, middle clicking on a scrollbar causes the slider to jump to that position. If FALSE, the middle clicking is ignored. .TP @@ -648,7 +648,7 @@ This enum represents a SubControl within a ComplexControl. .TP \fCTQStyle::SC_None\fR - special value that matches no other SubControl. .TP -\fCTQStyle::SC_ScrollBarAddLine\fR - scrollbar add line (i.e. down/right arrow); see also QScrollbar. +\fCTQStyle::SC_ScrollBarAddLine\fR - scrollbar add line (i.e. down/right arrow); see also TQScrollbar. .TP \fCTQStyle::SC_ScrollBarSubLine\fR - scrollbar sub line (i.e. up/left arrow). .TP @@ -664,7 +664,7 @@ This enum represents a SubControl within a ComplexControl. .TP \fCTQStyle::SC_ScrollBarGroove\fR - special subcontrol which contains the area in which the slider handle may move. .TP -\fCTQStyle::SC_SpinWidgetUp\fR - spinwidget up/increase; see also QSpinBox. +\fCTQStyle::SC_SpinWidgetUp\fR - spinwidget up/increase; see also TQSpinBox. .TP \fCTQStyle::SC_SpinWidgetDown\fR - spinwidget down/decrease. .TP @@ -674,7 +674,7 @@ This enum represents a SubControl within a ComplexControl. .TP \fCTQStyle::SC_SpinWidgetButtonField\fR - spinwidget button field. .TP -\fCTQStyle::SC_ComboBoxEditField\fR - combobox edit field; see also QComboBox. +\fCTQStyle::SC_ComboBoxEditField\fR - combobox edit field; see also TQComboBox. .TP \fCTQStyle::SC_ComboBoxArrow\fR - combobox arrow .TP @@ -793,7 +793,7 @@ The \fIwidget\fR argument is a pointer to a TQWidget or one of its subclasses. T .TS l - l. ComplexControl .br -& Widget Cast Style Flags Notes Options Notes CC_SpinWidget(const QSpinWidget *) Style_Enabled Set if the spinwidget is enabled. Unused. Style_HasFocus Set if the spinwidget has input focus. CC_ComboBox(const QComboBox *) Style_Enabled Set if the combobox is enabled. Unused. Style_HasFocus Set if the combobox has input focus. CC_ScrollBar(const QScrollBar *) Style_Enabled Set if the scrollbar is enabled. Unused. Style_HasFocus Set if the scrollbar has input focus. CC_Slider(const QSlider *) Style_Enabled Set if the slider is enabled. Unused. Style_HasFocus Set if the slider has input focus. CC_ToolButton(const TQToolButton *) Style_Enabled Set if the toolbutton is enabled. TQStyleOption ( ArrowType t ) +& Widget Cast Style Flags Notes Options Notes CC_SpinWidget(const TQSpinWidget *) Style_Enabled Set if the spinwidget is enabled. Unused. Style_HasFocus Set if the spinwidget has input focus. CC_ComboBox(const TQComboBox *) Style_Enabled Set if the combobox is enabled. Unused. Style_HasFocus Set if the combobox has input focus. CC_ScrollBar(const TQScrollBar *) Style_Enabled Set if the scrollbar is enabled. Unused. Style_HasFocus Set if the scrollbar has input focus. CC_Slider(const TQSlider *) Style_Enabled Set if the slider is enabled. Unused. Style_HasFocus Set if the slider has input focus. CC_ToolButton(const TQToolButton *) Style_Enabled Set if the toolbutton is enabled. TQStyleOption ( ArrowType t ) .TP opt.arrowType() When the tool button only contains an arrow, \fIt\fR is the arrow's type. Style_HasFocus Set if the toolbutton has input focus. Style_Down Set if the toolbutton is down (ie. mouse button or space pressed). Style_On Set if the toolbutton is a toggle button and is toggled on. Style_AutoRaise Set if the toolbutton has auto-raise enabled. Style_Raised Set if the button is not down, not on and doesn't contain the mouse when auto-raise is enabled. CC_TitleBar(const TQWidget *) Style_Enabled Set if the titlebar is enabled. Unused. CC_ListView(const QListView *) Style_Enabled Set if the titlebar is enabled. TQStyleOption ( QListViewItem *item ) .TP @@ -822,21 +822,21 @@ The \fIwidget\fR argument is a pointer to a TQWidget or one of its subclasses. T .TS l - l. ControlElement .br -& Widget Cast Style Flags Notes Options Notes CE_PushButton(const QPushButton *) +& Widget Cast Style Flags Notes Options Notes CE_PushButton(const TQPushButton *) .PP and .PP -CE_PushButtonLabel(const QPushButton *) Style_Enabled Set if the button is enabled. Unused. Style_HasFocus Set if the button has input focus. Style_Raised Set if the button is not down, not on and not flat. Style_On Set if the button is a toggle button and toggled on. Style_Down Set if the button is down (i.e., the mouse button or space bar is pressed on the button). Style_ButtonDefault Set if the button is a default button. CE_CheckBox(const QCheckBox *) +CE_PushButtonLabel(const TQPushButton *) Style_Enabled Set if the button is enabled. Unused. Style_HasFocus Set if the button has input focus. Style_Raised Set if the button is not down, not on and not flat. Style_On Set if the button is a toggle button and toggled on. Style_Down Set if the button is down (i.e., the mouse button or space bar is pressed on the button). Style_ButtonDefault Set if the button is a default button. CE_CheckBox(const TQCheckBox *) .PP and .PP -CE_CheckBoxLabel(const QCheckBox *) +CE_CheckBoxLabel(const TQCheckBox *) .PP Style_Enabled Set if the checkbox is enabled. Unused. -Style_HasFocus Set if the checkbox has input focus. Style_On Set if the checkbox is checked. Style_Off Set if the checkbox is not checked. Style_NoChange Set if the checkbox is in the NoChange state. Style_Down Set if the checkbox is down (i.e., the mouse button or space bar is pressed on the button). CE_RadioButton(const QRadioButton *) +Style_HasFocus Set if the checkbox has input focus. Style_On Set if the checkbox is checked. Style_Off Set if the checkbox is not checked. Style_NoChange Set if the checkbox is in the NoChange state. Style_Down Set if the checkbox is down (i.e., the mouse button or space bar is pressed on the button). CE_RadioButton(const TQRadioButton *) .PP and .PP -CE_RadioButtonLabel(const QRadioButton *) Style_Enabled Set if the radiobutton is enabled. Unused. Style_HasFocus Set if the radiobutton has input focus. Style_On Set if the radiobutton is checked. Style_Off Set if the radiobutton is not checked. Style_Down Set if the radiobutton is down (i.e., the mouse button or space bar is pressed on the radiobutton). CE_TabBarTab(const QTabBar *) +CE_RadioButtonLabel(const TQRadioButton *) Style_Enabled Set if the radiobutton is enabled. Unused. Style_HasFocus Set if the radiobutton has input focus. Style_On Set if the radiobutton is checked. Style_Off Set if the radiobutton is not checked. Style_Down Set if the radiobutton is down (i.e., the mouse button or space bar is pressed on the radiobutton). CE_TabBarTab(const QTabBar *) .PP and .PP @@ -939,7 +939,7 @@ Returns the pixel metric for \fImetric\fR. The \fIwidget\fR argument is a pointe .PP
            .nf .TS -l - l. PixelMetric Widget Cast PM_SliderControlThickness (const QSlider *) PM_SliderLength (const QSlider *) PM_SliderTickmarkOffset (const QSlider *) PM_SliderSpaceAvailable (const QSlider *) PM_TabBarTabOverlap (const QTabBar *) PM_TabBarTabHSpace (const QTabBar *) PM_TabBarTabVSpace (const QTabBar *) PM_TabBarBaseHeight (const QTabBar *) PM_TabBarBaseOverlap +l - l. PixelMetric Widget Cast PM_SliderControlThickness (const TQSlider *) PM_SliderLength (const TQSlider *) PM_SliderTickmarkOffset (const TQSlider *) PM_SliderSpaceAvailable (const TQSlider *) PM_TabBarTabOverlap (const QTabBar *) PM_TabBarTabHSpace (const QTabBar *) PM_TabBarTabVSpace (const QTabBar *) PM_TabBarBaseHeight (const QTabBar *) PM_TabBarBaseOverlap .TE .fi
            @@ -988,7 +988,7 @@ The \fIwidget\fR argument is a pointer to a TQWidget or one of its subclasses. T .PP
            .nf .TS -l - l. ContentsType Widget Cast Options Notes CT_PushButton (const QPushButton *) Unused. CT_CheckBox (const QCheckBox *) Unused. CT_RadioButton (const QRadioButton *) Unused. CT_ToolButton (const TQToolButton *) Unused. CT_ComboBox (const QComboBox *) Unused. CT_Splitter (const QSplitter *) Unused. CT_DockWindow (const QDockWindow *) Unused. CT_ProgressBar (const QProgressBar *) Unused. CT_PopupMenuItem (const TQPopupMenu *) TQStyleOption ( TQMenuItem *mi ) +l - l. ContentsType Widget Cast Options Notes CT_PushButton (const TQPushButton *) Unused. CT_CheckBox (const TQCheckBox *) Unused. CT_RadioButton (const TQRadioButton *) Unused. CT_ToolButton (const TQToolButton *) Unused. CT_ComboBox (const TQComboBox *) Unused. CT_Splitter (const QSplitter *) Unused. CT_DockWindow (const QDockWindow *) Unused. CT_ProgressBar (const QProgressBar *) Unused. CT_PopupMenuItem (const TQPopupMenu *) TQStyleOption ( TQMenuItem *mi ) .TP opt.menuItem() .TE @@ -1020,7 +1020,7 @@ The \fIwidget\fR argument is a pointer to a TQWidget or one of its subclasses. T .PP
            .nf .TS -l - l. SubRect Widget Cast SR_PushButtonContents (const QPushButton *) SR_PushButtonFocusRect (const QPushButton *) SR_CheckBoxIndicator (const QCheckBox *) SR_CheckBoxContents (const QCheckBox *) SR_CheckBoxFocusRect (const QCheckBox *) SR_RadioButtonIndicator (const QRadioButton *) SR_RadioButtonContents (const QRadioButton *) SR_RadioButtonFocusRect (const QRadioButton *) SR_ComboBoxFocusRect (const QComboBox *) SR_DockWindowHandleRect (const TQWidget *) SR_ProgressBarGroove (const QProgressBar *) SR_ProgressBarContents (const QProgressBar *) SR_ProgressBarLabel +l - l. SubRect Widget Cast SR_PushButtonContents (const TQPushButton *) SR_PushButtonFocusRect (const TQPushButton *) SR_CheckBoxIndicator (const TQCheckBox *) SR_CheckBoxContents (const TQCheckBox *) SR_CheckBoxFocusRect (const TQCheckBox *) SR_RadioButtonIndicator (const TQRadioButton *) SR_RadioButtonContents (const TQRadioButton *) SR_RadioButtonFocusRect (const TQRadioButton *) SR_ComboBoxFocusRect (const TQComboBox *) SR_DockWindowHandleRect (const TQWidget *) SR_ProgressBarGroove (const QProgressBar *) SR_ProgressBarContents (const QProgressBar *) SR_ProgressBarLabel .TE .fi
            diff --git a/doc/man/man3/tqstyleoption.3qt b/doc/man/man3/tqstyleoption.3qt index e51c82131..7731f990b 100644 --- a/doc/man/man3/tqstyleoption.3qt +++ b/doc/man/man3/tqstyleoption.3qt @@ -47,7 +47,7 @@ TQStyleOption \- Optional parameters for TQStyle functions .BI "\fBTQStyleOption\fR ( QListViewItem * i )" .br .ti -1c -.BI "\fBTQStyleOption\fR ( QCheckListItem * i )" +.BI "\fBTQStyleOption\fR ( TQCheckListItem * i )" .br .ti -1c .BI "\fBTQStyleOption\fR ( TQt::ArrowType a )" @@ -95,7 +95,7 @@ TQStyleOption \- Optional parameters for TQStyle functions .BI "QTab * \fBtab\fR () const" .br .ti -1c -.BI "QCheckListItem * \fBcheckListItem\fR () const" +.BI "TQCheckListItem * \fBcheckListItem\fR () const" .br .ti -1c .BI "QListViewItem * \fBlistViewItem\fR () const" @@ -152,8 +152,8 @@ Pass a color, \fIc\fR. Pass a QTab, \fIt\fR. .SH "TQStyleOption::TQStyleOption ( QListViewItem * i )" Pass a QListViewItem, \fIi\fR. -.SH "TQStyleOption::TQStyleOption ( QCheckListItem * i )" -Pass a QCheckListItem, \fIi\fR. +.SH "TQStyleOption::TQStyleOption ( TQCheckListItem * i )" +Pass a TQCheckListItem, \fIi\fR. .SH "TQStyleOption::TQStyleOption ( TQt::ArrowType a )" Pass an TQt::ArrowType, \fIa\fR. .SH "TQStyleOption::TQStyleOption ( const TQRect & r )" @@ -162,7 +162,7 @@ Pass a TQRect, \fIr\fR. Pass a TQWidget, \fIw\fR. .SH "TQt::ArrowType TQStyleOption::arrowType () const" Returns an arrow type if the appropriate constructor was called; otherwise the return value is undefined. -.SH "QCheckListItem * TQStyleOption::checkListItem () const" +.SH "TQCheckListItem * TQStyleOption::checkListItem () const" Returns a check list item if the appropriate constructor was called; otherwise the return value is undefined. .SH "const TQColor & TQStyleOption::color () const" Returns a color if the appropriate constructor was called; otherwise the return value is undefined. diff --git a/doc/man/man3/tqt.3qt b/doc/man/man3/tqt.3qt index 5fcbc99a5..648cf3870 100644 --- a/doc/man/man3/tqt.3qt +++ b/doc/man/man3/tqt.3qt @@ -1052,7 +1052,7 @@ This type is used to signify an object's orientation. .TP \fCQt::Vertical\fR .PP -Orientation is used with QScrollBar for example. +Orientation is used with TQScrollBar for example. .SH "TQt::PaintUnit" .TP \fCQt::PixelUnit\fR @@ -1282,7 +1282,7 @@ There are also a number of flags which you can use to customize the appearance o .TP \fCQt::WStyle_StaysOnTop\fR - informs the window system that the window should stay on top of all other windows. Note that on some window managers on X11 you also have to pass WX11BypassWM for this flag to work correctly. .TP -\fCQt::WStyle_Dialog\fR - indicates that the window is a logical subwindow of its parent (i.e. a dialog). The window will not get its own taskbar entry and will be kept on top of its parent by the window system. Usually it will also be minimized when the parent is minimized. If not customized, the window is decorated with a slightly simpler title bar. This is the flag QDialog uses. +\fCQt::WStyle_Dialog\fR - indicates that the window is a logical subwindow of its parent (i.e. a dialog). The window will not get its own taskbar entry and will be kept on top of its parent by the window system. Usually it will also be minimized when the parent is minimized. If not customized, the window is decorated with a slightly simpler title bar. This is the flag TQDialog uses. .TP \fCQt::WStyle_Splash\fR - indicates that the window is a splash screen. On X11, we try to follow NETWM standard for a splash screen window if the window manager supports is otherwise it is equivalent to WX11BypassWM. On other platforms, it is equivalent to WStyle_NoBorder \fC|\fR WMacNoSheet \fC|\fR WStyle_Tool \fC|\fR WWinOwnDC .PP diff --git a/doc/man/man3/tqtabdialog.3qt b/doc/man/man3/tqtabdialog.3qt index 1206c06da..6dbc626e7 100644 --- a/doc/man/man3/tqtabdialog.3qt +++ b/doc/man/man3/tqtabdialog.3qt @@ -11,7 +11,7 @@ QTabDialog \- Stack of tabbed widgets .SH SYNOPSIS \fC#include \fR .PP -Inherits QDialog. +Inherits TQDialog. .PP .SS "Public Members" .in +1c @@ -188,7 +188,7 @@ Each tab is either enabled or disabled at any given time (see setTabEnabled()). .PP You can change a tab's label and iconset using changeTab(). A tab page can be removed with removePage() and shown with showPage(). The current page is given by currentPage(). .PP -QTabDialog does not support tabs on the sides or bottom, nor can you set or retrieve the visible page. If you need more functionality than QTabDialog provides, consider creating a QDialog and using a QTabBar with QTabWidgets. +QTabDialog does not support tabs on the sides or bottom, nor can you set or retrieve the visible page. If you need more functionality than QTabDialog provides, consider creating a TQDialog and using a QTabBar with QTabWidgets. .PP Most of the functionality in QTabDialog is provided by a QTabWidget. .PP @@ -199,10 +199,10 @@ Most of the functionality in QTabDialog is provided by a QTabWidget. .ce 1 .B "[Image Omitted]" .PP -See also QDialog and Dialog Classes. +See also TQDialog and Dialog Classes. .SH MEMBER FUNCTION DOCUMENTATION .SH "QTabDialog::QTabDialog ( TQWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )" -Constructs a QTabDialog with only an OK button. The \fIparent\fR, \fIname\fR, \fImodal\fR and widget flag, \fIf\fR, arguments are passed on to the QDialog constructor. +Constructs a QTabDialog with only an OK button. The \fIparent\fR, \fIname\fR, \fImodal\fR and widget flag, \fIf\fR, arguments are passed on to the TQDialog constructor. .SH "QTabDialog::~QTabDialog ()" Destroys the tab dialog. .SH "void QTabDialog::aboutToShow ()\fC [signal]\fR" @@ -238,7 +238,7 @@ It should be connected to a slot (or several slots) that change the application' .PP See also cancelButtonPressed(), defaultButtonPressed(), and setApplyButton(). .SH "void QTabDialog::cancelButtonPressed ()\fC [signal]\fR" -This signal is emitted when the Cancel button is clicked. It is automatically connected to QDialog::reject(), which will hide the dialog. +This signal is emitted when the Cancel button is clicked. It is automatically connected to TQDialog::reject(), which will hide the dialog. .PP The Cancel button should not change the application's state at all, so you should generally not need to connect it to any slot. .PP diff --git a/doc/man/man3/tqtable.3qt b/doc/man/man3/tqtable.3qt index 42d62234a..54930c9a4 100644 --- a/doc/man/man3/tqtable.3qt +++ b/doc/man/man3/tqtable.3qt @@ -11,7 +11,7 @@ QTable \- Flexible editable table widget .SH SYNOPSIS \fC#include \fR .PP -Inherits QScrollView. +Inherits TQScrollView. .PP Inherited by TQDataTable. .PP @@ -489,9 +489,9 @@ QTable is easy to use, although it does have a large API because of the comprehe .br .fi .PP -The first line constructs the table specifying its size in rows and columns. We then insert a pixmap and some text into the \fIsame\fR cell, with the pixmap appearing to the left of the text. QTable cells can be populated with QTableItems, QComboTableItems or by QCheckTableItems. By default a vertical header appears at the left of the table showing row numbers and a horizontal header appears at the top of the table showing column numbers. (The numbers displayed start at 1, although row and column numbers within QTable begin at 0.) +The first line constructs the table specifying its size in rows and columns. We then insert a pixmap and some text into the \fIsame\fR cell, with the pixmap appearing to the left of the text. QTable cells can be populated with QTableItems, TQComboTableItems or by TQCheckTableItems. By default a vertical header appears at the left of the table showing row numbers and a horizontal header appears at the top of the table showing column numbers. (The numbers displayed start at 1, although row and column numbers within QTable begin at 0.) .PP -If you want to use mouse tracking call setMouseTracking( TRUE ) on the \fIviewport\fR; (see QScrollView). +If you want to use mouse tracking call setMouseTracking( TRUE ) on the \fIviewport\fR; (see TQScrollView). .PP
            .ce 1 @@ -521,21 +521,21 @@ All of a QTable's cells are empty when the table is constructed. .PP There are two approaches to populating the table's cells. The first and simplest approach is to use QTableItems or QTableItem subclasses. The second approach doesn't use QTableItems at all which is useful for very large sparse tables but requires you to reimplement a number of functions. We'll look at each approach in turn. .PP -To put a string in a cell use setText(). This function will create a new QTableItem for the cell if one doesn't already exist, and displays the text in it. By default the table item's widget will be a QLineEdit. A pixmap may be put in a cell with setPixmap(), which also creates a table item if required. A cell may contain \fIboth\fR a pixmap and text; the pixmap is displayed to the left of the text. Another approach is to construct a QTableItem or QTableItem subclass, set its properties, then insert it into a cell with setItem(). +To put a string in a cell use setText(). This function will create a new QTableItem for the cell if one doesn't already exist, and displays the text in it. By default the table item's widget will be a TQLineEdit. A pixmap may be put in a cell with setPixmap(), which also creates a table item if required. A cell may contain \fIboth\fR a pixmap and text; the pixmap is displayed to the left of the text. Another approach is to construct a QTableItem or QTableItem subclass, set its properties, then insert it into a cell with setItem(). .PP -If you want cells which contain comboboxes use the QComboTableItem class. Similarly if you require cells containing checkboxes use the QCheckTableItem class. These table items look and behave just like the combobox or checkbox widgets but consume far less memory. +If you want cells which contain comboboxes use the TQComboTableItem class. Similarly if you require cells containing checkboxes use the TQCheckTableItem class. These table items look and behave just like the combobox or checkbox widgets but consume far less memory. .PP .nf .br for ( int j = 0; j < numRows; ++j ) .br - table.setItem( j, 1, new QCheckTableItem( &table, "Check me" ) ); + table.setItem( j, 1, new TQCheckTableItem( &table, "Check me" ) ); .fi -In the example above we create a column of QCheckTableItems and insert them into the table using setItem(). +In the example above we create a column of TQCheckTableItems and insert them into the table using setItem(). .PP QTable takes ownership of its QTableItems and will delete them when the table itself is destroyed. You can take ownership of a table item using takeItem() which you use to move a cell's contents from one cell to another, either within the same table, or from one table to another. (See also, swapCells()). .PP -In-place editing of the text in QTableItems, and the values in QComboTableItems and QCheckTableItems works automatically. Cells may be editable or read-only, see QTableItem::EditType. If you want fine control over editing see beginEdit() and endEdit(). +In-place editing of the text in QTableItems, and the values in TQComboTableItems and TQCheckTableItems works automatically. Cells may be editable or read-only, see QTableItem::EditType. If you want fine control over editing see beginEdit() and endEdit(). .PP The contents of a cell can be retrieved as a QTableItem using item(), or as a string with text() or as a pixmap (if there is one) with pixmap(). A cell's bounding rectangle is given by cellGeometry(). Use updateCell() to repaint a cell, for example to clear away a cell's visual representation after it has been deleted with clearCell(). The table can be forced to scroll to show a particular cell with ensureCellVisible(). The isSelected() function indicates if a cell is selected. .PP @@ -600,7 +600,7 @@ See also TQWidget::clearWFlags() and TQt::WidgetFlags. .SH "QTable::QTable ( int numRows, int numCols, TQWidget * parent = 0, const char * name = 0 )" Constructs an empty table called \fIname\fR with \fInumRows\fR rows and \fInumCols\fR columns. The table is a child of \fIparent\fR. .PP -If you're using QTableItems to populate the table's cells, you can create QTableItem, QComboTableItem and QCheckTableItem items and insert them into the table using setItem(). (See the notes on large tables for an alternative to using QTableItems.) +If you're using QTableItems to populate the table's cells, you can create QTableItem, TQComboTableItem and TQCheckTableItem items and insert them into the table using setItem(). (See the notes on large tables for an alternative to using QTableItems.) .PP See also TQWidget::clearWFlags() and TQt::WidgetFlags. .SH "QTable::~QTable ()" @@ -698,21 +698,21 @@ This event handler is called whenever a QTable object receives a TQDragEnterEven .PP The focus is moved to the cell where the TQDragEnterEvent occurred. .PP -Reimplemented from QScrollView. +Reimplemented from TQScrollView. .SH "void QTable::contentsDragLeaveEvent ( TQDragLeaveEvent * e )\fC [virtual protected]\fR" This event handler is called when a drag activity leaves \fIthis\fR QTable object with event \fIe\fR. .PP -Reimplemented from QScrollView. +Reimplemented from TQScrollView. .SH "void QTable::contentsDragMoveEvent ( TQDragMoveEvent * e )\fC [virtual protected]\fR" This event handler is called whenever a QTable object receives a TQDragMoveEvent \fIe\fR, i.e. when the user actually drags the mouse. .PP The focus is moved to the cell where the TQDragMoveEvent occurred. .PP -Reimplemented from QScrollView. +Reimplemented from TQScrollView. .SH "void QTable::contentsDropEvent ( TQDropEvent * e )\fC [virtual protected]\fR" This event handler is called when the user ends a drag and drop by dropping something onto \fIthis\fR QTable and thus triggers the drop event, \fIe\fR. .PP -Reimplemented from QScrollView. +Reimplemented from TQScrollView. .SH "void QTable::contextMenuRequested ( int row, int col, const TQPoint & pos )\fC [signal]\fR" This signal is emitted when the user invokes a context menu with the right mouse button (or with a system-specific keypress). The cell where the event took place is at \fIrow\fR, \fIcol\fR. \fIpos\fR is the position where the context menu will appear in the global coordinate system. This signal is always emitted, even if the contents of the cell are disabled. .SH "TQWidget * QTable::createEditor ( int row, int col, bool initFromCell ) const\fC [virtual protected]\fR" @@ -720,11 +720,11 @@ This function returns the widget which should be used as an editor for the conte .PP If \fIinitFromCell\fR is TRUE, the editor is used to edit the current contents of the cell (so the editor widget should be initialized with this content). If \fIinitFromCell\fR is FALSE, the content of the cell is replaced with the new content which the user entered into the widget created by this function. .PP -The default functionality is as follows: if \fIinitFromCell\fR is TRUE or the cell has a QTableItem and the table item's QTableItem::isReplaceable() is FALSE then the cell is asked to create an appropriate editor (using QTableItem::createEditor()). Otherwise a QLineEdit is used as the editor. +The default functionality is as follows: if \fIinitFromCell\fR is TRUE or the cell has a QTableItem and the table item's QTableItem::isReplaceable() is FALSE then the cell is asked to create an appropriate editor (using QTableItem::createEditor()). Otherwise a TQLineEdit is used as the editor. .PP If you want to create your own editor for certain cells, implement a custom QTableItem subclass and reimplement QTableItem::createEditor(). .PP -If you are not using QTableItems and you don't want to use a QLineEdit as the default editor, subclass QTable and reimplement this function with code like this: +If you are not using QTableItems and you don't want to use a TQLineEdit as the default editor, subclass QTable and reimplement this function with code like this: .PP .nf .br @@ -789,7 +789,7 @@ Draws the table contents on the painter \fIp\fR. This function is optimized so t .PP Additionally, drawContents() highlights the current cell. .PP -Reimplemented from QScrollView. +Reimplemented from TQScrollView. .SH "void QTable::dropped ( TQDropEvent * e )\fC [signal]\fR" This signal is emitted when a drop event occurred on the table. .PP @@ -1138,7 +1138,7 @@ Sets the pixmap in the cell at \fIrow\fR, \fIcol\fR to \fIpix\fR. .PP If the cell does not contain a table item a QTableItem is created with an EditType of \fCOnTyping\fR, otherwise the existing table item's pixmap (if any) is replaced with \fIpix\fR. .PP -Note that QComboTableItems and QCheckTableItems don't show pixmaps. +Note that TQComboTableItems and TQCheckTableItems don't show pixmaps. .PP See also pixmap(), setText(), setItem(), and QTableItem::setPixmap(). .PP diff --git a/doc/man/man3/tqtableitem.3qt b/doc/man/man3/tqtableitem.3qt index 563a3908d..94edc175d 100644 --- a/doc/man/man3/tqtableitem.3qt +++ b/doc/man/man3/tqtableitem.3qt @@ -13,7 +13,7 @@ QTableItem \- The cell content for QTable cells .PP Inherits Qt. .PP -Inherited by QComboTableItem and QCheckTableItem. +Inherited by TQComboTableItem and TQCheckTableItem. .PP .SS "Public Members" .in +1c @@ -116,7 +116,7 @@ The QTableItem class provides the cell content for QTable cells. .PP For many applications QTableItems are ideal for presenting and editing the contents of QTable cells. In situations where you need to create very large tables you may prefer an alternative approach to using QTableItems: see the notes on large tables. .PP -A QTableItem contains a cell's data, by default, a string and a pixmap. The table item also holds the cell's display size and how the data should be aligned. The table item specifies the cell's EditType and the editor used for in-place editing (by default a QLineEdit). If you want checkboxes use QCheckTableItem, and if you want comboboxes use QComboTableItem. The EditType (set in the constructor) determines whether the cell's contents may be edited. +A QTableItem contains a cell's data, by default, a string and a pixmap. The table item also holds the cell's display size and how the data should be aligned. The table item specifies the cell's EditType and the editor used for in-place editing (by default a TQLineEdit). If you want checkboxes use TQCheckTableItem, and if you want comboboxes use TQComboTableItem. The EditType (set in the constructor) determines whether the cell's contents may be edited. .PP If a pixmap is specified it is displayed to the left of any text. You can change the text or pixmap with setText() and setPixmap() respectively. For text you can use setWordWrap(). .PP @@ -148,9 +148,9 @@ Table items can be deleted with delete in the standard way; the table and cell w .PP Note, that if you have a table item that is not currently in a table then anything you do to that item other than insert it into a table will result in undefined behaviour. .PP -Reimplement createEditor() and setContentFromEditor() if you want to use your own widget instead of a QLineEdit for editing cell contents. Reimplement paint() if you want to display custom content. +Reimplement createEditor() and setContentFromEditor() if you want to use your own widget instead of a TQLineEdit for editing cell contents. Reimplement paint() if you want to display custom content. .PP -It is important to ensure that your custom widget can accept the keyboard focus, so that the user can use the tab key to navigate the table as normal. Therefore, if the widget returned by createEditor() does not itself accept the keyboard focus, it is necessary to nominate a child widget to do so on its behalf. For example, a QHBox with two child QLineEdit widgets may use one of them to accept the keyboard focus: +It is important to ensure that your custom widget can accept the keyboard focus, so that the user can use the tab key to navigate the table as normal. Therefore, if the widget returned by createEditor() does not itself accept the keyboard focus, it is necessary to nominate a child widget to do so on its behalf. For example, a QHBox with two child TQLineEdit widgets may use one of them to accept the keyboard focus: .PP .nf .br @@ -160,9 +160,9 @@ It is important to ensure that your custom widget can accept the keyboard focus, .br QHBox* hbox = new QHBox( table()->viewport() ); .br - hbox->setFocusProxy(new QLineEdit( hbox )); + hbox->setFocusProxy(new TQLineEdit( hbox )); .br - new QLineEdit( hbox ); + new TQLineEdit( hbox ); .br return hbox; .br @@ -178,7 +178,7 @@ By default, table items may be replaced by new QTableItems during the lifetime o .PP
            .PP -See also QCheckTableItem, QComboTableItem, and Advanced Widgets. +See also TQCheckTableItem, TQComboTableItem, and Advanced Widgets. .PP .SS "Member Type Documentation" .SH "QTableItem::EditType" @@ -186,7 +186,7 @@ This enum is used to define whether a cell is editable or read-only (in conjunct .TP \fCQTableItem::Always\fR - The cell always \fIlooks\fR editable. .PP -Using this EditType ensures that the editor created with createEditor() (by default a QLineEdit) is always visible. This has implications for the alignment of the content: the default editor aligns everything (even numbers) to the left whilst numerical values in the cell are by default aligned to the right. +Using this EditType ensures that the editor created with createEditor() (by default a TQLineEdit) is always visible. This has implications for the alignment of the content: the default editor aligns everything (even numbers) to the left whilst numerical values in the cell are by default aligned to the right. .PP If a cell with the edit type Always looks misaligned you could reimplement createEditor() for these items. .TP @@ -200,25 +200,25 @@ The OnTyping edit type is the default when QTableItem objects are created by the .PP The cell is actually editable only if QTable::isRowReadOnly() is FALSE for its row, QTable::isColumnReadOnly() is FALSE for its column, and QTable::isReadOnly() is FALSE. .PP -QComboTableItems have an isEditable() property. This property is used to indicate whether the user may enter their own text or are restricted to choosing one of the choices in the list. QComboTableItems may be interacted with only if they are editable in accordance with their EditType as described above. +TQComboTableItems have an isEditable() property. This property is used to indicate whether the user may enter their own text or are restricted to choosing one of the choices in the list. TQComboTableItems may be interacted with only if they are editable in accordance with their EditType as described above. .PP .SH MEMBER FUNCTION DOCUMENTATION .SH "QTableItem::QTableItem ( QTable * table, EditType et )" Creates a table item that is a child of table \fItable\fR with no text. The item has the EditType \fIet\fR. .PP -The table item will use a QLineEdit for its editor, will not word-wrap and will occupy a single cell. Insert the table item into a table with QTable::setItem(). +The table item will use a TQLineEdit for its editor, will not word-wrap and will occupy a single cell. Insert the table item into a table with QTable::setItem(). .PP The table takes ownership of the table item, so a table item should not be inserted into more than one table at a time. .SH "QTableItem::QTableItem ( QTable * table, EditType et, const TQString & text )" Creates a table item that is a child of table \fItable\fR with text \fItext\fR. The item has the EditType \fIet\fR. .PP -The table item will use a QLineEdit for its editor, will not word-wrap and will occupy a single cell. Insert the table item into a table with QTable::setItem(). +The table item will use a TQLineEdit for its editor, will not word-wrap and will occupy a single cell. Insert the table item into a table with QTable::setItem(). .PP The table takes ownership of the table item, so a table item should not be inserted into more than one table at a time. .SH "QTableItem::QTableItem ( QTable * table, EditType et, const TQString & text, const TQPixmap & p )" Creates a table item that is a child of table \fItable\fR with text \fItext\fR and pixmap \fIp\fR. The item has the EditType \fIet\fR. .PP -The table item will display the pixmap to the left of the text. It will use a QLineEdit for editing the text, will not word-wrap and will occupy a single cell. Insert the table item into a table with QTable::setItem(). +The table item will display the pixmap to the left of the text. It will use a TQLineEdit for editing the text, will not word-wrap and will occupy a single cell. Insert the table item into a table with QTable::setItem(). .PP The table takes ownership of the table item, so a table item should not be inserted in more than one table at a time. .SH "QTableItem::~QTableItem ()\fC [virtual]\fR" @@ -240,7 +240,7 @@ Returns the column span of the table item, usually 1. .PP See also setSpan() and rowSpan(). .SH "TQWidget * QTableItem::createEditor () const\fC [virtual]\fR" -This virtual function creates an editor which the user can interact with to edit the cell's contents. The default implementation creates a QLineEdit. +This virtual function creates an editor which the user can interact with to edit the cell's contents. The default implementation creates a TQLineEdit. .PP If the function returns 0, the cell is read-only. .PP @@ -256,7 +256,7 @@ If you reimplement this function you'll almost certainly need to reimplement set .br // create an editor - a combobox in our case .br - ( (ComboItem*)this )->cb = new QComboBox( table()->viewport() ); + ( (ComboItem*)this )->cb = new TQComboBox( table()->viewport() ); .br TQObject::connect( cb, TQ_SIGNAL( activated( int ) ), table(), TQ_SLOT( doValueChanged() ) ); .br @@ -335,9 +335,9 @@ Returns the Run Time Type Identification value for this table item which for QTa .PP When you create subclasses based on QTableItem make sure that each subclass returns a unique rtti() value. It is advisable to use values greater than 1000, preferably large random numbers, to allow for extensions to this class. .PP -See also QCheckTableItem::rtti() and QComboTableItem::rtti(). +See also TQCheckTableItem::rtti() and TQComboTableItem::rtti(). .PP -Reimplemented in QComboTableItem and QCheckTableItem. +Reimplemented in TQComboTableItem and TQCheckTableItem. .SH "void QTableItem::setCol ( int c )\fC [virtual]\fR" Sets column \fIc\fR as the table item's column. Usually you will not need to call this function. .PP @@ -347,7 +347,7 @@ See also col(), setRow(), and colSpan(). .SH "void QTableItem::setContentFromEditor ( TQWidget * w )\fC [virtual]\fR" Whenever the content of a cell has been edited by the editor \fIw\fR, QTable calls this virtual function to copy the new values into the QTableItem. .PP -If you reimplement createEditor() and return something that is not a QLineEdit you will need to reimplement this function. +If you reimplement createEditor() and return something that is not a TQLineEdit you will need to reimplement this function. .PP .nf .br @@ -359,9 +359,9 @@ If you reimplement createEditor() and return something that is not a QLineEdit y .br // value of the item (its text), with the value of the combobox .br - if ( w->inherits( "QComboBox" ) ) + if ( w->inherits( "TQComboBox" ) ) .br - setText( ( (QComboBox*)w )->currentText() ); + setText( ( (TQComboBox*)w )->currentText() ); .br else .br @@ -382,7 +382,7 @@ Sets pixmap \fIp\fR to be this item's pixmap. .PP Note that setPixmap() does not update the cell the table item belongs to. Use QTable::updateCell() to repaint the cell's contents. .PP -For QComboTableItems and QCheckTableItems this function has no visible effect. +For TQComboTableItems and TQCheckTableItems this function has no visible effect. .PP See also QTable::setPixmap(), pixmap(), and setText(). .SH "void QTableItem::setReplaceable ( bool b )\fC [virtual]\fR" @@ -430,7 +430,7 @@ To ensure that the current value of the editor is returned, setContentFromEditor .TP if the editMode() is Always, or .TP -if editMode() is \fInot\fR Always but the editor of the cell is active and the editor is not a QLineEdit. +if editMode() is \fInot\fR Always but the editor of the cell is active and the editor is not a TQLineEdit. .PP This means that text() returns the original text value of the item if the editor is a line edit, until the user commits an edit (e.g. by pressing Enter or Tab) in which case the new text is returned. For other editors (e.g. a combobox) setContentFromEditor() is always called so the currently display value is the one returned. .PP diff --git a/doc/man/man3/tqtextedit.3qt b/doc/man/man3/tqtextedit.3qt index b990e3b25..3da294e96 100644 --- a/doc/man/man3/tqtextedit.3qt +++ b/doc/man/man3/tqtextedit.3qt @@ -11,7 +11,7 @@ TQTextEdit \- Powerful single-page rich text editor .SH SYNOPSIS \fC#include \fR .PP -Inherits QScrollView. +Inherits TQScrollView. .PP Inherited by QMultiLineEdit, TQTextBrowser, and TQTextView. .PP @@ -924,7 +924,7 @@ Reimplemented to allow tabbing through links. If \fIn\fR is TRUE the tab moves t .SH "TQFont TQTextEdit::font () const" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP -Returns QScrollView::font() +Returns TQScrollView::font() .PP \fBWarning:\fR In previous versions this function returned the font of the current format. This lead to confusion. Please use currentFont() instead. .PP diff --git a/doc/man/man3/tqtoolbar.3qt b/doc/man/man3/tqtoolbar.3qt index cc5f6d130..3db564029 100644 --- a/doc/man/man3/tqtoolbar.3qt +++ b/doc/man/man3/tqtoolbar.3qt @@ -71,13 +71,13 @@ To use TQToolBar you simply create a TQToolBar as a child of a TQMainWindow, cre .PP This extract from the application/application.cpp example shows the creation of a new toolbar as a child of a TQMainWindow and adding two TQActions. .PP -You may use most widgets within a toolbar, with TQToolButton and QComboBox being the most common. +You may use most widgets within a toolbar, with TQToolButton and TQComboBox being the most common. .PP If you create a new widget on an already visible TQToolBar, this widget will automatically become visible without needing a show() call. (This differs from every other TQt widget container. We recommend calling show() anyway since we hope to fix this anomaly in a future release.) .PP TQToolBars, like QDockWindows, are located in QDockAreas or float as top-level windows. TQMainWindow provides four QDockAreas (top, left, right and bottom). When you create a new toolbar (as in the example above) as a child of a TQMainWindow the toolbar will be added to the top dock area. You can move it to another dock area (or float it) by calling TQMainWindow::moveDockWindow(). QDock areas lay out their windows in Lines. .PP -If the main window is resized so that the area occupied by the toolbar is too small to show all its widgets a little arrow button (which looks like a right-pointing chevron, '»') will appear at the right or bottom of the toolbar depending on its orientation. Clicking this button pops up a menu that shows the 'overflowing' items. TQToolButtons are represented in the menu using their textLabel property, other QButton subclasses are represented using their text property, and QComboBoxes are represented as submenus, with the caption text being used in the submenu item. +If the main window is resized so that the area occupied by the toolbar is too small to show all its widgets a little arrow button (which looks like a right-pointing chevron, '»') will appear at the right or bottom of the toolbar depending on its orientation. Clicking this button pops up a menu that shows the 'overflowing' items. TQToolButtons are represented in the menu using their textLabel property, other QButton subclasses are represented using their text property, and TQComboBoxes are represented as submenus, with the caption text being used in the submenu item. .PP Usually a toolbar will get precisely the space it needs. However, with setHorizontalStretchable(), setVerticalStretchable() or setStretchableWidget() you can tell the main window to expand the toolbar to fill all available space in the specified orientation. .PP diff --git a/doc/man/man3/tqtoolbutton.3qt b/doc/man/man3/tqtoolbutton.3qt index 608b2ea2b..58007a990 100644 --- a/doc/man/man3/tqtoolbutton.3qt +++ b/doc/man/man3/tqtoolbutton.3qt @@ -158,7 +158,7 @@ A tool button can offer additional choices in a popup menu. The feature is somet .PP
            TQToolbar with TQToolbuttons .PP -See also QPushButton, TQToolBar, TQMainWindow, GUI Design Handbook: Push Button, and Basic Widgets. +See also TQPushButton, TQToolBar, TQMainWindow, GUI Design Handbook: Push Button, and Basic Widgets. .SS "Member Type Documentation" .SH "TQToolButton::TextPosition" The position of the tool button's textLabel in relation to the tool button's icon. diff --git a/doc/man/man3/tqvalidator.3qt b/doc/man/man3/tqvalidator.3qt index c62519dad..b0d607cd1 100644 --- a/doc/man/man3/tqvalidator.3qt +++ b/doc/man/man3/tqvalidator.3qt @@ -56,9 +56,9 @@ For an editable combobox that accepts URLs, any well-formed URL is Acceptable, " For a spin box that accepts lengths, "11cm" and "1in" are Acceptable, "11" and the empty string are Intermediate and" http://www.trolltech.com" and "hour" are Invalid. .IP .PP -fixup() is provided for validators that can repair some user errors. The default implementation does nothing. QLineEdit, for example, will call fixup() if the user presses Enter (or Return) and the content is not currently valid. This allows the fixup() function the opportunity of performing some magic to make an Invalid string Acceptable. +fixup() is provided for validators that can repair some user errors. The default implementation does nothing. TQLineEdit, for example, will call fixup() if the user presses Enter (or Return) and the content is not currently valid. This allows the fixup() function the opportunity of performing some magic to make an Invalid string Acceptable. .PP -QValidator is typically used with QLineEdit, QSpinBox and QComboBox. +QValidator is typically used with TQLineEdit, TQSpinBox and TQComboBox. .PP See also Miscellaneous Classes. .SS "Member Type Documentation" diff --git a/doc/man/man3/tqwidget.3qt b/doc/man/man3/tqwidget.3qt index 9eb3ada21..5fc7aa322 100644 --- a/doc/man/man3/tqwidget.3qt +++ b/doc/man/man3/tqwidget.3qt @@ -13,7 +13,7 @@ TQWidget \- The base class of all user interface objects .PP Inherits TQObject and TQPaintDevice. .PP -Inherited by QButton, QFrame, QDialog, QComboBox, TQDataBrowser, TQDataView, TQDateTimeEditBase, TQDateTimeEdit, TQDesktopWidget, QDial, QDockArea, TQGLWidget, QHeader, TQMainWindow, QMotifWidget, QNPWidget, QScrollBar, TQSizeGrip, QSlider, QSpinBox, QSplashScreen, TQStatusBar, QTabBar, QTabWidget, TQWorkspace, and QXtWidget. +Inherited by QButton, QFrame, TQDialog, TQComboBox, TQDataBrowser, TQDataView, TQDateTimeEditBase, TQDateTimeEdit, TQDesktopWidget, TQDial, QDockArea, TQGLWidget, QHeader, TQMainWindow, QMotifWidget, QNPWidget, TQScrollBar, TQSizeGrip, TQSlider, TQSpinBox, QSplashScreen, TQStatusBar, QTabBar, QTabWidget, TQWorkspace, and QXtWidget. .PP .SS "Public Members" .in +1c @@ -998,15 +998,15 @@ The TQWidget class is the base class of all user interface objects. .PP The widget is the atom of the user interface: it receives mouse, keyboard and other events from the window system, and paints a representation of itself on the screen. Every widget is rectangular, and they are sorted in a Z-order. A widget is clipped by its parent and by the widgets in front of it. .PP -A widget that isn't embedded in a parent widget is called a top-level widget. Usually, top-level widgets are windows with a frame and a title bar (although it is also possible to create top-level widgets without such decoration if suitable widget flags are used). In Qt, TQMainWindow and the various subclasses of QDialog are the most common top-level windows. +A widget that isn't embedded in a parent widget is called a top-level widget. Usually, top-level widgets are windows with a frame and a title bar (although it is also possible to create top-level widgets without such decoration if suitable widget flags are used). In Qt, TQMainWindow and the various subclasses of TQDialog are the most common top-level windows. .PP A widget without a parent widget is always a top-level widget. .PP -Non-top-level widgets are child widgets. These are child windows in their parent widgets. You cannot usually distinguish a child widget from its parent visually. Most other widgets in TQt are useful only as child widgets. (It is possible to make, say, a button into a top-level widget, but most people prefer to put their buttons inside other widgets, e.g. QDialog.) +Non-top-level widgets are child widgets. These are child windows in their parent widgets. You cannot usually distinguish a child widget from its parent visually. Most other widgets in TQt are useful only as child widgets. (It is possible to make, say, a button into a top-level widget, but most people prefer to put their buttons inside other widgets, e.g. TQDialog.) .PP If you want to use a TQWidget to hold child widgets you will probably want to add a layout to the parent TQWidget. (See Layouts.) .PP -TQWidget has many member functions, but some of them have little direct functionality: for example, TQWidget has a font property, but never uses this itself. There are many subclasses which provide real functionality, such as QPushButton, QListBox and QTabDialog, etc. +TQWidget has many member functions, but some of them have little direct functionality: for example, TQWidget has a font property, but never uses this itself. There are many subclasses which provide real functionality, such as TQPushButton, QListBox and QTabDialog, etc. .SH "Groups of functions:"
            .nf .TS @@ -1413,7 +1413,7 @@ Sometimes, you will want to reimplement this function. For example, a web browse .PP Child widgets call focusNextPrevChild() on their parent widgets, but only the top-level widget decides where to redirect focus. By overriding this method for an object, you thus gain control of focus traversal for all child widgets. .PP -\fBWarning:\fR QScrollView uses it own logic for this function, which does the right thing in most cases. But if you are using a QScrollView and want complete control of the focus chain you'll need to override QScrollView::focusNextPrevChild() and your top-level widgets' focusNextPrevChild() functions. +\fBWarning:\fR TQScrollView uses it own logic for this function, which does the right thing in most cases. But if you are using a TQScrollView and want complete control of the focus chain you'll need to override TQScrollView::focusNextPrevChild() and your top-level widgets' focusNextPrevChild() functions. .PP See also focusData(). .SH "void TQWidget::focusOutEvent ( QFocusEvent * )\fC [virtual protected]\fR" @@ -1533,7 +1533,7 @@ Hide events are sent to widgets immediately after they have been hidden. .PP See also event() and QHideEvent. .PP -Reimplemented in QScrollBar. +Reimplemented in TQScrollBar. .SH "const TQPixmap * TQWidget::icon () const" Returns the widget's icon. See the "icon" property for details. .SH "TQString TQWidget::iconText () const" @@ -1629,7 +1629,7 @@ See also keyReleaseEvent(), QKeyEvent::ignore(), focusPolicy, focusInEvent(), fo .PP Example: picture/picture.cpp. .PP -Reimplemented in QLineEdit and TQTextEdit. +Reimplemented in TQLineEdit and TQTextEdit. .SH "void TQWidget::keyReleaseEvent ( QKeyEvent * e )\fC [virtual protected]\fR" This event handler, for event \fIe\fR, can be reimplemented in a subclass to receive key release events for the widget. .PP @@ -1726,7 +1726,7 @@ Returns the widget's minimum size. See the "minimumSize" property for details. .SH "TQSize TQWidget::minimumSizeHint () const\fC [virtual]\fR" Returns the recommended minimum size for the widget. See the "minimumSizeHint" property for details. .PP -Reimplemented in QLineEdit. +Reimplemented in TQLineEdit. .SH "int TQWidget::minimumWidth () const" Returns the widget's minimum width. See the "minimumWidth" property for details. .SH "void TQWidget::mouseDoubleClickEvent ( QMouseEvent * e )\fC [virtual protected]\fR" @@ -1957,7 +1957,7 @@ Scrolls the widget including its children \fIdx\fR pixels to the right and \fIdy .PP After scrolling, scroll() sends a paint event for the the part that is read but not written. For example, when scrolling 10 pixels rightwards, the leftmost ten pixels of the widget need repainting. The paint event may be delivered immediately or later, depending on some heuristics (note that you might have to force processing of paint events using QApplication::sendPostedEvents() when using scroll() and move() in combination). .PP -See also QScrollView, erase(), and bitBlt(). +See also TQScrollView, erase(), and bitBlt(). .SH "void TQWidget::scroll ( int dx, int dy, const TQRect & r )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP @@ -1965,7 +1965,7 @@ This version only scrolls \fIr\fR and does not move the children of the widget. .PP If \fIr\fR is empty or invalid, the result is undefined. .PP -See also QScrollView, erase(), and bitBlt(). +See also TQScrollView, erase(), and bitBlt(). .SH "void TQWidget::setAcceptDrops ( bool on )\fC [virtual]\fR" Sets whether drop events are enabled for this widget to \fIon\fR. See the "acceptDrops" property for details. .SH "void TQWidget::setActiveWindow ()\fC [virtual]\fR" @@ -2071,7 +2071,7 @@ Sets the way the widget accepts keyboard focus. See the "focusPolicy" property f .SH "void TQWidget::setFocusProxy ( TQWidget * w )\fC [virtual]\fR" Sets the widget's focus proxy to widget \fIw\fR. If \fIw\fR is 0, the function resets this widget to have no focus proxy. .PP -Some widgets, such as QComboBox, can "have focus", but create a child widget to actually handle the focus. QComboBox, for example, creates a QLineEdit which handles the focus. +Some widgets, such as TQComboBox, can "have focus", but create a child widget to actually handle the focus. TQComboBox, for example, creates a TQLineEdit which handles the focus. .PP setFocusProxy() sets the widget which will actually get focus when" this widget" gets it. If there is a focus proxy, focusPolicy(), setFocusPolicy(), setFocus() and hasFocus() all operate on the focus proxy. .PP @@ -2079,7 +2079,7 @@ See also focusProxy(). .SH "void TQWidget::setFont ( const TQFont & )\fC [virtual]\fR" Sets the font currently set for the widget. See the "font" property for details. .PP -Reimplemented in QComboBox, TQLabel, and QTabDialog. +Reimplemented in TQComboBox, TQLabel, and QTabDialog. .SH "void TQWidget::setFont ( const TQFont & f, bool )" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP @@ -2101,7 +2101,7 @@ Sets enables or disables the use of input methods for this widget to \fIb\fR. Se .SH "void TQWidget::setKeyCompression ( bool compress )\fC [virtual protected]\fR" Enables key event compression, if \fIcompress\fR is TRUE, and disables it if \fIcompress\fR is FALSE. .PP -Key compression is off by default (except for QLineEdit and TQTextEdit), so widgets receive one key press event for each key press (or more, since autorepeat is usually on). If you turn it on and your program doesn't keep up with key input, TQt may try to compress key events so that more than one character can be processed in each event. +Key compression is off by default (except for TQLineEdit and TQTextEdit), so widgets receive one key press event for each key press (or more, since autorepeat is usually on). If you turn it on and your program doesn't keep up with key input, TQt may try to compress key events so that more than one character can be processed in each event. .PP For example, a word processor widget might receive 2, 3 or more characters in each QKeyEvent::text(), if the layout recalculation takes too long for the CPU. .PP @@ -2167,7 +2167,7 @@ Sets whether mouse tracking is enabled for the widget to \fIenable\fR. See the " .SH "void TQWidget::setPalette ( const TQPalette & )\fC [virtual]\fR" Sets the widget's palette. See the "palette" property for details. .PP -Reimplemented in QComboBox, QScrollBar, and QSlider. +Reimplemented in TQComboBox, TQScrollBar, and TQSlider. .SH "void TQWidget::setPalette ( const TQPalette & p, bool )" \fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code. .PP @@ -2287,7 +2287,7 @@ See also showEvent(), hide(), showMinimized(), showMaximized(), showNormal(), vi Examples: .)l aclock/main.cpp, life/main.cpp, popup/popup.cpp, t1/main.cpp, t3/main.cpp, t4/main.cpp, and toplevel/options.ui.h. .PP -Reimplemented in QDialog and TQMenuBar. +Reimplemented in TQDialog and TQMenuBar. .SH "void TQWidget::showEvent ( QShowEvent * )\fC [virtual protected]\fR" This event handler can be reimplemented in a subclass to receive widget show events. .PP @@ -2678,7 +2678,7 @@ This property holds whether the widget accepts keyboard focus. .PP Keyboard focus is initially disabled (i.e. focusPolicy() == TQWidget::NoFocus). .PP -You must enable keyboard focus for a widget if it processes keyboard events. This is normally done from the widget's constructor. For instance, the QLineEdit constructor calls setFocusPolicy(TQWidget::StrongFocus). +You must enable keyboard focus for a widget if it processes keyboard events. This is normally done from the widget's constructor. For instance, the TQLineEdit constructor calls setFocusPolicy(TQWidget::StrongFocus). .PP See also focusPolicy, focusInEvent(), focusOutEvent(), keyPressEvent(), keyReleaseEvent(), and enabled. .PP @@ -2688,7 +2688,7 @@ This property holds the way the widget accepts keyboard focus. .PP The policy is TQWidget::TabFocus if the widget accepts keyboard focus by tabbing, TQWidget::ClickFocus if the widget accepts focus by clicking, TQWidget::StrongFocus if it accepts both, and TQWidget::NoFocus (the default) if it does not accept focus at all. .PP -You must enable keyboard focus for a widget if it processes keyboard events. This is normally done from the widget's constructor. For instance, the QLineEdit constructor calls setFocusPolicy(TQWidget::StrongFocus). +You must enable keyboard focus for a widget if it processes keyboard events. This is normally done from the widget's constructor. For instance, the TQLineEdit constructor calls setFocusPolicy(TQWidget::StrongFocus). .PP See also focusEnabled, focusInEvent(), focusOutEvent(), keyPressEvent(), keyReleaseEvent(), and enabled. .PP @@ -2812,7 +2812,7 @@ This property holds whether the widget is a dialog widget. .PP A dialog widget is a secondary top-level widget, i.e. a top-level widget with a parent. .PP -See also isTopLevel and QDialog. +See also isTopLevel and TQDialog. .PP Get this property's value with isDialog(). .SH "bool isModal" @@ -2820,7 +2820,7 @@ This property holds whether the widget is a modal widget. .PP This property only makes sense for top-level widgets. A modal widget prevents widgets in all other top-level widgets from getting any input. .PP -See also isTopLevel, isDialog, and QDialog. +See also isTopLevel, isDialog, and TQDialog. .PP Get this property's value with isModal(). .SH "bool isPopup" @@ -2838,7 +2838,7 @@ A top-level widget is a widget which usually has a frame and a caption (title). .PP A top-level widget can have a parent widget. It will then be grouped with its parent and deleted when the parent is deleted, minimized when the parent is minimized etc. If supported by the window manager, it will also have a common taskbar entry with its parent. .PP -QDialog and TQMainWindow widgets are by default top-level, even if a parent widget is specified in the constructor. This behavior is specified by the WType_TopLevel widget flag. +TQDialog and TQMainWindow widgets are by default top-level, even if a parent widget is specified in the constructor. This behavior is specified by the WType_TopLevel widget flag. .PP See also topLevelWidget(), isDialog, isModal, isPopup, isDesktop, and parentWidget(). .PP @@ -3086,7 +3086,7 @@ This property holds the default layout behavior of the widget. .PP If there is a QLayout that manages this widget's children, the size policy specified by that layout is used. If there is no such QLayout, the result of this function is used. .PP -The default policy is Preferred/Preferred, which means that the widget can be freely resized, but prefers to be the size sizeHint() returns. Button-like widgets set the size policy to specify that they may stretch horizontally, but are fixed vertically. The same applies to lineedit controls (such as QLineEdit, QSpinBox or an editable QComboBox) and other horizontally orientated widgets (such as QProgressBar). TQToolButton's are normally square, so they allow growth in both directions. Widgets that support different directions (such as QSlider, QScrollBar or QHeader) specify stretching in the respective direction only. Widgets that can provide scrollbars (usually subclasses of QScrollView) tend to specify that they can use additional space, and that they can make do with less than sizeHint(). +The default policy is Preferred/Preferred, which means that the widget can be freely resized, but prefers to be the size sizeHint() returns. Button-like widgets set the size policy to specify that they may stretch horizontally, but are fixed vertically. The same applies to lineedit controls (such as TQLineEdit, TQSpinBox or an editable TQComboBox) and other horizontally orientated widgets (such as QProgressBar). TQToolButton's are normally square, so they allow growth in both directions. Widgets that support different directions (such as TQSlider, TQScrollBar or QHeader) specify stretching in the respective direction only. Widgets that can provide scrollbars (usually subclasses of TQScrollView) tend to specify that they can use additional space, and that they can make do with less than sizeHint(). .PP See also sizeHint, QLayout, TQSizePolicy, and updateGeometry(). .PP diff --git a/doc/man/man3/tqwizard.3qt b/doc/man/man3/tqwizard.3qt index 41db7b131..7fc09aa89 100644 --- a/doc/man/man3/tqwizard.3qt +++ b/doc/man/man3/tqwizard.3qt @@ -11,7 +11,7 @@ QWizard \- Framework for wizard dialogs .SH SYNOPSIS \fC#include \fR .PP -Inherits QDialog. +Inherits TQDialog. .PP .SS "Public Members" .in +1c @@ -64,19 +64,19 @@ Inherits QDialog. .BI "virtual void \fBsetAppropriate\fR ( TQWidget * page, bool appropriate )" .br .ti -1c -.BI "QPushButton * \fBbackButton\fR () const" +.BI "TQPushButton * \fBbackButton\fR () const" .br .ti -1c -.BI "QPushButton * \fBnextButton\fR () const" +.BI "TQPushButton * \fBnextButton\fR () const" .br .ti -1c -.BI "QPushButton * \fBfinishButton\fR () const" +.BI "TQPushButton * \fBfinishButton\fR () const" .br .ti -1c -.BI "QPushButton * \fBcancelButton\fR () const" +.BI "TQPushButton * \fBcancelButton\fR () const" .br .ti -1c -.BI "QPushButton * \fBhelpButton\fR () const" +.BI "TQPushButton * \fBhelpButton\fR () const" .br .in -1c .SS "Public Slots" @@ -161,7 +161,7 @@ Example code is available here: wizard/wizard.cpp wizard/wizard.h See also Abstract Widget Classes, Dialog Classes, and Organizers. .SH MEMBER FUNCTION DOCUMENTATION .SH "QWizard::QWizard ( TQWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags f = 0 )" -Constructs an empty wizard dialog. The \fIparent\fR, \fIname\fR, \fImodal\fR and \fIf\fR arguments are passed to the QDialog constructor. +Constructs an empty wizard dialog. The \fIparent\fR, \fIname\fR, \fImodal\fR and \fIf\fR arguments are passed to the TQDialog constructor. .SH "QWizard::~QWizard ()" Destroys the object and frees any allocated resources, including all pages and controllers. .SH "void QWizard::addPage ( TQWidget * page, const TQString & title )\fC [virtual]\fR" @@ -174,23 +174,23 @@ Called when the Next button is clicked; this virtual function returns TRUE if \f Called when the user clicks the Back button; this function shows the preceding relevant page in the sequence. .PP See also appropriate(). -.SH "QPushButton * QWizard::backButton () const" +.SH "TQPushButton * QWizard::backButton () const" Returns a pointer to the dialog's Back button .PP By default, this button is connected to the back() slot, which is virtual so you can reimplement it in a QWizard subclass. Use setBackEnabled() to enable/disable this button. -.SH "QPushButton * QWizard::cancelButton () const" +.SH "TQPushButton * QWizard::cancelButton () const" Returns a pointer to the dialog's Cancel button .PP -By default, this button is connected to the QDialog::reject() slot, which is virtual so you can reimplement it in a QWizard subclass. +By default, this button is connected to the TQDialog::reject() slot, which is virtual so you can reimplement it in a QWizard subclass. .SH "TQWidget * QWizard::currentPage () const" Returns a pointer to the current page in the sequence. Although the wizard does its best to make sure that this value is never 0, it can be if you try hard enough. -.SH "QPushButton * QWizard::finishButton () const" +.SH "TQPushButton * QWizard::finishButton () const" Returns a pointer to the dialog's Finish button .PP -By default, this button is connected to the QDialog::accept() slot, which is virtual so you can reimplement it in a QWizard subclass. Use setFinishEnabled() to enable/disable this button. +By default, this button is connected to the TQDialog::accept() slot, which is virtual so you can reimplement it in a QWizard subclass. Use setFinishEnabled() to enable/disable this button. .SH "void QWizard::help ()\fC [virtual protected slot]\fR" Called when the user clicks the Help button, this function emits the helpClicked() signal. -.SH "QPushButton * QWizard::helpButton () const" +.SH "TQPushButton * QWizard::helpButton () const" Returns a pointer to the dialog's Help button .PP By default, this button is connected to the help() slot, which is virtual so you can reimplement it in a QWizard subclass. Use setHelpEnabled() to enable/disable this button. @@ -212,7 +212,7 @@ This virtual function is responsible for laying out the title row. Called when the user clicks the Next button, this function shows the next relevant page in the sequence. .PP See also appropriate(). -.SH "QPushButton * QWizard::nextButton () const" +.SH "TQPushButton * QWizard::nextButton () const" Returns a pointer to the dialog's Next button .PP By default, this button is connected to the next() slot, which is virtual so you can reimplement it in a QWizard subclass. Use setNextEnabled() to enable/disable this button. diff --git a/doc/object.doc b/doc/object.doc index f434930c6..863e3ba79 100644 --- a/doc/object.doc +++ b/doc/object.doc @@ -409,7 +409,7 @@ this: But we need to make the auto mask property designable in some TQWidget subclasses. Similarly some classes will need this property to be scriptable (e.g. for QSA). This is achieved by overriding these -features of the property in a subclass. In QCheckBox, for example, we +features of the property in a subclass. In TQCheckBox, for example, we achieve this using the following code: \code TQ_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true ) diff --git a/doc/pictures.doc b/doc/pictures.doc index f325c1bed..2060e0ccd 100644 --- a/doc/pictures.doc +++ b/doc/pictures.doc @@ -62,14 +62,14 @@ shows off many of Qt's widgets. (The source is in \c{examples/demo}. Below we have three views seperated by \l {QSplitter}s. At the top-left there's a \l QListBox, at the top-right there's a \l -QListView with a \l QHeader and two \l {QScrollBar}s. And at the +QListView with a \l QHeader and two \l {TQScrollBar}s. And at the bottom there's a \l TQIconView. \img splitter-views-w.png Below we present a \l TQMainWindow which has a \l TQMenuBar and some \l {TQToolBar}s that contain -various widgets, e.g. \l {TQToolButton}s and \l {QComboBox}es. The central +various widgets, e.g. \l {TQToolButton}s and \l {TQComboBox}es. The central widget is a \l TQWorkspace which is used for MDI window management and which contains an MDI-Window featuring a \l TQTextEdit. At the bottom you see a \l TQStatusBar and at the bottom-right a \l TQSizeGrip. @@ -108,7 +108,7 @@ also be used as a separate widget. \img qprogdlg-w.png In the screenshot below we have a \l QGroupBox that contains a \l -QLineEdit, a read-only \l QComboBox and an editable \l QComboBox. +TQLineEdit, a read-only \l TQComboBox and an editable \l TQComboBox. \img groupbox-w.png @@ -117,7 +117,7 @@ The screenshot below shows a \l TQPopupMenu. \img qpopmenu-w.png In the screenshot below there's a \l QButtonGroup containing four \l -{QRadioButton}s and two \l {QCheckBox}es. +{TQRadioButton}s and two \l {TQCheckBox}es. \img buttongroup-w.png @@ -125,17 +125,17 @@ In the screenshot below there's a \l QButtonGroup containing four \l THIS IMAGE DOESN'T SHOW ANYTHING UNDERSTANDABLY USEFUL All views in the first screenshot are widgets derived from a \l -QScrollView. But this class can also manage lots of child-widgets, +TQScrollView. But this class can also manage lots of child-widgets, like in this screenshot. -\img qscrollview-m.png +\img tqscrollview-m.png \endomit The screenshot below shows a \l QTabDialog. The tabs (\l QTabBar) or the more convenient class \l QTabWidget, which combines a tab bar with the pages, can be used separately. In the visible page you see a \l -TQLabel, the range controls \l QSlider and \l QSpinBox and below a \l -QLCDNumber. In the bottom row there are some \l {QPushButton}s. +TQLabel, the range controls \l TQSlider and \l TQSpinBox and below a \l +TQLCDNumber. In the bottom row there are some \l {TQPushButton}s. \img qtabdlg-w.png diff --git a/doc/porting3.doc b/doc/porting3.doc index 39e75beb2..5437d25bf 100644 --- a/doc/porting3.doc +++ b/doc/porting3.doc @@ -183,8 +183,8 @@ have been changed: \section1 Removed Properties \list -\i QLineEdit::hasMarkedText. Use TQLineEdit::hasSelectedText instead. -\i QLineEdit::markedText. Use TQLineEdit::selectedText instead. +\i TQLineEdit::hasMarkedText. Use TQLineEdit::hasSelectedText instead. +\i TQLineEdit::markedText. Use TQLineEdit::selectedText instead. \i TQToolButton::offIconSet. Use TQToolButton::iconSet instead. \i TQToolButton::onIconSet. Use TQToolButton::iconSet instead. \endlist @@ -197,11 +197,11 @@ All these functions have been removed in TQt 3.x: \i QButton::setAutoResize(bool) \i TQFont::charSet() \i TQFont::setCharSet() -\i QLineEdit::cursorLeft(bool mark, int steps = 1). Use TQLineEdit::cursorBackward() instead. -\i QLineEdit::cursorRight(bool mark, int steps = 1). Use TQLineEdit::cursorForward() instead. -\i QLineEdit::hasMarkedText() const. Use TQLineEdit::hasSelectedText() instead. -\i QLineEdit::markedText() const. Use TQLineEdit::selectedText() instead. -\i QLineEdit::repaintArea(int, int). Use TQLineEdit::update() instead. +\i TQLineEdit::cursorLeft(bool mark, int steps = 1). Use TQLineEdit::cursorBackward() instead. +\i TQLineEdit::cursorRight(bool mark, int steps = 1). Use TQLineEdit::cursorForward() instead. +\i TQLineEdit::hasMarkedText() const. Use TQLineEdit::hasSelectedText() instead. +\i TQLineEdit::markedText() const. Use TQLineEdit::selectedText() instead. +\i TQLineEdit::repaintArea(int, int). Use TQLineEdit::update() instead. \i TQMenuBar::setActItem() \i TQMenuBar::setWindowsAltMode() \i TQObject::initMetaObject() @@ -214,8 +214,8 @@ All these functions have been removed in TQt 3.x: \i TQSignal::isBlocked() const \i TQSignal::parameter() const. Use TQSignal::value() instead. \i TQSignal::setParameter(int value). Use TQSignal::setValue() instead. -\i QSpinBox::downButton() -\i QSpinBox::upButton() +\i TQSpinBox::downButton() +\i TQSpinBox::upButton() \i TQString::basicDirection() \i TQString::visual() \i TQStyle::set...() functions @@ -261,8 +261,8 @@ new code. \i TQCanvasPixmapArray::TQCanvasPixmapArray( TQPtrList\ list, TQPtrList\ hotspots ) \i TQCanvasPixmapArray::operator!() \i TQColorGroup::TQColorGroup( const TQColor \& foreground, const TQColor \& background, const TQColor \& light, const TQColor \& dark, const TQColor \& mid, const TQColor \& text, const TQColor \& base ) -\i QComboBox::autoResize() const -\i QComboBox::setAutoResize( bool ) +\i TQComboBox::autoResize() const +\i TQComboBox::setAutoResize( bool ) \i TQDate::dayName( int weekday ) \i TQDate::monthName( int month ) \i TQDir::encodedEntryList( const TQString \& nameFilter, int filterSpec = DefaultFilter, int sortSpec = DefaultSort ) const @@ -315,8 +315,8 @@ new code. \i QMessageBox::query( const TQString \& caption, const TQString \& text, const TQString \& yesButtonText = TQString::null, const TQString \& noButtonText = TQString::null, TQWidget *parent = 0, const char *= 0 ) \i QMessageBox::standardIcon( Icon icon, GUIStyle style ) \i TQRegExp::match( const TQString \& str, int index = 0, int *len = 0, bool indexIsStart = TRUE ) const -\i QScrollView::childIsVisible( TQWidget *child ) -\i QScrollView::showChild( TQWidget *child, bool show = TRUE ) +\i TQScrollView::childIsVisible( TQWidget *child ) +\i TQScrollView::showChild( TQWidget *child, bool show = TRUE ) \i TQSimpleRichText::draw( TQPainter *p, int x, int y, const TQRegion \& clipRegion, const TQColorGroup \& cg, const TQBrush *paper = 0 ) const \i TQString::ascii() const \i TQString::data() const @@ -386,10 +386,10 @@ names are no longer avaialable. \section1 QButtonGroup In TQt 2.x, the function QButtonGroup::selected() returns the selected -\e radio button (QRadioButton). In TQt 3.0, it returns the selected \e +\e radio button (TQRadioButton). In TQt 3.0, it returns the selected \e toggle button (\l QButton::toggleButton), a more general concept. This might affect programs that use QButtonGroups that contain a -mixture of radio buttons and non-radio (e.g. QCheckBox) toggle buttons. +mixture of radio buttons and non-radio (e.g. TQCheckBox) toggle buttons. \section1 TQDate @@ -434,7 +434,7 @@ parameter list. The two static getText(...) methods in QInputDialog have been merged. The \c echo parameter is the third parameter and defaults to -QLineEdit::Normal. +TQLineEdit::Normal. If you used calls to QInputDialog::getText(...) that provided more than the first two required parameters you will must add a value @@ -771,7 +771,7 @@ transparent-looking widget. In general, this approach is slow and processor hungry. TQt 3.0 uses the BackgroundOrigin which provides vastly improved performance and more flexibility in most cases. The few classes for which the AutoMask property is still the best approach -are QCheckBox, QComboBox, QPushButton, QRadioButton and QTabWidget. +are TQCheckBox, TQComboBox, TQPushButton, TQRadioButton and QTabWidget. \section1 Bezier Curves diff --git a/doc/signalsandslots.doc b/doc/signalsandslots.doc index 4cb22cbcf..6f09eb1a6 100644 --- a/doc/signalsandslots.doc +++ b/doc/signalsandslots.doc @@ -239,7 +239,7 @@ return types (i.e. use \c void). A note about arguments. Our experience shows that signals and slots are more reusable if they do \e not use special types. If \l -QScrollBar::valueChanged() were to use a special type such as the +TQScrollBar::valueChanged() were to use a special type such as the hypothetical \c QRangeControl::Range, it could only be connected to slots designed specifically for QRangeControl. Something as simple as the program in \link tutorial1-05.html Tutorial #1 part 5\endlink @@ -320,16 +320,16 @@ TQObject::className() class name\endlink. You can also check if an object \section1 A Real Example -Here is a simple commented example (code fragments from \l ntqlcdnumber.h ). +Here is a simple commented example (code fragments from \l tqlcdnumber.h ). \code #include "ntqframe.h" #include "tqbitarray.h" - class QLCDNumber : public QFrame + class TQLCDNumber : public QFrame \endcode -QLCDNumber inherits TQObject, which has most of the signal/slot +TQLCDNumber inherits TQObject, which has most of the signal/slot knowledge, via QFrame and TQWidget, and #include's the relevant declarations. @@ -346,8 +346,8 @@ include the moc output in the link command. \code public: - QLCDNumber( TQWidget *parent=0, const char *name=0 ); - QLCDNumber( uint numDigits, TQWidget *parent=0, const char *name=0 ); + TQLCDNumber( TQWidget *parent=0, const char *name=0 ); + TQLCDNumber( uint numDigits, TQWidget *parent=0, const char *name=0 ); \endcode It's not obviously relevant to the moc, but if you inherit TQWidget you @@ -363,7 +363,7 @@ ignores member functions. void overflow(); \endcode -QLCDNumber emits a signal when it is asked to show an impossible +TQLCDNumber emits a signal when it is asked to show an impossible value. If you don't care about overflow, or you know that overflow cannot @@ -387,13 +387,13 @@ slots. TQt will call both (in arbitrary order). \endcode A slot is a receiving function, used to get information about state -changes in other widgets. QLCDNumber uses it, as the code above +changes in other widgets. TQLCDNumber uses it, as the code above indicates, to set the displayed number. Since \c{display()} is part of the class's interface with the rest of the program, the slot is public. Several of the example programs connect the newValue() signal of a -QScrollBar to the display() slot, so the LCD number continuously shows +TQScrollBar to the display() slot, so the LCD number continuously shows the value of the scroll bar. Note that display() is overloaded; TQt will select the appropriate version diff --git a/doc/sql.doc b/doc/sql.doc index f57ba7746..4a5206b47 100644 --- a/doc/sql.doc +++ b/doc/sql.doc @@ -871,8 +871,8 @@ We include the header files for the widgets that we need. We also include \c tqsqldatabase.h and \c tqsqlcursor.h as usual, but we now add \c tqsqlform.h. -The form will be presented as a dialog so we subclass \l QDialog with -our own FormDialog class. We use a \l QLineEdit for the salary so that +The form will be presented as a dialog so we subclass \l TQDialog with +our own FormDialog class. We use a \l TQLineEdit for the salary so that the user can change it. All the widgets are laid out using a grid. We create a cursor on the staff table, select all records and move to @@ -923,7 +923,7 @@ right pad the fields are removed when the fields are retrieved. Properties that we might wish to apply to fields, such as alignment and validation are achieved in the conventional way, for example, by -calling QLineEdit::setAlignment() and QLineEdit::setValidator(). +calling TQLineEdit::setAlignment() and TQLineEdit::setValidator(). \skipto forenameEdit \printline forenameEdit @@ -934,7 +934,7 @@ calling QLineEdit::setAlignment() and QLineEdit::setValidator(). The FormDialog constructor is similar to the one in the previous example. We have changed the forename and surname widgets to -\l{QLineEdit}s to make them editable and have added a \l QPushButton +\l{TQLineEdit}s to make them editable and have added a \l TQPushButton the user can click to save their updates. \skipto saveButton @@ -960,7 +960,7 @@ cursor's update buffer. \printline insert \printuntil readFields -Now we link the buffer's fields to the \l QLineEdit controls. (In the +Now we link the buffer's fields to the \l TQLineEdit controls. (In the previous example we linked the cursor's fields.) The edit controls are populated by the readFields() call as before. @@ -1012,7 +1012,7 @@ sql/overview/custom1/main.h and \l sql/overview/custom1/main.cpp \printline CustomEdit \printuntil }; -We've created a simple subclass of QLineEdit and added a property, +We've created a simple subclass of TQLineEdit and added a property, upperLineText, which will hold an uppercase version of the text. We also created a slot, changed(). @@ -1027,7 +1027,7 @@ to our FormDialog's private data. \printline CustomEdit \printuntil } -In the CustomEdit constructor we use the QLineEdit constructor and add +In the CustomEdit constructor we use the TQLineEdit constructor and add a connection between the textChanged signal and our own changed slot. \skipto changed @@ -1055,7 +1055,7 @@ CustomEdit instances directly to database fields. \printline CustomEdit We use the same FormDialog as we did before, but this time replace two -of the QLineEdit widgets with our own CustomEdit widgets. +of the TQLineEdit widgets with our own CustomEdit widgets. Laying out the grid and setting up the cursor is the same as before. @@ -1085,7 +1085,7 @@ our CustomEdit widget. We must reimpliment TQSqlEditorFactory to use custom editor widgets in tables. In the following example we will create a custom editor based -on QComboBox and a TQSqlEditorFactory subclass to show how a TQDataTable +on TQComboBox and a TQSqlEditorFactory subclass to show how a TQDataTable can use a custom editor. \quotefile sql/overview/table3/main.h diff --git a/doc/table.doc b/doc/table.doc index 2b269807a..e80b08590 100644 --- a/doc/table.doc +++ b/doc/table.doc @@ -60,8 +60,8 @@ The table module provides the following classes: tabular data such as spreadsheet or database data. \i \l QTableItem objects are used to populate a QTable with data with each table item holding the contents of a cell. -\i The \l QComboTableItem class provides memory-efficient combobox items for QTables. -\i The \l QCheckTableItem class provides memory-efficient checkbox items for QTables. +\i The \l TQComboTableItem class provides memory-efficient combobox items for QTables. +\i The \l TQCheckTableItem class provides memory-efficient checkbox items for QTables. \i \l QTableSelection provides access to selections of cells in a QTable. \i QHeader provides access to the table's horizontal header (column headers) and vertical header (row headers). diff --git a/doc/threads.doc b/doc/threads.doc index c80d208ba..c4751f0c5 100644 --- a/doc/threads.doc +++ b/doc/threads.doc @@ -246,7 +246,7 @@ system functions. This mutex is locked while the event loop is running (e.g. during event delivery) and unlocked when the eventloop goes to sleep. Note: The TQt event loop is recursive, and the library mutex is \e not unlocked when re-entering the event loop (e.g. when -executing a modal dialog with QDialog::exec()). +executing a modal dialog with TQDialog::exec()). If another thread locks the TQt library mutex, then the event loop will stop processing events, and the locking thread may do simple GUI diff --git a/doc/tqasciidict.doc b/doc/tqasciidict.doc index 07234c504..e3ae6ca00 100644 --- a/doc/tqasciidict.doc +++ b/doc/tqasciidict.doc @@ -64,14 +64,14 @@ Example: \code - TQAsciiDict fields; // char* keys, QLineEdit* values - fields.insert( "forename", new QLineEdit( this ) ); - fields.insert( "surname", new QLineEdit( this ) ); + TQAsciiDict fields; // char* keys, TQLineEdit* values + fields.insert( "forename", new TQLineEdit( this ) ); + fields.insert( "surname", new TQLineEdit( this ) ); fields["forename"]->setText( "Homer" ); fields["surname"]->setText( "Simpson" ); - TQAsciiDictIterator it( fields ); // See TQAsciiDictIterator + TQAsciiDictIterator it( fields ); // See TQAsciiDictIterator for( ; it.current(); ++it ) cout << it.currentKey() << ": " << it.current()->text() << endl; cout << endl; @@ -350,16 +350,16 @@ Example: \code - TQAsciiDict fields; - fields.insert( "forename", new QLineEdit( this ) ); - fields.insert( "surname", new QLineEdit( this ) ); - fields.insert( "age", new QLineEdit( this ) ); + TQAsciiDict fields; + fields.insert( "forename", new TQLineEdit( this ) ); + fields.insert( "surname", new TQLineEdit( this ) ); + fields.insert( "age", new TQLineEdit( this ) ); fields["forename"]->setText( "Homer" ); fields["surname"]->setText( "Simpson" ); fields["age"]->setText( "45" ); - TQAsciiDictIterator it( fields ); + TQAsciiDictIterator it( fields ); for( ; it.current(); ++it ) cout << it.currentKey() << ": " << it.current()->text() << endl; cout << endl; diff --git a/doc/tqdict.doc b/doc/tqdict.doc index 6b8823ff9..0dffb2032 100644 --- a/doc/tqdict.doc +++ b/doc/tqdict.doc @@ -112,14 +112,14 @@ Example #1: \code - TQDict fields; // TQString keys, QLineEdit* values - fields.insert( "forename", new QLineEdit( this ) ); - fields.insert( "surname", new QLineEdit( this ) ); + TQDict fields; // TQString keys, TQLineEdit* values + fields.insert( "forename", new TQLineEdit( this ) ); + fields.insert( "surname", new TQLineEdit( this ) ); fields["forename"]->setText( "Homer" ); fields["surname"]->setText( "Simpson" ); - TQDictIterator it( fields ); // See TQDictIterator + TQDictIterator it( fields ); // See TQDictIterator for( ; it.current(); ++it ) cout << it.currentKey() << ": " << it.current()->text() << endl; cout << endl; @@ -433,16 +433,16 @@ Example: \code - TQDict fields; - fields.insert( "forename", new QLineEdit( this ) ); - fields.insert( "surname", new QLineEdit( this ) ); - fields.insert( "age", new QLineEdit( this ) ); + TQDict fields; + fields.insert( "forename", new TQLineEdit( this ) ); + fields.insert( "surname", new TQLineEdit( this ) ); + fields.insert( "age", new TQLineEdit( this ) ); fields["forename"]->setText( "Homer" ); fields["surname"]->setText( "Simpson" ); fields["age"]->setText( "45" ); - TQDictIterator it( fields ); + TQDictIterator it( fields ); for( ; it.current(); ++it ) cout << it.currentKey() << ": " << it.current()->text() << endl; cout << endl; diff --git a/doc/tqintdict.doc b/doc/tqintdict.doc index e1df7a59c..07f7c434c 100644 --- a/doc/tqintdict.doc +++ b/doc/tqintdict.doc @@ -62,15 +62,15 @@ Example: \code - TQIntDict fields; // long int keys, QLineEdit* values + TQIntDict fields; // long int keys, TQLineEdit* values for ( int i = 0; i < 3; i++ ) - fields.insert( i, new QLineEdit( this ) ); + fields.insert( i, new TQLineEdit( this ) ); fields[0]->setText( "Homer" ); fields[1]->setText( "Simpson" ); fields[2]->setText( "45" ); - TQIntDictIterator it( fields ); + TQIntDictIterator it( fields ); for ( ; it.current(); ++it ) cout << it.currentKey() << ": " << it.current()->text() << endl; @@ -327,15 +327,15 @@ Example: \code - TQIntDict fields; + TQIntDict fields; for ( int i = 0; i < 3; i++ ) - fields.insert( i, new QLineEdit( this ) ); + fields.insert( i, new TQLineEdit( this ) ); fields[0]->setText( "Homer" ); fields[1]->setText( "Simpson" ); fields[2]->setText( "45" ); - TQIntDictIterator it( fields ); + TQIntDictIterator it( fields ); for ( ; it.current(); ++it ) cout << it.currentKey() << ": " << it.current()->text() << endl; diff --git a/doc/tqptrdict.doc b/doc/tqptrdict.doc index ee4d4655e..95883730c 100644 --- a/doc/tqptrdict.doc +++ b/doc/tqptrdict.doc @@ -62,11 +62,11 @@ \code TQPtrDict fields; // void* keys, char* values - QLineEdit *le1 = new QLineEdit( this ); + TQLineEdit *le1 = new TQLineEdit( this ); le1->setText( "Simpson" ); - QLineEdit *le2 = new QLineEdit( this ); + TQLineEdit *le2 = new TQLineEdit( this ); le2->setText( "Homer" ); - QLineEdit *le3 = new QLineEdit( this ); + TQLineEdit *le3 = new TQLineEdit( this ); le3->setText( "45" ); fields.insert( le1, "Surname" ); @@ -334,11 +334,11 @@ \code TQPtrDict fields; - QLineEdit *le1 = new QLineEdit( this ); + TQLineEdit *le1 = new TQLineEdit( this ); le1->setText( "Simpson" ); - QLineEdit *le2 = new QLineEdit( this ); + TQLineEdit *le2 = new TQLineEdit( this ); le2->setText( "Homer" ); - QLineEdit *le3 = new QLineEdit( this ); + TQLineEdit *le3 = new TQLineEdit( this ); le3->setText( "45" ); fields.insert( le1, "Surname" ); @@ -347,7 +347,7 @@ TQPtrDictIterator it( fields ); for( ; it.current(); ++it ) { - QLineEdit *le = (QLineEdit)it.currentKey(); + TQLineEdit *le = (TQLineEdit)it.currentKey(); cout << it.current() << ": " << le->text() << endl; } cout << endl; diff --git a/doc/tutorial.doc b/doc/tutorial.doc index 6528e00e8..80b0138e0 100644 --- a/doc/tutorial.doc +++ b/doc/tutorial.doc @@ -103,19 +103,19 @@ exactly one QApplication object in every application that uses Qt. QApplication manages various application-wide resources, such as the default font and cursor. -\printline qpushbutton +\printline tqpushbutton -This line includes the QPushButton class definition. The +This line includes the TQPushButton class definition. The \link hierarchy.html reference documentation \endlink for each class mentions at the top which file needs to be included to use that class. -QPushButton is a classical GUI push button that the user can press +TQPushButton is a classical GUI push button that the user can press and release. It manages its own look and feel, like every other \l TQWidget. A widget is a user interface object that can process user input and draw graphics. The programmer can change both the overall \link QApplication::setStyle() look and feel\endlink and many minor properties of it (such as color), as well as the widget's content. A -QPushButton can show either a text or a \l TQPixmap. +TQPushButton can show either a text or a \l TQPixmap. \printline main \printline { @@ -141,7 +141,7 @@ QApplication::argv() documentation for details. Note: It is essential that the QApplication object be created before any window-system parts of TQt are used. -\printline QPushButton +\printline TQPushButton Here, \e after the QApplication, comes the first window-system code: A push button is created. @@ -239,8 +239,8 @@ Since this program uses TQFont, it needs to include tqfont.h. Qt's font abstraction is rather different from the horror provided by X, and loading and using fonts has been highly optimized. -\skipto QPushButton -\printline QPushButton +\skipto TQPushButton +\printline TQPushButton This time, the button says "Quit" and that's exactly what the program will do when the user clicks the button. This is not a coincidence. @@ -292,8 +292,8 @@ makefile and build the application.) Try to resize the window. Press the button. Oops! That connect() would seem to make some difference. -Are there any other signals in QPushButton you can connect to quit? -Hint: The QPushButton inherits most of its behavior from QButton. +Are there any other signals in TQPushButton you can connect to quit? +Hint: The TQPushButton inherits most of its behavior from QButton. You're now ready for \link tutorial1-03.html Chapter 3.\endlink @@ -338,7 +338,7 @@ We set its width to 200 pixels and the height to 120 pixels. A child is born. -This QPushButton is created with both a text ("Quit") and a parent +This TQPushButton is created with both a text ("Quit") and a parent (box). A child widget is always on top of its parent. When displayed, it is clipped by its parent's bounds. @@ -477,7 +477,7 @@ makefile and build the application.) Try to create another MyWidget object in main(). What happens? -Try to add more buttons or put in widgets other than QPushButton. +Try to add more buttons or put in widgets other than TQPushButton. You're now ready for \link tutorial1-05.html Chapter 5.\endlink @@ -504,8 +504,8 @@ by using signals and slots, and how to handle resize events. \skipto qapp \printuntil qvbox -Three new include files are shown here. ntqslider.h and ntqlcdnumber.h are there -because we use two new widgets, QSlider and QLCDNumber. ntqvbox.h is +Three new include files are shown here. tqslider.h and tqlcdnumber.h are there +because we use two new widgets, TQSlider and TQLCDNumber. ntqvbox.h is here because we use Qt's automatic layout support. \skipto MyWidget @@ -522,18 +522,18 @@ therefore by MyWidget, too. \skipto lcd \printline lcd -\c lcd is a QLCDNumber, a widget that displays numbers in an LCD-like +\c lcd is a TQLCDNumber, a widget that displays numbers in an LCD-like fashion. This instance is set up to display two digits and to be a child of \e this. It is named "lcd". -\printline QSlider +\printline TQSlider \printline slider \printline slider -QSlider is a classical slider; the user can use the widget to drag +TQSlider is a classical slider; the user can use the widget to drag something to adjust an integer value in a range. Here we create a horizontal one, set its range to 0-99 (inclusive, see the \l -QSlider::setRange() documentation) and its initial value to 0. +TQSlider::setRange() documentation) and its initial value to 0. \printline connect @@ -563,12 +563,12 @@ makefile and build the application.) \section1 Exercises Try changing the LCD number to add more digits or \link -QLCDNumber::setMode() to change mode.\endlink You can even add four push +TQLCDNumber::setMode() to change mode.\endlink You can even add four push buttons to set the number base. You can also change the slider's range. -Perhaps it would have been better to use \l QSpinBox than a slider? +Perhaps it would have been better to use \l TQSpinBox than a slider? Try to make the application quit when the LCD number overflows. @@ -709,14 +709,14 @@ header file. \c ntqvbox.h is included. LCDRange inherits QVBox, and the header file of a parent class must always be included. We cheated a bit in the previous chapters, and we let \c tqwidget.h be included indirectly via -other header files such as \c ntqpushbutton.h. +other header files such as \c tqpushbutton.h. -\printline QSlider +\printline TQSlider This is another classic trick, but one that's much less used often. Because -we don't need QSlider in the \e interface of the class, only in the +we don't need TQSlider in the \e interface of the class, only in the implementation, we use a forward declaration of the class in the -header file and include the header file for QSlider in the .cpp +header file and include the header file for TQSlider in the .cpp file. This makes the compilation of big projects much faster, because when a @@ -778,15 +778,15 @@ the first is emitted, the second signal is also emitted. Let's look at what happens when the user operates the slider. The slider sees that its value has changed and emits the valueChanged() signal. That signal is connected both to the display() slot of the -QLCDNumber and to the valueChanged() signal of the LCDRange. +TQLCDNumber and to the valueChanged() signal of the LCDRange. Thus, when the signal is emitted, LCDRange emits its own -valueChanged() signal. In addition, QLCDNumber::display() is called +valueChanged() signal. In addition, TQLCDNumber::display() is called and shows the new number. Note that you're not guaranteed any particular order of execution - LCDRange::valueChanged() may be emitted before or after -QLCDNumber::display()and is entirely arbitrary. +TQLCDNumber::display()and is entirely arbitrary. \skipto LCDRange::value \printuntil } @@ -912,9 +912,9 @@ There is a change to the constructor (we'll discuss that later). \printline } SetRange() sets the range of the slider in the LCDRange. Because we -have set up the QLCDNumber to always display two digits, we want to +have set up the TQLCDNumber to always display two digits, we want to limit the possible range of \c minVal and \c maxVal to 0..99 to avoid -overflow of the QLCDNumber. (We could have allowed values down to -9 +overflow of the TQLCDNumber. (We could have allowed values down to -9 but chose not to.) If the arguments are illegal, we use Qt's tqWarning() function to issue a warning to the user and return immediately. tqWarning() is a printf-like function that by default @@ -1102,7 +1102,7 @@ to be terribly useful. However, its constructor just got a new line: The LCDRange sets the slider to be its focus proxy. That means that when someone (the program or the user) wants to give the LCDRange -keyboard focus, the slider should take care of it. QSlider has a decent +keyboard focus, the slider should take care of it. TQSlider has a decent keyboard interface, so with just one line of code we've given LCDRange one. @@ -1489,7 +1489,7 @@ Put the cannon in the bottom-right corner. Try adding a better keyboard interface. For example, make + and - increase and decrease the force and enter shoot. Hint: \l QAccel and new addStep() and subtractStep() slots in LCDRange, like \l -QSlider::addStep(). If you're bothered by the way the left and right +TQSlider::addStep(). If you're bothered by the way the left and right keys work (I am!), change that too. You're now ready for \link tutorial1-11.html Chapter 11.\endlink @@ -2104,7 +2104,7 @@ widget's children. \printline addWidget -At the top we add the QLCDNumber with a non-zero stretch. +At the top we add the TQLCDNumber with a non-zero stretch. \printline addWidget \printline addWidget @@ -2113,7 +2113,7 @@ Then we add the other two, both with the default zero stretch. This stretch control is something QVBoxLayout (and QHBoxLayout, and QGridLayout) offers but classes like QVBox do not. In this case -we're saying that the QLCDNumber should stretch and the others should +we're saying that the TQLCDNumber should stretch and the others should not. \section2 \l t13/cannon.h @@ -2223,7 +2223,7 @@ which was last seen as MyWidget. \printuntil }; We have now added four slots. These are protected and are used internally. -We have also added two QLCDNumbers (\c hits and \c shotsLeft) which display +We have also added two TQLCDNumbers (\c hits and \c shotsLeft) which display the game status. diff --git a/doc/tutorial2.doc b/doc/tutorial2.doc index be63894aa..c9d8bfa56 100644 --- a/doc/tutorial2.doc +++ b/doc/tutorial2.doc @@ -1029,7 +1029,7 @@ enter label text and choose a label color for each label. (Extracts from \c setdataform.h.) \quotefile chart/setdataform.h -\skipto public QDialog +\skipto public TQDialog \printuntil }; The header file is simple. The constructor takes a pointer to the @@ -1051,7 +1051,7 @@ Qt supports. We'll use these in the pattern combobox. \skipto SetDataForm::SetDataForm \printuntil m_decimalPlaces -We pass most of the arguments to the QDialog superclass. We assign the +We pass most of the arguments to the TQDialog superclass. We assign the elements vector pointer and the number of decimal places to display to member variables so that they are accessible by all SetDataForm's member functions. @@ -1085,7 +1085,7 @@ column and finally add the table to the tableButtonBox layout. We create a horizontal box layout to hold the buttons. -\skipto QPushButton +\skipto TQPushButton \printuntil addWidget We create a color button and add it to the buttonBox layout. We @@ -1099,7 +1099,7 @@ Since we want to separate the color button from the OK and Cancel buttons we next create a spacer and add that to the buttonBox layout. -\skipto QPushButton +\skipto TQPushButton \printuntil addWidget( cancelPushButton The OK and Cancel buttons are created and added to the buttonBox. We @@ -1129,7 +1129,7 @@ correct number of decimal places. \i If the user clicks the Color button we call a setColor() slot. \i The OK button is connected to the accept() slot; we will update the elements vector in this slot. -\i The Cancel button is connected to the QDialog reject() slot, and +\i The Cancel button is connected to the TQDialog reject() slot, and requires no further code or action on our part. \endlist @@ -1167,9 +1167,9 @@ simpler route: we set the cell's text to the name of the color. Next we populate the pattern combobox with the patterns. We will use the position of the chosen pattern in the combobox to determine which -pattern the user has selected. QTable can make use of QComboTableItem +pattern the user has selected. QTable can make use of TQComboTableItem items; but these only support text, so we use setCellWidget() to -insert \l{QComboBox}'s into the table instead. +insert \l{TQComboBox}'s into the table instead. Next we insert the element's label. Finally we set the label color in the same way as we set the value color. @@ -1209,7 +1209,7 @@ color. If they chose a color we fill the color cell's pixmap with that color and set the cell's text to the new color's name. \skipto ::accept( -\printuntil QDialog +\printuntil TQDialog \printline If the user clicks OK we must update the elements vector. We iterate @@ -1220,7 +1220,7 @@ color name as argument. The pattern is set to the pattern combobox's current item with an offset of 1 (since our pattern numbers begin at 1, but the combobox's items are indexed from 0). -Finally we call QDialog::accept(). +Finally we call TQDialog::accept().

            « File Handling | @@ -1244,7 +1244,7 @@ apply to all data sets in one place. (Extracts from \c optionsform.h.) \quotefile chart/optionsform.h -\skipto public QDialog +\skipto public TQDialog \printuntil }; The layout of this dialog is slightly more complicated than for the @@ -1268,7 +1268,7 @@ We include some some pixmaps to use in the chart type combobox. \skipto OptionsForm::OptionsForm \printuntil resize -We pass all the arguments on to the QDialog constructor, set a caption +We pass all the arguments on to the TQDialog constructor, set a caption and set an initial size. The layout of the form will be to have the chart type label and combo @@ -1328,10 +1328,10 @@ We only need three connections: \list 1 \i When the user clicks the font button we execute our own chooseFont() slot. -\i If the user clicks OK we call QDialog::accept(); it is up to the +\i If the user clicks OK we call TQDialog::accept(); it is up to the caller to read the data from the dialog's widgets and perform any necessary actions. -\i If the user clicks Cancel we call QDialog::reject(). +\i If the user clicks Cancel we call TQDialog::reject(). \endlist \skipto setBuddy diff --git a/examples/README b/examples/README index decd59dee..e9f4bff04 100644 --- a/examples/README +++ b/examples/README @@ -33,8 +33,8 @@ biff [Unix-specific] buttongroups This examples shows different types of group boxes (QButtonGroup, - and QGroupBox), and different kinds of buttons (QCheckBox, - QRadioButton, and QPushButton). It also shows how to add a + and QGroupBox), and different kinds of buttons (TQCheckBox, + TQRadioButton, and TQPushButton). It also shows how to add a TQPopupMenu to a button. canvas @@ -51,7 +51,7 @@ chart checklists Shows two list views with check box and radio button items. (These kinds of lists are often used with setup programs.) - Shows the use of QListView, QListViewItem, QCheckListItem, + Shows the use of QListView, QListViewItem, TQCheckListItem, QListViewItemIterator, and TQValueList. cursor @@ -66,7 +66,7 @@ customlayout dclock This example displays a digital LCD clock and can switch between time and date. - It uses the QLCDNumber widget and a couple of TQTimers. + It uses the TQLCDNumber widget and a couple of TQTimers. demo Run this to see almost all of Qt's widgets in action, including @@ -113,7 +113,7 @@ fileiconview a widget derived from TQIconView to display the current directory. It uses the DirectoryView widget from the dirview example to display the directory tree. - It also shows how to add a QComboBox to a TQToolBar and how to + It also shows how to add a TQComboBox to a TQToolBar and how to implement a context menu using TQPopupMenu. fonts [obsolete; see the qfd example instead] @@ -166,7 +166,7 @@ life An implementation of the life game with a Unix-flavor GUI. lineedits - This example shows how to use various properties of QLineEdit + This example shows how to use various properties of TQLineEdit including echo modes, input masks, and validators. listbox @@ -174,7 +174,7 @@ listbox listboxcombo This example shows how to use QListBox (with single selection and - multi selection) and QComboBox (editable and non-editable). + multi selection) and TQComboBox (editable and non-editable). listviews This examples shows how to work with QListView (a tree view @@ -282,7 +282,7 @@ qwerty Simple text editor for testing different character encodings. rangecontrols - This examples shows how to use QSpinBox and QSlider. + This examples shows how to use TQSpinBox and TQSlider. regexptester This little application is useful for testing regular expressions. @@ -299,12 +299,12 @@ scribble with different pen colors and widths and save the result as a pixmap in various formats. It shows how to do drawing using a TQWidget subclass (rather than a TQCanvas for example). It also - shows how to add a QSpinBox to a TQToolBar and how to implement a - button that pops up a menu (using QPushButton and TQPopupMenu), and + shows how to add a TQSpinBox to a TQToolBar and how to implement a + button that pops up a menu (using TQPushButton and TQPopupMenu), and also how to use the TQColorDialog. scrollview - This example shows one way of using a QScrollview. This widget is + This example shows one way of using a TQScrollview. This widget is highly optimized for showing very large contents including child widgets. @@ -343,7 +343,7 @@ table/bigtable table/small-table-demo A small, simple QTable example that uses QTableItems to show text - and pixmaps, and QComboTableItems and QCheckTableItems to show how + and pixmaps, and TQComboTableItems and TQCheckTableItems to show how they work. table/statistics diff --git a/examples/addressbook/centralwidget.cpp b/examples/addressbook/centralwidget.cpp index 4a2a3f97c..d993a1565 100644 --- a/examples/addressbook/centralwidget.cpp +++ b/examples/addressbook/centralwidget.cpp @@ -14,10 +14,10 @@ #include #include #include -#include -#include +#include +#include #include -#include +#include #include #include diff --git a/examples/buttongroups/buttongroups.cpp b/examples/buttongroups/buttongroups.cpp index 4af70a84b..ed2534fc9 100644 --- a/examples/buttongroups/buttongroups.cpp +++ b/examples/buttongroups/buttongroups.cpp @@ -12,10 +12,10 @@ #include #include #include -#include -#include +#include +#include #include -#include +#include /* * Constructor diff --git a/examples/chart/chartform.cpp b/examples/chart/chartform.cpp index a36676214..9a7abfefd 100644 --- a/examples/chart/chartform.cpp +++ b/examples/chart/chartform.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include #include @@ -15,9 +15,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include diff --git a/examples/chart/optionsform.cpp b/examples/chart/optionsform.cpp index 09c05d4ef..094b549a0 100644 --- a/examples/chart/optionsform.cpp +++ b/examples/chart/optionsform.cpp @@ -1,15 +1,15 @@ #include "optionsform.h" #include -#include +#include #include #include #include #include #include -#include -#include -#include +#include +#include +#include #include "images/options_horizontalbarchart.xpm" #include "images/options_piechart.xpm" diff --git a/examples/chart/optionsform.h b/examples/chart/optionsform.h index 8277ad376..93454721a 100644 --- a/examples/chart/optionsform.h +++ b/examples/chart/optionsform.h @@ -1,7 +1,7 @@ #ifndef OPTIONSFORM_H #define OPTIONSFORM_H -#include +#include class TQButtonGroup; class TQComboBox; diff --git a/examples/chart/setdataform.cpp b/examples/chart/setdataform.cpp index 82bd2cad8..66910d096 100644 --- a/examples/chart/setdataform.cpp +++ b/examples/chart/setdataform.cpp @@ -2,10 +2,10 @@ #include "chartform.h" #include -#include +#include #include #include -#include +#include #include #include "images/pattern01.xpm" diff --git a/examples/chart/setdataform.h b/examples/chart/setdataform.h index 7759f6158..49867679e 100644 --- a/examples/chart/setdataform.h +++ b/examples/chart/setdataform.h @@ -3,7 +3,7 @@ #include "element.h" -#include +#include class TQHBoxLayout; class TQPushButton; diff --git a/examples/checklists/checklists.cpp b/examples/checklists/checklists.cpp index f2a1cdbfb..5de580655 100644 --- a/examples/checklists/checklists.cpp +++ b/examples/checklists/checklists.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include /* diff --git a/examples/customlayout/main.cpp b/examples/customlayout/main.cpp index 33443dc32..af5a7cb31 100644 --- a/examples/customlayout/main.cpp +++ b/examples/customlayout/main.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include diff --git a/examples/dclock/dclock.h b/examples/dclock/dclock.h index bffaab21f..4a0aded50 100644 --- a/examples/dclock/dclock.h +++ b/examples/dclock/dclock.h @@ -10,7 +10,7 @@ #ifndef DCLOCK_H #define DCLOCK_H -#include +#include class DigitalClock : public TQLCDNumber // digital clock widget diff --git a/examples/demo/display.cpp b/examples/demo/display.cpp index 131a69ae2..1b86db32e 100644 --- a/examples/demo/display.cpp +++ b/examples/demo/display.cpp @@ -12,12 +12,12 @@ #include #include #include -#include +#include #include -#include -#include +#include +#include #include -#include +#include #include diff --git a/examples/demo/graph.cpp b/examples/demo/graph.cpp index 26b203455..404564401 100644 --- a/examples/demo/graph.cpp +++ b/examples/demo/graph.cpp @@ -3,8 +3,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/examples/demo/opengl/glworkspace.cpp b/examples/demo/opengl/glworkspace.cpp index 6a2d7fe89..419ec6deb 100644 --- a/examples/demo/opengl/glworkspace.cpp +++ b/examples/demo/opengl/glworkspace.cpp @@ -4,14 +4,14 @@ #include "gltexobj.h" #include -#include +#include #include #include #include #include #include #include -#include +#include #include #include #include "printpreview.h" diff --git a/examples/demo/qasteroids/toplevel.cpp b/examples/demo/qasteroids/toplevel.cpp index d40ea72a6..ad548127b 100644 --- a/examples/demo/qasteroids/toplevel.cpp +++ b/examples/demo/qasteroids/toplevel.cpp @@ -7,8 +7,8 @@ #include #include #include -#include -#include +#include +#include #include diff --git a/examples/demo/sql/sqlex.ui.h b/examples/demo/sql/sqlex.ui.h index 870efb40e..a72272955 100644 --- a/examples/demo/sql/sqlex.ui.h +++ b/examples/demo/sql/sqlex.ui.h @@ -8,9 +8,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/examples/demo/textdrawing/example.html b/examples/demo/textdrawing/example.html index a4fe80929..fc48cca7b 100644 --- a/examples/demo/textdrawing/example.html +++ b/examples/demo/textdrawing/example.html @@ -96,14 +96,14 @@ corner (both lines being flush with the right side of the label): widget. For this use, TQLabel provides a handy mechanism for adding an accelerator key (see TQAccel) that will set the keyboard focus to the other widget (called the TQLabel's "buddy"). Example: -

                 TQLineEdit* phoneEdit = new TQLineEdit( this, "phoneEdit" );
            +

                 TQLineEdit* phoneEdit = new TQLineEdit( this, "phoneEdit" );
                  TQLabel* phoneLabel = new TQLabel( phoneEdit, "&Phone:", this, "phoneLabel" );
             

            In this example, keyboard focus is transferred to the label's buddy -(the TQLineEdit) when the user presses Alt-P. You can also +(the TQLineEdit) when the user presses Alt-P. You can also use the setBuddy() function to accomplish the same.

            -

            See also TQLineEdit, TQTextView, TQPixmap, TQMovie and GUI Design Handbook: Label +

            See also TQLineEdit, TQTextView, TQPixmap, TQMovie and GUI Design Handbook: Label

            Examples: cursor/cursor.cpp layout/layout.cpp @@ -223,10 +223,10 @@ alignment flag is turned on; see setAlignment()).

            In a dialog, you might create two data entry widgets and a label for each, and set up the geometry layout so each label is just to the left of its data entry widget (its "buddy"), somewhat like this: -

                TQLineEdit *nameEd  = new TQLineEdit( this );
            +

                TQLineEdit *nameEd  = new TQLineEdit( this );
                 TQLabel    *nameLb  = new TQLabel( "&Name:", this );
                 nameLb->setBuddy( nameEd );
            -    TQLineEdit *phoneEd = new TQLineEdit( this );
            +    TQLineEdit *phoneEd = new TQLineEdit( this );
                 TQLabel    *phoneLb = new TQLabel( "&Phone:", this );
                 phoneLb->setBuddy( phoneEd );
                 // ( layout setup not shown )
            diff --git a/examples/demo/textdrawing/helpwindow.cpp b/examples/demo/textdrawing/helpwindow.cpp
            index 8cab2ddda..099b5dde0 100644
            --- a/examples/demo/textdrawing/helpwindow.cpp
            +++ b/examples/demo/textdrawing/helpwindow.cpp
            @@ -21,9 +21,9 @@
             #include 
             #include 
             #include 
            -#include 
            +#include 
             #include 
            -#include 
            +#include 
             #include 
             #include 
             #include 
            diff --git a/examples/demo/textdrawing/textedit.cpp b/examples/demo/textdrawing/textedit.cpp
            index f2017762f..091fb9eb5 100644
            --- a/examples/demo/textdrawing/textedit.cpp
            +++ b/examples/demo/textdrawing/textedit.cpp
            @@ -17,8 +17,8 @@
             #include 
             #include 
             #include 
            -#include 
            -#include 
            +#include 
            +#include 
             #include 
             #include 
             #include 
            diff --git a/examples/distributor/distributor.ui.h b/examples/distributor/distributor.ui.h
            index 2e853bd22..b4650bd4f 100644
            --- a/examples/distributor/distributor.ui.h
            +++ b/examples/distributor/distributor.ui.h
            @@ -13,9 +13,9 @@
             #include 
             #include 
             #include 
            -#include 
            +#include 
             #include 
            -#include 
            +#include 
             #include 
             
             
            diff --git a/examples/dragdrop/main.cpp b/examples/dragdrop/main.cpp
            index acc721b8f..6d942fef5 100644
            --- a/examples/dragdrop/main.cpp
            +++ b/examples/dragdrop/main.cpp
            @@ -13,7 +13,7 @@
             #include "dropsite.h"
             #include "secret.h"
             #include 
            -#include 
            +#include 
             #include 
             #include 
             
            diff --git a/examples/drawdemo/drawdemo.cpp b/examples/drawdemo/drawdemo.cpp
            index d3d0b309d..6d2bed24f 100644
            --- a/examples/drawdemo/drawdemo.cpp
            +++ b/examples/drawdemo/drawdemo.cpp
            @@ -10,8 +10,8 @@
             #include 
             #include 
             #include 
            -#include 
            -#include 
            +#include 
            +#include 
             #include 
             #include 
             #include 
            diff --git a/examples/extension/mainform.ui.h b/examples/extension/mainform.ui.h
            index 1eab636fa..3ea3d5ed8 100644
            --- a/examples/extension/mainform.ui.h
            +++ b/examples/extension/mainform.ui.h
            @@ -8,8 +8,8 @@
             #include "dialogform.h"
             #include "extension.h"
             #include 
            -#include 
            -#include 
            +#include 
            +#include 
             
             void MainForm::init()
             {
            diff --git a/examples/fileiconview/mainwindow.cpp b/examples/fileiconview/mainwindow.cpp
            index eccf8885a..f714e194e 100644
            --- a/examples/fileiconview/mainwindow.cpp
            +++ b/examples/fileiconview/mainwindow.cpp
            @@ -16,7 +16,7 @@
             #include 
             #include 
             #include 
            -#include 
            +#include 
             #include 
             #include 
             #include 
            diff --git a/examples/fonts/simple-tqfont-demo/viewer.cpp b/examples/fonts/simple-tqfont-demo/viewer.cpp
            index 88c202e3d..111abdbb7 100644
            --- a/examples/fonts/simple-tqfont-demo/viewer.cpp
            +++ b/examples/fonts/simple-tqfont-demo/viewer.cpp
            @@ -3,7 +3,7 @@
             #include 
             #include 
             #include 
            -#include 
            +#include 
             #include 
             
             Viewer::Viewer()
            diff --git a/examples/hello/hello.cpp b/examples/hello/hello.cpp
            index 815b586ba..084a6d7d4 100644
            --- a/examples/hello/hello.cpp
            +++ b/examples/hello/hello.cpp
            @@ -8,7 +8,7 @@
             *****************************************************************************/
             
             #include "hello.h"
            -#include 
            +#include 
             #include 
             #include 
             #include 
            diff --git a/examples/helpdemo/helpdemo.cpp b/examples/helpdemo/helpdemo.cpp
            index ca96b23d9..f10174d14 100644
            --- a/examples/helpdemo/helpdemo.cpp
            +++ b/examples/helpdemo/helpdemo.cpp
            @@ -1,11 +1,11 @@
             #include 
             #include 
            -#include 
            +#include 
             #include 
             #include 
            -#include 
            +#include 
             #include 
            -#include 
            +#include 
             #include 
             
             #include "helpdemo.h"
            diff --git a/examples/helpsystem/helpsystem.doc b/examples/helpsystem/helpsystem.doc
            index 8c0906964..97221322e 100644
            --- a/examples/helpsystem/helpsystem.doc
            +++ b/examples/helpsystem/helpsystem.doc
            @@ -51,7 +51,7 @@
             
               \printuntil }
             
            -  Since QTable is a QScrollView all user interaction 
            +  Since QTable is a TQScrollView all user interaction 
               happens on QTable's viewport() . The TableToolTip 
               constructor passes the viewport() and the tooltip
               group to the TQToolTip constructor, and initializes the table
            diff --git a/examples/helpsystem/whatsthis.cpp b/examples/helpsystem/whatsthis.cpp
            index 1e0991fcf..418e3a4db 100644
            --- a/examples/helpsystem/whatsthis.cpp
            +++ b/examples/helpsystem/whatsthis.cpp
            @@ -86,12 +86,12 @@ TQString TableWhatsThis::text( const TQPoint &p )
             	return TQString("This is a TQTableItem.").
             		       arg(docsPath);
                 } else if ( TQComboTableItem::RTTI == i->rtti() ) {
            -	return TQString("This is a TQComboTableItem."
            +	return TQString("This is a TQComboTableItem."
             		       "
            It can be used to provide multiple-choice items in a table."). arg(docsPath); } else if ( TQCheckTableItem::RTTI == i->rtti() ) { - return TQString("This is a TQCheckTableItem." - "
            It provide checkboxes in tables."). + return TQString("This is a TQCheckTableItem." + "
            It provide checkboxes in tables."). arg(docsPath).arg(docsPath); } diff --git a/examples/helpviewer/helpwindow.cpp b/examples/helpviewer/helpwindow.cpp index dcf95de06..5565d5275 100644 --- a/examples/helpviewer/helpwindow.cpp +++ b/examples/helpviewer/helpwindow.cpp @@ -21,9 +21,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include diff --git a/examples/i18n/main.cpp b/examples/i18n/main.cpp index e33a37281..de0a3bb6c 100644 --- a/examples/i18n/main.cpp +++ b/examples/i18n/main.cpp @@ -11,11 +11,11 @@ #include #include #include -#include +#include #include #include #include -#include +#include #include #include #include diff --git a/examples/i18n/mywidget.cpp b/examples/i18n/mywidget.cpp index ce9218ce7..74aa506e6 100644 --- a/examples/i18n/mywidget.cpp +++ b/examples/i18n/mywidget.cpp @@ -8,10 +8,10 @@ *****************************************************************************/ #include -#include +#include #include #include -#include +#include #include #include #include diff --git a/examples/layout/layout.cpp b/examples/layout/layout.cpp index 3bf6070cc..42642c71e 100644 --- a/examples/layout/layout.cpp +++ b/examples/layout/layout.cpp @@ -10,9 +10,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include diff --git a/examples/life/life.cpp b/examples/life/life.cpp index 1da6b3f15..6483ea97b 100644 --- a/examples/life/life.cpp +++ b/examples/life/life.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include diff --git a/examples/life/lifedlg.cpp b/examples/life/lifedlg.cpp index 7f1371b6f..9bc47e8b1 100644 --- a/examples/life/lifedlg.cpp +++ b/examples/life/lifedlg.cpp @@ -9,10 +9,10 @@ #include "lifedlg.h" #include -#include +#include #include -#include -#include +#include +#include #include #include diff --git a/examples/lineedits/lineedits.cpp b/examples/lineedits/lineedits.cpp index d4d42597a..a61972583 100644 --- a/examples/lineedits/lineedits.cpp +++ b/examples/lineedits/lineedits.cpp @@ -9,8 +9,8 @@ #include "lineedits.h" -#include -#include +#include +#include #include #include #include diff --git a/examples/listbox/listbox.cpp b/examples/listbox/listbox.cpp index af9b4b2aa..51b7b4f49 100644 --- a/examples/listbox/listbox.cpp +++ b/examples/listbox/listbox.cpp @@ -10,13 +10,13 @@ #include "listbox.h" #include -#include -#include -#include +#include +#include +#include #include #include #include -#include +#include ListBoxDemo::ListBoxDemo() diff --git a/examples/listboxcombo/listboxcombo.cpp b/examples/listboxcombo/listboxcombo.cpp index 1b5a719c4..28558cf77 100644 --- a/examples/listboxcombo/listboxcombo.cpp +++ b/examples/listboxcombo/listboxcombo.cpp @@ -9,10 +9,10 @@ #include "listboxcombo.h" -#include +#include #include #include -#include +#include #include #include #include diff --git a/examples/mdi/application.cpp b/examples/mdi/application.cpp index 458b8e751..f339e8839 100644 --- a/examples/mdi/application.cpp +++ b/examples/mdi/application.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/movies/main.cpp b/examples/movies/main.cpp index 40fe25c4e..50249b93f 100644 --- a/examples/movies/main.cpp +++ b/examples/movies/main.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include diff --git a/examples/network/clientserver/client/client.cpp b/examples/network/clientserver/client/client.cpp index 5d7eed62d..2a8b6b3e0 100644 --- a/examples/network/clientserver/client/client.cpp +++ b/examples/network/clientserver/client/client.cpp @@ -12,9 +12,9 @@ #include #include #include -#include +#include #include -#include +#include #include diff --git a/examples/network/clientserver/server/server.cpp b/examples/network/clientserver/server/server.cpp index 0550e92fa..c2d53255b 100644 --- a/examples/network/clientserver/server/server.cpp +++ b/examples/network/clientserver/server/server.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/examples/network/ftpclient/ftpmainwindow.ui.h b/examples/network/ftpclient/ftpmainwindow.ui.h index 0c32d1ad9..603ca1479 100644 --- a/examples/network/ftpclient/ftpmainwindow.ui.h +++ b/examples/network/ftpclient/ftpmainwindow.ui.h @@ -19,8 +19,8 @@ *****************************************************************************/ #include -#include -#include +#include +#include #include #include #include diff --git a/examples/network/httpd/httpd.cpp b/examples/network/httpd/httpd.cpp index 448f87c2e..db01925e8 100644 --- a/examples/network/httpd/httpd.cpp +++ b/examples/network/httpd/httpd.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include // HttpDaemon is the the class that implements the simple HTTP server. class HttpDaemon : public TQServerSocket diff --git a/examples/network/infoprotocol/infoclient/client.cpp b/examples/network/infoprotocol/infoclient/client.cpp index 114296bc4..857c4924c 100644 --- a/examples/network/infoprotocol/infoclient/client.cpp +++ b/examples/network/infoprotocol/infoclient/client.cpp @@ -10,9 +10,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include diff --git a/examples/network/infoprotocol/infoserver/server.cpp b/examples/network/infoprotocol/infoserver/server.cpp index a651d38a9..509a55623 100644 --- a/examples/network/infoprotocol/infoserver/server.cpp +++ b/examples/network/infoprotocol/infoserver/server.cpp @@ -8,7 +8,7 @@ *****************************************************************************/ #include -#include +#include #include #include #include diff --git a/examples/network/infoprotocol/infourlclient/client.cpp b/examples/network/infoprotocol/infourlclient/client.cpp index ee1a85c85..29afa91c8 100644 --- a/examples/network/infoprotocol/infourlclient/client.cpp +++ b/examples/network/infoprotocol/infourlclient/client.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include "qip.h" diff --git a/examples/network/mail/composer.cpp b/examples/network/mail/composer.cpp index 790a47153..603a0a84a 100644 --- a/examples/network/mail/composer.cpp +++ b/examples/network/mail/composer.cpp @@ -10,9 +10,9 @@ #include "composer.h" #include "smtp.h" -#include +#include #include -#include +#include #include #include diff --git a/examples/network/networkprotocol/view.cpp b/examples/network/networkprotocol/view.cpp index 55de084a6..416fe04d4 100644 --- a/examples/network/networkprotocol/view.cpp +++ b/examples/network/networkprotocol/view.cpp @@ -10,7 +10,7 @@ #include "view.h" #include -#include +#include #include #include diff --git a/examples/network/remotecontrol/remotectrlimpl.cpp b/examples/network/remotecontrol/remotectrlimpl.cpp index e92aef67d..70e5f7965 100644 --- a/examples/network/remotecontrol/remotectrlimpl.cpp +++ b/examples/network/remotecontrol/remotectrlimpl.cpp @@ -1,7 +1,7 @@ #include "remotectrlimpl.h" -#include -#include +#include +#include #include #include #include diff --git a/examples/opengl/box/globjwin.cpp b/examples/opengl/box/globjwin.cpp index 8a8c62047..5bc52fb99 100644 --- a/examples/opengl/box/globjwin.cpp +++ b/examples/opengl/box/globjwin.cpp @@ -7,8 +7,8 @@ ** *****************************************************************************/ -#include -#include +#include +#include #include #include #include diff --git a/examples/opengl/glpixmap/globjwin.cpp b/examples/opengl/glpixmap/globjwin.cpp index 568117793..52ab136dd 100644 --- a/examples/opengl/glpixmap/globjwin.cpp +++ b/examples/opengl/glpixmap/globjwin.cpp @@ -14,8 +14,8 @@ ****************************************************************************/ -#include -#include +#include +#include #include #include #include diff --git a/examples/opengl/overlay_x11/README b/examples/opengl/overlay_x11/README index 00b0f6454..d6afecfdc 100644 --- a/examples/opengl/overlay_x11/README +++ b/examples/opengl/overlay_x11/README @@ -71,4 +71,4 @@ for what you want. This way, the normal TQt widgets can be used as overlays for fancy effects: just create a palette for them with the transparent color for the wanted color roles, e.g. Background and Base, in the Normal and/or Active modes. This way, you can create -see-through QPushButtons etc. +see-through TQPushButtons etc. diff --git a/examples/opengl/overlay_x11/overlay_x11.doc b/examples/opengl/overlay_x11/overlay_x11.doc index d38bff08c..844621779 100644 --- a/examples/opengl/overlay_x11/overlay_x11.doc +++ b/examples/opengl/overlay_x11/overlay_x11.doc @@ -76,7 +76,7 @@ transparent color for what you want. This way, the normal TQt widgets can be used as overlays for fancy effects. Just create a palette for them with the transparent color for the relevant color roles, e.g. Background and Base, in the Normal and/or Active modes. This way, you -can create see-through QPushButtons etc. +can create see-through TQPushButtons etc. \endlist */ diff --git a/examples/opengl/sharedbox/globjwin.cpp b/examples/opengl/sharedbox/globjwin.cpp index 576b17711..6d832453d 100644 --- a/examples/opengl/sharedbox/globjwin.cpp +++ b/examples/opengl/sharedbox/globjwin.cpp @@ -7,8 +7,8 @@ ** *****************************************************************************/ -#include -#include +#include +#include #include #include #include diff --git a/examples/opengl/texture/globjwin.cpp b/examples/opengl/texture/globjwin.cpp index 65ee40225..f09974149 100644 --- a/examples/opengl/texture/globjwin.cpp +++ b/examples/opengl/texture/globjwin.cpp @@ -7,8 +7,8 @@ ** *****************************************************************************/ -#include -#include +#include +#include #include #include #include diff --git a/examples/popup/popup.h b/examples/popup/popup.h index 6145b2139..819ca1e2f 100644 --- a/examples/popup/popup.h +++ b/examples/popup/popup.h @@ -14,8 +14,8 @@ #ifndef POPUP_H #define POPUP_H #include -#include -#include +#include +#include class FancyPopup : public TQLabel { diff --git a/examples/process/process.cpp b/examples/process/process.cpp index 364e1a135..80730700a 100644 --- a/examples/process/process.cpp +++ b/examples/process/process.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include diff --git a/examples/progressbar/progressbar.cpp b/examples/progressbar/progressbar.cpp index dfe2d70a7..c321ade9e 100644 --- a/examples/progressbar/progressbar.cpp +++ b/examples/progressbar/progressbar.cpp @@ -9,8 +9,8 @@ #include "progressbar.h" -#include -#include +#include +#include #include #include diff --git a/examples/qfd/fontdisplayer.cpp b/examples/qfd/fontdisplayer.cpp index d690d155a..6d6de8c26 100644 --- a/examples/qfd/fontdisplayer.cpp +++ b/examples/qfd/fontdisplayer.cpp @@ -9,13 +9,13 @@ #include "fontdisplayer.h" #include -#include -#include +#include +#include #include #include #include #include -#include +#include #include #include diff --git a/examples/qfd/qfd.cpp b/examples/qfd/qfd.cpp index 752a59e99..d5e3dd84d 100644 --- a/examples/qfd/qfd.cpp +++ b/examples/qfd/qfd.cpp @@ -10,7 +10,7 @@ #include "fontdisplayer.h" #include -#include +#include #include #include diff --git a/examples/qmag/qmag.cpp b/examples/qmag/qmag.cpp index c6b810c77..efca57ef7 100644 --- a/examples/qmag/qmag.cpp +++ b/examples/qmag/qmag.cpp @@ -7,8 +7,8 @@ ** *****************************************************************************/ -#include -#include +#include +#include #include #include #include diff --git a/examples/rangecontrols/rangecontrols.cpp b/examples/rangecontrols/rangecontrols.cpp index 808a2ec0d..a7d331ee3 100644 --- a/examples/rangecontrols/rangecontrols.cpp +++ b/examples/rangecontrols/rangecontrols.cpp @@ -10,12 +10,12 @@ #include "rangecontrols.h" #include -#include -#include +#include +#include #include #include -#include -#include +#include +#include #include diff --git a/examples/regexptester/regexptester.cpp b/examples/regexptester/regexptester.cpp index 13c6ca0e6..6942e64ec 100644 --- a/examples/regexptester/regexptester.cpp +++ b/examples/regexptester/regexptester.cpp @@ -1,10 +1,10 @@ #include -#include +#include #include -#include +#include #include #include -#include +#include #include #include #include diff --git a/examples/regexptester/regexptester.h b/examples/regexptester/regexptester.h index d3256f556..0dbb50d05 100644 --- a/examples/regexptester/regexptester.h +++ b/examples/regexptester/regexptester.h @@ -1,7 +1,7 @@ #ifndef REGEXPTESTER_H #define REGEXPTESTER_H -#include +#include class TQCheckBox; class TQComboBox; diff --git a/examples/richtext/richtext.cpp b/examples/richtext/richtext.cpp index 6cf45e048..9a97228bb 100644 --- a/examples/richtext/richtext.cpp +++ b/examples/richtext/richtext.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include diff --git a/examples/rot13/rot13.cpp b/examples/rot13/rot13.cpp index dfcc5d684..e64323664 100644 --- a/examples/rot13/rot13.cpp +++ b/examples/rot13/rot13.cpp @@ -10,7 +10,7 @@ #include "rot13.h" #include -#include +#include #include #include diff --git a/examples/scribble/scribble.cpp b/examples/scribble/scribble.cpp index 39b110014..a5f4dce94 100644 --- a/examples/scribble/scribble.cpp +++ b/examples/scribble/scribble.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/scrollview/README b/examples/scrollview/README index 3bdaa7def..e07df00ce 100644 --- a/examples/scrollview/README +++ b/examples/scrollview/README @@ -1,3 +1,3 @@ -This example demonstrates the use of QScrollView for displaying large -widgets. Both techniques are demonstrated: using QScrollView to scroll -around a large widget, and drawing arbitrary material in a QScrollView. +This example demonstrates the use of TQScrollView for displaying large +widgets. Both techniques are demonstrated: using TQScrollView to scroll +around a large widget, and drawing arbitrary material in a TQScrollView. diff --git a/examples/scrollview/scrollview.cpp b/examples/scrollview/scrollview.cpp index bfaa81f69..c1d444ba3 100644 --- a/examples/scrollview/scrollview.cpp +++ b/examples/scrollview/scrollview.cpp @@ -7,11 +7,11 @@ ** *****************************************************************************/ -#include +#include #include #include #include -#include +#include #include #include #include diff --git a/examples/showimg/imagetexteditor.cpp b/examples/showimg/imagetexteditor.cpp index cbc09cfdb..d69ef74dd 100644 --- a/examples/showimg/imagetexteditor.cpp +++ b/examples/showimg/imagetexteditor.cpp @@ -13,12 +13,12 @@ #include #include #include -#include +#include #include #include -#include +#include #include -#include +#include ImageTextEditor::ImageTextEditor( TQImage& i, TQWidget *parent, const char *name, WFlags f ) : diff --git a/examples/showimg/imagetexteditor.h b/examples/showimg/imagetexteditor.h index 21664d278..7cc5c2489 100644 --- a/examples/showimg/imagetexteditor.h +++ b/examples/showimg/imagetexteditor.h @@ -10,7 +10,7 @@ #ifndef IMAGETEXTEDITOR_H #define IMAGETEXTEDITOR_H -#include +#include class TQImage; class TQComboBox; diff --git a/examples/sql/overview/custom1/main.h b/examples/sql/overview/custom1/main.h index c3c65a626..488c34bbc 100644 --- a/examples/sql/overview/custom1/main.h +++ b/examples/sql/overview/custom1/main.h @@ -8,11 +8,11 @@ *****************************************************************************/ #include -#include +#include #include #include -#include -#include +#include +#include #include #include #include diff --git a/examples/sql/overview/form1/main.cpp b/examples/sql/overview/form1/main.cpp index 5f3dd8f2e..cf3cb2895 100644 --- a/examples/sql/overview/form1/main.cpp +++ b/examples/sql/overview/form1/main.cpp @@ -8,10 +8,10 @@ *****************************************************************************/ #include -#include +#include #include #include -#include +#include #include #include #include diff --git a/examples/sql/overview/form2/main.h b/examples/sql/overview/form2/main.h index 42d152d41..d4a4f58b2 100644 --- a/examples/sql/overview/form2/main.h +++ b/examples/sql/overview/form2/main.h @@ -8,11 +8,11 @@ *****************************************************************************/ #include -#include +#include #include #include -#include -#include +#include +#include #include #include #include diff --git a/examples/sql/overview/table3/main.h b/examples/sql/overview/table3/main.h index 37efecfe8..b93e94b1d 100644 --- a/examples/sql/overview/table3/main.h +++ b/examples/sql/overview/table3/main.h @@ -8,7 +8,7 @@ *****************************************************************************/ #include -#include +#include #include #include #include diff --git a/examples/sql/overview/table4/main.h b/examples/sql/overview/table4/main.h index d4e84d2ce..46cbdc71d 100644 --- a/examples/sql/overview/table4/main.h +++ b/examples/sql/overview/table4/main.h @@ -8,7 +8,7 @@ *****************************************************************************/ #include -#include +#include #include #include #include diff --git a/examples/tabdialog/tabdialog.cpp b/examples/tabdialog/tabdialog.cpp index 129013827..a001bdefa 100644 --- a/examples/tabdialog/tabdialog.cpp +++ b/examples/tabdialog/tabdialog.cpp @@ -11,10 +11,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include diff --git a/examples/table/statistics/statistics.cpp b/examples/table/statistics/statistics.cpp index c74270336..8a906a324 100644 --- a/examples/table/statistics/statistics.cpp +++ b/examples/table/statistics/statistics.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include const char* dirs[] = { diff --git a/examples/table/statistics/statistics.h b/examples/table/statistics/statistics.h index abc15cf8d..21d248a7c 100644 --- a/examples/table/statistics/statistics.h +++ b/examples/table/statistics/statistics.h @@ -11,7 +11,7 @@ #define STATISTICS_H #include -#include +#include class TableItem : public TQTableItem { diff --git a/examples/tablet/scribble.cpp b/examples/tablet/scribble.cpp index 800fb4033..f19c91254 100644 --- a/examples/tablet/scribble.cpp +++ b/examples/tablet/scribble.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/tetrix/README b/examples/tetrix/README index 148260a71..cf2cb3fb7 100644 --- a/examples/tetrix/README +++ b/examples/tetrix/README @@ -5,7 +5,7 @@ fact the first TQt application and was written at a time when TQt only had pushbutton widgets and the drawing engine was limited to drawing text in a single font and drawing lines (no kidding, those were the only two drawing operations). In fact the tetrix project doubled the -number of widgets in TQt by introducing the QLCDNumber widget. The whole +number of widgets in TQt by introducing the TQLCDNumber widget. The whole application was written in 5 evenings and 1 weekend and is not very well documented. The tetrix engine is implemented in the GenericTetrix class and was first made on my good old 10 MHZ AT where I made a DOS diff --git a/examples/tetrix/qtetrix.h b/examples/tetrix/qtetrix.h index b831f96dd..f3cfddc71 100644 --- a/examples/tetrix/qtetrix.h +++ b/examples/tetrix/qtetrix.h @@ -12,9 +12,9 @@ #include "qtetrixb.h" #include -#include +#include #include -#include +#include #include diff --git a/examples/textedit/textedit.cpp b/examples/textedit/textedit.cpp index ed626896d..33472c451 100644 --- a/examples/textedit/textedit.cpp +++ b/examples/textedit/textedit.cpp @@ -17,8 +17,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/examples/themes/metal.cpp b/examples/themes/metal.cpp index 02ec1c4ad..557edf7c7 100644 --- a/examples/themes/metal.cpp +++ b/examples/themes/metal.cpp @@ -12,7 +12,7 @@ #ifndef TQT_NO_STYLE_WINDOWS #include "ntqapplication.h" -#include "ntqcombobox.h" +#include "tqcombobox.h" #include "tqpainter.h" #include "ntqdrawutil.h" // for now #include "tqpixmap.h" // for now @@ -20,11 +20,11 @@ #include "tqwidget.h" #include "tqlabel.h" #include "tqimage.h" -#include "ntqpushbutton.h" +#include "tqpushbutton.h" #include "tqwidget.h" #include "ntqrangecontrol.h" -#include "ntqscrollbar.h" -#include "ntqslider.h" +#include "tqscrollbar.h" +#include "tqslider.h" #include diff --git a/examples/themes/wood.cpp b/examples/themes/wood.cpp index 891cf2bf5..a217cebad 100644 --- a/examples/themes/wood.cpp +++ b/examples/themes/wood.cpp @@ -12,7 +12,7 @@ #ifndef TQT_NO_STYLE_WINDOWS #include "ntqapplication.h" -#include "ntqcombobox.h" +#include "tqcombobox.h" #include "tqpainter.h" #include "ntqdrawutil.h" // for now #include "tqpixmap.h" // for now @@ -20,10 +20,10 @@ #include "tqwidget.h" #include "tqlabel.h" #include "tqimage.h" -#include "ntqpushbutton.h" +#include "tqpushbutton.h" #include "tqwidget.h" #include "ntqrangecontrol.h" -#include "ntqscrollbar.h" +#include "tqscrollbar.h" #include #include "tqstylefactory.h" diff --git a/examples/thread/prodcons/prodcons.cpp b/examples/thread/prodcons/prodcons.cpp index 28532b5aa..6e63c1432 100644 --- a/examples/thread/prodcons/prodcons.cpp +++ b/examples/thread/prodcons/prodcons.cpp @@ -3,8 +3,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/examples/thread/semaphores/main.cpp b/examples/thread/semaphores/main.cpp index d7e481c6f..8b7916f26 100644 --- a/examples/thread/semaphores/main.cpp +++ b/examples/thread/semaphores/main.cpp @@ -8,7 +8,7 @@ *****************************************************************************/ #include #include -#include +#include #include #include #include diff --git a/examples/tictac/tictac.cpp b/examples/tictac/tictac.cpp index cb2d1a465..5f7f66184 100644 --- a/examples/tictac/tictac.cpp +++ b/examples/tictac/tictac.cpp @@ -11,8 +11,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include // rand() function diff --git a/examples/tictac/tictac.h b/examples/tictac/tictac.h index ceb7fc506..b14820281 100644 --- a/examples/tictac/tictac.h +++ b/examples/tictac/tictac.h @@ -11,7 +11,7 @@ #define TICTAC_H -#include +#include #include class TQComboBox; diff --git a/examples/toplevel/toplevel.doc b/examples/toplevel/toplevel.doc index 1487f74b4..f65adc546 100644 --- a/examples/toplevel/toplevel.doc +++ b/examples/toplevel/toplevel.doc @@ -90,7 +90,7 @@ \printto cbBehaviorTool A modal widget blocks input to other toplevel widgets, unless those are in a different modal group (see \c WGroupLeader). - Dialogs are often modal, and the QDialog class provides an easy API + Dialogs are often modal, and the TQDialog class provides an easy API to create and display them without the need to explicitly use this flag. diff --git a/examples/tqdir/tqdir.cpp b/examples/tqdir/tqdir.cpp index 4bf715278..cd427a9c6 100644 --- a/examples/tqdir/tqdir.cpp +++ b/examples/tqdir/tqdir.cpp @@ -16,14 +16,14 @@ #include #include #include -#include +#include #include #include #include #include #include #include -#include +#include #include #include #include diff --git a/examples/tqdir/tqdir.h b/examples/tqdir/tqdir.h index 6362644b2..be76dfaea 100644 --- a/examples/tqdir/tqdir.h +++ b/examples/tqdir/tqdir.h @@ -10,7 +10,7 @@ #ifndef TQDIREXAMPLE_H #define TQDIREXAMPLE_H -#include +#include #include #include #include diff --git a/examples/widgets/widgets.cpp b/examples/widgets/widgets.cpp index 2872ddf3b..2f4e20042 100644 --- a/examples/widgets/widgets.cpp +++ b/examples/widgets/widgets.cpp @@ -18,20 +18,20 @@ #include #include #include -#include -#include +#include +#include #include #include #include -#include +#include #include -#include +#include #include -#include -#include -#include +#include +#include +#include #include -#include +#include #include #include #include diff --git a/examples/wizard/wizard.cpp b/examples/wizard/wizard.cpp index ad8aab9d1..c0fbf5041 100644 --- a/examples/wizard/wizard.cpp +++ b/examples/wizard/wizard.cpp @@ -13,8 +13,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/examples/xform/xform.cpp b/examples/xform/xform.cpp index 602a90855..e69224c67 100644 --- a/examples/xform/xform.cpp +++ b/examples/xform/xform.cpp @@ -9,15 +9,15 @@ #include -#include +#include #include -#include -#include -#include -#include +#include +#include +#include +#include #include -#include -#include +#include +#include #include #include #include diff --git a/extensions/nsplugin/examples/grapher/grapher.cpp b/extensions/nsplugin/examples/grapher/grapher.cpp index b500afd7c..22b79f20e 100644 --- a/extensions/nsplugin/examples/grapher/grapher.cpp +++ b/extensions/nsplugin/examples/grapher/grapher.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/ntqcheckbox.h b/include/ntqcheckbox.h deleted file mode 120000 index 9df0ba445..000000000 --- a/include/ntqcheckbox.h +++ /dev/null @@ -1 +0,0 @@ -../src/widgets/ntqcheckbox.h \ No newline at end of file diff --git a/include/ntqcombobox.h b/include/ntqcombobox.h deleted file mode 120000 index 5e354c62c..000000000 --- a/include/ntqcombobox.h +++ /dev/null @@ -1 +0,0 @@ -../src/widgets/ntqcombobox.h \ No newline at end of file diff --git a/include/ntqdial.h b/include/ntqdial.h deleted file mode 120000 index a2e413e26..000000000 --- a/include/ntqdial.h +++ /dev/null @@ -1 +0,0 @@ -../src/widgets/ntqdial.h \ No newline at end of file diff --git a/include/ntqdialog.h b/include/ntqdialog.h deleted file mode 120000 index bd7dfeabd..000000000 --- a/include/ntqdialog.h +++ /dev/null @@ -1 +0,0 @@ -../src/dialogs/ntqdialog.h \ No newline at end of file diff --git a/include/ntqlcdnumber.h b/include/ntqlcdnumber.h deleted file mode 120000 index 5336bfcf9..000000000 --- a/include/ntqlcdnumber.h +++ /dev/null @@ -1 +0,0 @@ -../src/widgets/ntqlcdnumber.h \ No newline at end of file diff --git a/include/ntqlineedit.h b/include/ntqlineedit.h deleted file mode 120000 index 33594ea35..000000000 --- a/include/ntqlineedit.h +++ /dev/null @@ -1 +0,0 @@ -../src/widgets/ntqlineedit.h \ No newline at end of file diff --git a/include/ntqpushbutton.h b/include/ntqpushbutton.h deleted file mode 120000 index db731d7b4..000000000 --- a/include/ntqpushbutton.h +++ /dev/null @@ -1 +0,0 @@ -../src/widgets/ntqpushbutton.h \ No newline at end of file diff --git a/include/ntqradiobutton.h b/include/ntqradiobutton.h deleted file mode 120000 index 95f189bb6..000000000 --- a/include/ntqradiobutton.h +++ /dev/null @@ -1 +0,0 @@ -../src/widgets/ntqradiobutton.h \ No newline at end of file diff --git a/include/ntqscrollbar.h b/include/ntqscrollbar.h deleted file mode 120000 index ed6c57357..000000000 --- a/include/ntqscrollbar.h +++ /dev/null @@ -1 +0,0 @@ -../src/widgets/ntqscrollbar.h \ No newline at end of file diff --git a/include/ntqscrollview.h b/include/ntqscrollview.h deleted file mode 120000 index 412c8ad2e..000000000 --- a/include/ntqscrollview.h +++ /dev/null @@ -1 +0,0 @@ -../src/widgets/ntqscrollview.h \ No newline at end of file diff --git a/include/ntqslider.h b/include/ntqslider.h deleted file mode 120000 index 887320895..000000000 --- a/include/ntqslider.h +++ /dev/null @@ -1 +0,0 @@ -../src/widgets/ntqslider.h \ No newline at end of file diff --git a/include/ntqspinbox.h b/include/ntqspinbox.h deleted file mode 120000 index 7e3a838d3..000000000 --- a/include/ntqspinbox.h +++ /dev/null @@ -1 +0,0 @@ -../src/widgets/ntqspinbox.h \ No newline at end of file diff --git a/include/private/qdialogbuttons_p.h b/include/private/qdialogbuttons_p.h deleted file mode 120000 index a9bf81676..000000000 --- a/include/private/qdialogbuttons_p.h +++ /dev/null @@ -1 +0,0 @@ -../../src/widgets/qdialogbuttons_p.h \ No newline at end of file diff --git a/include/private/tqdialogbuttons_p.h b/include/private/tqdialogbuttons_p.h new file mode 120000 index 000000000..4f270cfd1 --- /dev/null +++ b/include/private/tqdialogbuttons_p.h @@ -0,0 +1 @@ +../../src/widgets/tqdialogbuttons_p.h \ No newline at end of file diff --git a/include/tqcheckbox.h b/include/tqcheckbox.h new file mode 120000 index 000000000..9e52b4d5a --- /dev/null +++ b/include/tqcheckbox.h @@ -0,0 +1 @@ +../src/widgets/tqcheckbox.h \ No newline at end of file diff --git a/include/tqcombobox.h b/include/tqcombobox.h new file mode 120000 index 000000000..22a722c72 --- /dev/null +++ b/include/tqcombobox.h @@ -0,0 +1 @@ +../src/widgets/tqcombobox.h \ No newline at end of file diff --git a/include/tqdial.h b/include/tqdial.h new file mode 120000 index 000000000..9f6ce84f5 --- /dev/null +++ b/include/tqdial.h @@ -0,0 +1 @@ +../src/widgets/tqdial.h \ No newline at end of file diff --git a/include/tqdialog.h b/include/tqdialog.h new file mode 120000 index 000000000..9e5fa5313 --- /dev/null +++ b/include/tqdialog.h @@ -0,0 +1 @@ +../src/dialogs/tqdialog.h \ No newline at end of file diff --git a/include/tqlcdnumber.h b/include/tqlcdnumber.h new file mode 120000 index 000000000..6fde90718 --- /dev/null +++ b/include/tqlcdnumber.h @@ -0,0 +1 @@ +../src/widgets/tqlcdnumber.h \ No newline at end of file diff --git a/include/tqlineedit.h b/include/tqlineedit.h new file mode 120000 index 000000000..54694e275 --- /dev/null +++ b/include/tqlineedit.h @@ -0,0 +1 @@ +../src/widgets/tqlineedit.h \ No newline at end of file diff --git a/include/tqpushbutton.h b/include/tqpushbutton.h new file mode 120000 index 000000000..f6c6c20b0 --- /dev/null +++ b/include/tqpushbutton.h @@ -0,0 +1 @@ +../src/widgets/tqpushbutton.h \ No newline at end of file diff --git a/include/tqradiobutton.h b/include/tqradiobutton.h new file mode 120000 index 000000000..405b53fec --- /dev/null +++ b/include/tqradiobutton.h @@ -0,0 +1 @@ +../src/widgets/tqradiobutton.h \ No newline at end of file diff --git a/include/tqscrollbar.h b/include/tqscrollbar.h new file mode 120000 index 000000000..e076471f8 --- /dev/null +++ b/include/tqscrollbar.h @@ -0,0 +1 @@ +../src/widgets/tqscrollbar.h \ No newline at end of file diff --git a/include/tqscrollview.h b/include/tqscrollview.h new file mode 120000 index 000000000..1807b4caf --- /dev/null +++ b/include/tqscrollview.h @@ -0,0 +1 @@ +../src/widgets/tqscrollview.h \ No newline at end of file diff --git a/include/tqslider.h b/include/tqslider.h new file mode 120000 index 000000000..b9ca51da3 --- /dev/null +++ b/include/tqslider.h @@ -0,0 +1 @@ +../src/widgets/tqslider.h \ No newline at end of file diff --git a/include/tqspinbox.h b/include/tqspinbox.h new file mode 120000 index 000000000..97dd515e1 --- /dev/null +++ b/include/tqspinbox.h @@ -0,0 +1 @@ +../src/widgets/tqspinbox.h \ No newline at end of file diff --git a/plugins/src/accessible/widgets/qaccessiblewidget.cpp b/plugins/src/accessible/widgets/qaccessiblewidget.cpp index b36180136..128c582ee 100644 --- a/plugins/src/accessible/widgets/qaccessiblewidget.cpp +++ b/plugins/src/accessible/widgets/qaccessiblewidget.cpp @@ -3,24 +3,24 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include -#include +#include #include #include #include #include #include -#include +#include #include #include -#include +#include #include #include #include diff --git a/qmake/book/qmake-pch.leaf b/qmake/book/qmake-pch.leaf index d152cf797..f848c2c22 100644 --- a/qmake/book/qmake-pch.leaf +++ b/qmake/book/qmake-pch.leaf @@ -57,7 +57,7 @@ like this: #include #include #include // TQt includes - #include + #include #include #include "thirdparty/include/libmain.h" #include "my_stable_class.h" diff --git a/qmake/examples/precompile/main.cpp b/qmake/examples/precompile/main.cpp index 768d2c14e..37ffa3492 100644 --- a/qmake/examples/precompile/main.cpp +++ b/qmake/examples/precompile/main.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include "myobject.h" #include "mydialog.h" diff --git a/qmake/examples/precompile/stable.h b/qmake/examples/precompile/stable.h index 1ed5d261b..ade98ba33 100644 --- a/qmake/examples/precompile/stable.h +++ b/qmake/examples/precompile/stable.h @@ -5,6 +5,6 @@ # include # include -# include +# include # include #endif diff --git a/qmake/examples/tutorial/hello.h b/qmake/examples/tutorial/hello.h index 650108aad..47eb7e3ab 100644 --- a/qmake/examples/tutorial/hello.h +++ b/qmake/examples/tutorial/hello.h @@ -1,4 +1,4 @@ -#include +#include class MyPushButton : public TQPushButton { diff --git a/src/canvas/tqcanvas.h b/src/canvas/tqcanvas.h index e6dbb685f..c8c8fe18d 100644 --- a/src/canvas/tqcanvas.h +++ b/src/canvas/tqcanvas.h @@ -42,7 +42,7 @@ #define TQCANVAS_H #ifndef QT_H -#include "ntqscrollview.h" +#include "tqscrollview.h" #include "tqpixmap.h" #include "tqptrlist.h" #include "tqbrush.h" diff --git a/src/dialogs/ntqdialog.h b/src/dialogs/ntqdialog.h deleted file mode 100644 index e1d82c179..000000000 --- a/src/dialogs/ntqdialog.h +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** -** -** Definition of TQDialog class -** -** Created : 950502 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the dialogs module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQDIALOG_H -#define TQDIALOG_H - -#ifndef QT_H -#include "tqwidget.h" -#endif // QT_H -#ifndef TQT_NO_DIALOG -#if 0 -TQ_OBJECT -#endif - -class TQPushButton; -class TQDialogPrivate; - -class TQ_EXPORT TQDialog : public TQWidget -{ -friend class TQPushButton; - TQ_OBJECT - TQ_PROPERTY( bool sizeGripEnabled READ isSizeGripEnabled WRITE setSizeGripEnabled ) - TQ_PROPERTY( bool modal READ isModal WRITE setModal ) - -public: - Q_EXPLICIT TQDialog( TQWidget* parent=0, const char* name=0, bool modal=FALSE, - WFlags f=0 ); - ~TQDialog(); - - enum DialogCode { Rejected, Accepted }; - - int result() const { return rescode; } - - void show(); - void hide(); - void move( int x, int y ); - void move( const TQPoint &p ); - void resize( int w, int h ); - void resize( const TQSize & ); - void setGeometry( int x, int y, int w, int h ); - void setGeometry( const TQRect & ); - - void setOrientation( Orientation orientation ); - Orientation orientation() const; - - void setExtension( TQWidget* extension ); - TQWidget* extension() const; - - TQSize sizeHint() const; - TQSize minimumSizeHint() const; - - void setSizeGripEnabled( bool ); - bool isSizeGripEnabled() const; - - void setModal( bool modal ); - bool isModal() const; -#ifdef Q_OS_TEMP - bool event( TQEvent * ); -#endif - -public slots: - int exec(); - -protected slots: - virtual void done( int ); - virtual void accept(); - virtual void reject(); - - void showExtension( bool ); - -protected: - void setResult( int r ) { rescode = r; } - void keyPressEvent( TQKeyEvent * ); - void closeEvent( TQCloseEvent * ); - void resizeEvent( TQResizeEvent * ); - void contextMenuEvent( TQContextMenuEvent * ); - bool eventFilter( TQObject *, TQEvent * ); - void adjustPosition( TQWidget*); - -private: - void setDefault( TQPushButton * ); - void setMainDefault( TQPushButton * ); - void hideDefault(); -#ifdef Q_OS_TEMP - void hideSpecial(); -#endif - - int rescode; - uint did_move : 1; - uint has_relpos : 1; - uint did_resize : 1; - uint in_loop: 1; - void adjustPositionInternal( TQWidget*, bool useRelPos = FALSE ); - TQDialogPrivate* d; - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQDialog( const TQDialog & ); - TQDialog &operator=( const TQDialog & ); -#endif -}; - -#endif // TQT_NO_DIALOG -#endif // TQDIALOG_H diff --git a/src/dialogs/ntqerrormessage.h b/src/dialogs/ntqerrormessage.h index 6c776d2d5..21e12a488 100644 --- a/src/dialogs/ntqerrormessage.h +++ b/src/dialogs/ntqerrormessage.h @@ -42,7 +42,7 @@ #define TQERRORMESSAGE_H #ifndef QT_H -#include "ntqdialog.h" +#include "tqdialog.h" #endif // QT_H #ifndef TQT_NO_ERRORMESSAGE diff --git a/src/dialogs/ntqinputdialog.h b/src/dialogs/ntqinputdialog.h index 32ba9c2ba..67434b3ae 100644 --- a/src/dialogs/ntqinputdialog.h +++ b/src/dialogs/ntqinputdialog.h @@ -42,9 +42,9 @@ #define TQINPUTDIALOG_H #ifndef QT_H -#include "ntqdialog.h" +#include "tqdialog.h" #include "tqstring.h" -#include "ntqlineedit.h" +#include "tqlineedit.h" #endif // QT_H #ifndef TQT_NO_INPUTDIALOG diff --git a/src/dialogs/ntqmessagebox.h b/src/dialogs/ntqmessagebox.h index b4fc27d8f..abaf25761 100644 --- a/src/dialogs/ntqmessagebox.h +++ b/src/dialogs/ntqmessagebox.h @@ -42,7 +42,7 @@ #define TQMESSAGEBOX_H #ifndef QT_H -#include "ntqdialog.h" +#include "tqdialog.h" #endif // QT_H #ifndef TQT_NO_MESSAGEBOX diff --git a/src/dialogs/ntqprintdialog.h b/src/dialogs/ntqprintdialog.h index c578e0ff3..29824416a 100644 --- a/src/dialogs/ntqprintdialog.h +++ b/src/dialogs/ntqprintdialog.h @@ -42,7 +42,7 @@ #define TQPRINTDIALOG_H #ifndef QT_H -#include "ntqdialog.h" +#include "tqdialog.h" #endif // QT_H #ifndef TQT_NO_PRINTDIALOG diff --git a/src/dialogs/ntqprogressdialog.h b/src/dialogs/ntqprogressdialog.h index dc32aa390..af20f615b 100644 --- a/src/dialogs/ntqprogressdialog.h +++ b/src/dialogs/ntqprogressdialog.h @@ -42,7 +42,7 @@ #define TQPROGRESSDIALOG_H #ifndef QT_H -#include "ntqdialog.h" +#include "tqdialog.h" #include "tqlabel.h" // ### remove or keep for users' convenience? #include "ntqprogressbar.h" // ### remove or keep for users' convenience? #endif // QT_H diff --git a/src/dialogs/ntqtabdialog.h b/src/dialogs/ntqtabdialog.h index 7547b2f58..61e4287c6 100644 --- a/src/dialogs/ntqtabdialog.h +++ b/src/dialogs/ntqtabdialog.h @@ -42,7 +42,7 @@ #define TQTABDIALOG_H #ifndef QT_H -#include "ntqdialog.h" +#include "tqdialog.h" #include "tqiconset.h" #endif // QT_H diff --git a/src/dialogs/ntqwizard.h b/src/dialogs/ntqwizard.h index b09e90202..c680e2860 100644 --- a/src/dialogs/ntqwizard.h +++ b/src/dialogs/ntqwizard.h @@ -43,7 +43,7 @@ #ifndef QT_H -#include "ntqdialog.h" +#include "tqdialog.h" #endif // QT_H #ifndef TQT_NO_WIZARD diff --git a/src/dialogs/qdialog.cpp b/src/dialogs/qdialog.cpp deleted file mode 100644 index 9f1f624a9..000000000 --- a/src/dialogs/qdialog.cpp +++ /dev/null @@ -1,1180 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQDialog class -** -** Created : 950502 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the dialogs module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqdialog.h" - -#ifndef TQT_NO_DIALOG - -#include "ntqpushbutton.h" -#include "ntqfocusdata.h" -#include "ntqapplication.h" -#include "tqobjectlist.h" -#include "tqwidgetlist.h" -#include "ntqlayout.h" -#include "tqsizegrip.h" -#include "tqwhatsthis.h" -#include "tqpopupmenu.h" -#include "ntqcursor.h" -#if defined(QT_ACCESSIBILITY_SUPPORT) -#include "ntqaccessible.h" -#endif -#if defined( Q_OS_TEMP ) -#include "qt_windows.h" -#endif - -/*! - \class TQDialog - \brief The TQDialog class is the base class of dialog windows. - - \ingroup dialogs - \ingroup abstractwidgets - \mainclass - - A dialog window is a top-level window mostly used for short-term - tasks and brief communications with the user. TQDialogs may be - modal or modeless. TQDialogs support \link #extensibility - extensibility\endlink and can provide a \link #return return - value\endlink. They can have \link #default default - buttons\endlink. TQDialogs can also have a TQSizeGrip in their - lower-right corner, using setSizeGripEnabled(). - - Note that TQDialog uses the parent widget slightly differently from - other classes in TQt. A dialog is always a top-level widget, but if - it has a parent, its default location is centered on top of the - parent's top-level widget (if it is not top-level itself). It will - also share the parent's taskbar entry. - - \target modal - \section1 Modal Dialogs - - A modal dialog is a dialog that blocks input to other - visible windows in the same application. Users must finish - interacting with the dialog and close it before they can access - any other window in the application. Dialogs that are used to - request a file name from the user or that are used to set - application preferences are usually modal. - - The most common way to display a modal dialog is to call its - exec() function. When the user closes the dialog, exec() will - provide a useful \link #return return value\endlink. Typically we - connect a default button, e.g. "OK", to the accept() slot and a - "Cancel" button to the reject() slot, to get the dialog to close - and return the appropriate value. Alternatively you can connect to - the done() slot, passing it \c Accepted or \c Rejected. - - An alternative is to call setModal(TRUE), then show(). Unlike - exec(), show() returns control to the caller immediately. Calling - setModal(TRUE) is especially useful for progress dialogs, where - the user must have the ability to interact with the dialog, e.g. - to cancel a long running operation. If you use show() and - setModal(TRUE) together you must call - TQApplication::processEvents() periodically during processing to - enable the user to interact with the dialog. (See \l - TQProgressDialog.) - - \target modeless - \section1 Modeless Dialogs - - A modeless dialog is a dialog that operates - independently of other windows in the same application. Find and - replace dialogs in word-processors are often modeless to allow the - user to interact with both the application's main window and with - the dialog. - - Modeless dialogs are displayed using show(), which returns control - to the caller immediately. - - \target default - \section1 Default button - - A dialog's \e default button is the button that's pressed when the - user presses Enter (Return). This button is used to signify that - the user accepts the dialog's settings and wants to close the - dialog. Use TQPushButton::setDefault(), TQPushButton::isDefault() - and TQPushButton::autoDefault() to set and control the dialog's - default button. - - \target escapekey - \section1 Escape Key - - If the user presses the Esc key in a dialog, TQDialog::reject() - will be called. This will cause the window to close: the \link - TQCloseEvent closeEvent \endlink cannot be \link - TQCloseEvent::ignore() ignored \endlink. - - \target extensibility - \section1 Extensibility - - Extensibility is the ability to show the dialog in two ways: a - partial dialog that shows the most commonly used options, and a - full dialog that shows all the options. Typically an extensible - dialog will initially appear as a partial dialog, but with a - "More" toggle button. If the user presses the "More" button down, - the full dialog will appear. The extension widget will be resized - to its sizeHint(). If orientation is \c Horizontal the extension - widget's height() will be expanded to the height() of the dialog. - If the orientation is \c Vertical the extension widget's width() - will be expanded to the width() of the dialog. Extensibility is - controlled with setExtension(), setOrientation() and - showExtension(). - - \target return - \section1 Return value (modal dialogs) - - Modal dialogs are often used in situations where a return value is - required, e.g. to indicate whether the user pressed "OK" or - "Cancel". A dialog can be closed by calling the accept() or the - reject() slots, and exec() will return \c Accepted or \c Rejected - as appropriate. The exec() call returns the result of the dialog. - The result is also available from result() if the dialog has not - been destroyed. If the \c WDestructiveClose flag is set, the - dialog is deleted after exec() returns. - - \target examples - \section1 Examples - - A modal dialog. - - \quotefile network/networkprotocol/view.cpp - \skipto TQFileDialog *dlg - \printuntil return - - A modeless dialog. After the show() call, control returns to the main - event loop. - \quotefile life/main.cpp - \skipto argv - \printuntil TQApplication - \skipto scale - \printline - \skipto LifeDialog - \printuntil show - \skipto exec - \printuntil } - - \sa TQTabDialog TQWidget TQProgressDialog - \link guibooks.html#fowler GUI Design Handbook: Dialogs, Standard\endlink -*/ - -/*! \enum TQDialog::DialogCode - - The value returned by a modal dialog. - - \value Accepted - \value Rejected - -*/ - -/*! - \property TQDialog::sizeGripEnabled - \brief whether the size grip is enabled - - A TQSizeGrip is placed in the bottom right corner of the dialog when this - property is enabled. By default, the size grip is disabled. -*/ - -class TQDialogPrivate : public TQt -{ -public: - - TQDialogPrivate() - : mainDef(0), orientation(Horizontal),extension(0), doShowExtension(FALSE) -#ifndef TQT_NO_SIZEGRIP - ,resizer(0) -#endif - { - } - - TQPushButton* mainDef; - Orientation orientation; - TQWidget* extension; - bool doShowExtension; - TQSize size, min, max; -#ifndef TQT_NO_SIZEGRIP - TQSizeGrip* resizer; -#endif - TQPoint lastRMBPress; - TQPoint relPos; // relative position to the main window -}; - -/*! - Constructs a dialog called \a name, with parent \a parent. - - A dialog is always a top-level widget, but if it has a parent, its - default location is centered on top of the parent. It will also - share the parent's taskbar entry. - - The widget flags \a f are passed on to the TQWidget constructor. - If, for example, you don't want a What's This button in the titlebar - of the dialog, pass WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu in \a f. - - \warning In TQt 3.2, the \a modal flag is obsolete. There is now a - setModal() function that can be used for obtaining a modal behavior - when calling show(). This is rarely needed, because modal dialogs - are usually invoked using exec(), which ignores the \a modal flag. - - \sa TQWidget::setWFlags() TQt::WidgetFlags -*/ - -TQDialog::TQDialog( TQWidget *parent, const char *name, bool modal, WFlags f ) - : TQWidget( parent, name, - (modal ? (f|WShowModal) : f) | WType_Dialog ), - rescode(0), did_move(0), has_relpos(0), did_resize(0), in_loop(0) -{ - d = new TQDialogPrivate; -} - -/*! - Destroys the TQDialog, deleting all its children. -*/ - -TQDialog::~TQDialog() -{ - // Need to hide() here, as our (to-be) overridden hide() - // will not be called in ~TQWidget. - hide(); - delete d; -} - -/*! - \internal - This function is called by the push button \a pushButton when it - becomes the default button. If \a pushButton is 0, the dialogs - default default button becomes the default button. This is what a - push button calls when it loses focus. -*/ - -void TQDialog::setDefault( TQPushButton *pushButton ) -{ -#ifndef TQT_NO_PUSHBUTTON - TQObjectList *list = queryList( "TQPushButton" ); - Q_ASSERT(list); - TQObjectListIt it( *list ); - TQPushButton *pb; - bool hasMain = FALSE; - while ( (pb = (TQPushButton*)it.current()) ) { - ++it; - if ( pb->topLevelWidget() != this ) - continue; - if ( pb == d->mainDef ) - hasMain = TRUE; - if ( pb != pushButton ) - pb->setDefault( FALSE ); - } - if (!pushButton && hasMain) - d->mainDef->setDefault( TRUE ); - if (!hasMain) - d->mainDef = pushButton; - delete list; -#endif -} - -/*! - \internal - This function sets the default default pushbutton to \a pushButton. - This function is called by TQPushButton::setDefault(). -*/ -void TQDialog::setMainDefault( TQPushButton *pushButton ) -{ -#ifndef TQT_NO_PUSHBUTTON - d->mainDef = 0; - setDefault(pushButton); -#endif -} - -/*! - \internal - Hides the default button indicator. Called when non auto-default - push button get focus. - */ -void TQDialog::hideDefault() -{ -#ifndef TQT_NO_PUSHBUTTON - TQObjectList *list = queryList( "TQPushButton" ); - TQObjectListIt it( *list ); - TQPushButton *pb; - while ( (pb = (TQPushButton*)it.current()) ) { - ++it; - pb->setDefault( FALSE ); - } - delete list; -#endif -} - -#ifdef Q_OS_TEMP -/*! - \internal - Hides special buttons which are rather shown in the titlebar - on WinCE, to conserve screen space. -*/ -# include "ntqmessagebox.h" -extern const char * mb_texts[]; // Defined in qmessagebox.cpp -void TQDialog::hideSpecial() -{ - // "OK" buttons are hidden, and (Ok) shown on titlebar - // "Cancel" buttons are hidden, and (X) shown on titlebar - // "Help" buttons are hidden, and (?) shown on titlebar - bool showOK = FALSE, - showX = FALSE, - showQ = FALSE; - TQObjectList *list = queryList( "TQPushButton" ); - TQObjectListIt it( *list ); - TQPushButton *pb; - while ( (pb = (TQPushButton*)it.current()) ) { - if ( !showOK && - pb->text() == tqApp->translate( "TQMessageBox", mb_texts[TQMessageBox::Ok] ) ) { - pb->hide(); - showOK = TRUE; - } else if ( !showX && - pb->text() == tqApp->translate( "TQMessageBox", mb_texts[TQMessageBox::Cancel] ) ) { - pb->hide(); - showX = TRUE; - } else if ( !showQ && - pb->text() == tqApp->tr("Help") ) { - pb->hide(); - showQ = TRUE; - } - ++it; - } - delete list; - if ( showOK || showQ ) { - DWORD ext = GetWindowLong( winId(), GWL_EXSTYLE ); - ext |= showOK ? WS_EX_CAPTIONOKBTN : 0; - ext |= showQ ? WS_EX_CONTEXTHELP: 0; - SetWindowLong( winId(), GWL_EXSTYLE, ext ); - } - if ( !showX ) { - DWORD ext = GetWindowLong( winId(), GWL_STYLE ); - ext &= ~WS_SYSMENU; - SetWindowLong( winId(), GWL_STYLE, ext ); - } -} -#endif - -/*! - \fn int TQDialog::result() const - - Returns the modal dialog's result code, \c Accepted or \c Rejected. - - Do not call this function if the dialog was constructed with the \c - WDestructiveClose flag. -*/ - -/*! - \fn void TQDialog::setResult( int i ) - - Sets the modal dialog's result code to \a i. -*/ - - -/*! - Shows the dialog as a \link #modal modal \endlink dialog, - blocking until the user closes it. The function returns a \l - DialogCode result. - - Users cannot interact with any other window in the same - application until they close the dialog. - - \sa show(), result() -*/ - -int TQDialog::exec() -{ - if ( in_loop ) { - tqWarning( "TQDialog::exec: Recursive call detected" ); - return -1; - } - - bool destructiveClose = testWFlags( WDestructiveClose ); - clearWFlags( WDestructiveClose ); - - bool wasShowModal = testWFlags( WShowModal ); - setWFlags( WShowModal ); - setResult( 0 ); - - show(); - - in_loop = TRUE; - tqApp->enter_loop(); - - if ( !wasShowModal ) - clearWFlags( WShowModal ); - - int res = result(); - - if ( destructiveClose ) - delete this; - - return res; -} - - -/*! Closes the dialog and sets its result code to \a r. If this dialog - is shown with exec(), done() causes the local event loop to finish, - and exec() to return \a r. - - As with TQWidget::close(), done() deletes the dialog if the \c - WDestructiveClose flag is set. If the dialog is the application's - main widget, the application terminates. If the dialog is the - last window closed, the TQApplication::lastWindowClosed() signal is - emitted. - - \sa accept(), reject(), TQApplication::mainWidget(), TQApplication::quit() -*/ - -void TQDialog::done( int r ) -{ - hide(); - setResult( r ); - - // emulate TQWidget::close() - bool isMain = tqApp->mainWidget() == this; - bool checkLastWindowClosed = isTopLevel() && !isPopup(); - if ( checkLastWindowClosed - && tqApp->receivers(TQ_SIGNAL(lastWindowClosed())) ) { - /* if there is no non-withdrawn top level window left (except - the desktop, popups, or dialogs with parents), we emit the - lastWindowClosed signal */ - TQWidgetList *list = tqApp->topLevelWidgets(); - TQWidget *widget = list->first(); - while ( widget ) { - if ( !widget->isHidden() - && !widget->isDesktop() - && !widget->isPopup() - && (!widget->isDialog() || !widget->parentWidget())) - break; - widget = list->next(); - } - delete list; - if ( widget == 0 ) - emit tqApp->lastWindowClosed(); - } - if ( isMain ) - tqApp->quit(); - else if ( testWFlags(WDestructiveClose) ) { - clearWFlags(WDestructiveClose); - deleteLater(); - } -} - -/*! - Hides the modal dialog and sets the result code to \c Accepted. - - \sa reject() done() -*/ - -void TQDialog::accept() -{ - done( Accepted ); -} - -/*! - Hides the modal dialog and sets the result code to \c Rejected. - - \sa accept() done() -*/ - -void TQDialog::reject() -{ - done( Rejected ); -} - -/*! \reimp */ -bool TQDialog::eventFilter( TQObject *o, TQEvent *e ) -{ - return TQWidget::eventFilter( o, e ); -} - -/***************************************************************************** - Event handlers - *****************************************************************************/ - -/*! \reimp */ -void TQDialog::contextMenuEvent( TQContextMenuEvent *e ) -{ -#if !defined(TQT_NO_WHATSTHIS) && !defined(TQT_NO_POPUPMENU) - TQWidget* w = childAt( e->pos(), TRUE ); - if ( !w ) - return; - TQString s; - while ( s.isEmpty() && w ) { - s = TQWhatsThis::textFor( w, e->pos(), FALSE ); - if ( s.isEmpty() ) - w = w->parentWidget(TRUE); - } - if ( !s.isEmpty() ) { - TQPopupMenu p(0,"qt_whats_this_menu"); - p.insertItem( tr("What's This?"), 42 ); - if ( p.exec( e->globalPos() ) >= 42 ) - TQWhatsThis::display( s, w->mapToGlobal( w->rect().center() ), w ); - } -#endif -} - -/*! \reimp */ -void TQDialog::keyPressEvent( TQKeyEvent *e ) -{ - // Calls reject() if Escape is pressed. Simulates a button - // click for the default button if Enter is pressed. Move focus - // for the arrow keys. Ignore the rest. -#ifdef Q_OS_MAC - if(e->state() == ControlButton && e->key() == Key_Period) { - reject(); - } else -#endif - if ( e->state() == 0 || ( e->state() & Keypad && e->key() == Key_Enter ) ) { - switch ( e->key() ) { - case Key_Enter: - case Key_Return: { -#ifndef TQT_NO_PUSHBUTTON - TQObjectList *list = queryList( "TQPushButton" ); - TQObjectListIt it( *list ); - TQPushButton *pb; - while ( (pb = (TQPushButton*)it.current()) ) { - if ( pb->isDefault() && pb->isVisible() ) { - delete list; - if ( pb->isEnabled() ) { - emit pb->clicked(); - } - return; - } - ++it; - } - delete list; -#endif - } - break; - case Key_Escape: - reject(); - break; - case Key_Up: - case Key_Left: - if ( focusWidget() && - ( focusWidget()->focusPolicy() == TQWidget::StrongFocus || - focusWidget()->focusPolicy() == TQWidget::WheelFocus ) ) { - e->ignore(); - break; - } - // call ours, since c++ blocks us from calling the one - // belonging to focusWidget(). - TQFocusEvent::setReason(TQFocusEvent::Backtab); - focusNextPrevChild( FALSE ); - TQFocusEvent::resetReason(); - break; - case Key_Down: - case Key_Right: - if ( focusWidget() && - ( focusWidget()->focusPolicy() == TQWidget::StrongFocus || - focusWidget()->focusPolicy() == TQWidget::WheelFocus ) ) { - e->ignore(); - break; - } - TQFocusEvent::setReason(TQFocusEvent::Tab); - focusNextPrevChild( TRUE ); - TQFocusEvent::resetReason(); - break; - default: - e->ignore(); - return; - } - } else { - e->ignore(); - } -} - -/*! \reimp */ -void TQDialog::closeEvent( TQCloseEvent *e ) -{ -#ifndef TQT_NO_WHATSTHIS - if ( isModal() && TQWhatsThis::inWhatsThisMode() ) - TQWhatsThis::leaveWhatsThisMode(); -#endif - if ( isShown() ) - reject(); - if ( isHidden() ) - e->accept(); -} - -#ifdef Q_OS_TEMP -/*! \internal - \reimp -*/ -bool TQDialog::event( TQEvent *e ) -{ - switch ( e->type() ) { - case TQEvent::OkRequest: - case TQEvent::HelpRequest: - { - TQString bName = - (e->type() == TQEvent::OkRequest) - ? tqApp->translate( "TQMessageBox", mb_texts[TQMessageBox::Ok] ) - : tqApp->tr( "Help" ); - - TQObjectList *list = queryList( "TQPushButton" ); - TQObjectListIt it( *list ); - TQPushButton *pb; - while ( (pb = (TQPushButton*)it.current()) ) { - if ( pb->text() == bName ) { - delete list; - if ( pb->isEnabled() ) - emit pb->clicked(); - return pb->isEnabled(); - } - ++it; - } - delete list; - } - } - return TQWidget::event( e ); -} -#endif - - -/***************************************************************************** - Geometry management. - *****************************************************************************/ - -#if defined(TQ_WS_X11) -extern "C" { int XSetTransientForHint( Display *, unsigned long, unsigned long ); } -#include -#undef FocusIn -// defined in qapplication_x11.cpp -extern Atom qt_net_wm_full_placement; -extern bool qt_net_supports(Atom atom); -#endif // TQ_WS_X11 - -/*! - Shows the dialog as a \link #modeless modeless \endlink dialog. - Control returns immediately to the calling code. - - The dialog will be modal or modeless according to the value - of the \l modal property. - - \sa exec(), modal -*/ - -void TQDialog::show() -{ - if ( testWState(WState_Visible) ) - return; - - uint state = windowState(); - - if ( !did_resize ) - adjustSize(); - if( !qt_net_supports( qt_net_wm_full_placement )) { - if ( has_relpos && !did_move ) { - adjustPositionInternal( parentWidget(), TRUE ); - } else if ( !did_move ) { - adjustPositionInternal( parentWidget() ); - } - } - - if (windowState() != state) - setWindowState(state); - -#if defined(TQ_WS_X11) - if (!parentWidget() && testWFlags(WShowModal) - && tqApp->mainWidget() && tqApp->mainWidget()->isVisible() - && !tqApp->mainWidget()->isMinimized()) { - // make sure the transient for hint is set properly for modal dialogs - x11SetWindowTransient( tqApp->mainWidget()); - } -#endif // TQ_WS_X11 - -#ifdef Q_OS_TEMP - hideSpecial(); -#endif - - TQWidget::show(); - showExtension( d->doShowExtension ); -#ifndef TQT_NO_PUSHBUTTON - TQWidget *fw = focusWidget(); - TQFocusData *fd = focusData(); - - /* - The following block is to handle a special case, and does not - really follow propper logic in concern of autoDefault and TAB - order. However, it's here to ease usage for the users. If a - dialog has a default TQPushButton, and first widget in the TAB - order also is a TQPushButton, then we give focus to the main - default TQPushButton. This simplifies code for the developers, - and actually catches most cases... If not, then they simply - have to use [widget*]->setFocus() themselves... - */ - if ( !fw || fw->focusPolicy() == NoFocus ) { - fd->home(); // Skip main form - TQWidget *first = fd->next(); // Get first main widget - if ( d->mainDef && - first != d->mainDef && - ::tqt_cast(first) ) - d->mainDef->setFocus(); - } - - if ( !d->mainDef && isTopLevel() ) { - if ( !fw || fw->focusPolicy() == NoFocus ) { - focusNextPrevChild( TRUE ); - fw = focusWidget(); - } - if ( fw ) { - fd = focusData(); - TQWidget *home = fd->home(); - TQWidget *candidate = home; - Q_ASSERT( candidate == fw ); - do { - TQPushButton *pb = ::tqt_cast(candidate); - if ( pb && pb->autoDefault() ) { - pb->setDefault( TRUE ); - break; - } - candidate = fd->next(); - } while ( candidate != home ); - } - } - if ( fw ) { - TQFocusEvent e( TQEvent::FocusIn ); - TQFocusEvent::setReason( TQFocusEvent::Tab ); - TQApplication::sendEvent( fw, &e ); - TQFocusEvent::resetReason(); - } - -#endif -#if defined(QT_ACCESSIBILITY_SUPPORT) - TQAccessible::updateAccessibility( this, 0, TQAccessible::DialogStart ); -#endif -} - -/*! \internal */ -void TQDialog::adjustPosition( TQWidget* w) -{ - adjustPositionInternal( w ); -} - - -void TQDialog::adjustPositionInternal( TQWidget*w, bool useRelPos) -{ - /* need to make sure these events are already sent to be sure - our information below is correct --sam */ - TQApplication::sendPostedEvents( this, TQEvent::LayoutHint ); - TQApplication::sendPostedEvents( this, TQEvent::Resize ); - - // processing the events might call polish(), which is a nice place - // to restore geometries, so return if the dialog has been positioned - if ( did_move || has_relpos ) - return; - - TQPoint p( 0, 0 ); - int extraw = 0, extrah = 0, scrn = 0; - if ( w ) - w = w->topLevelWidget(); - TQRect desk; - if ( w ) { - // Use mapToGlobal rather than geometry() in case w might - // be embedded in another application - scrn = TQApplication::desktop()->screenNumber( w->mapToGlobal( TQPoint(0,0) ) ); - } else if ( TQApplication::desktop()->isVirtualDesktop() ) { - scrn = TQApplication::desktop()->screenNumber( TQCursor::pos() ); - } else { - scrn = TQApplication::desktop()->screenNumber( this ); - } - desk = TQApplication::desktop()->availableGeometry( scrn ); - - TQWidgetList *list = TQApplication::topLevelWidgets(); - TQWidgetListIt it( *list ); - while ( (extraw == 0 || extrah == 0) && - it.current() != 0 ) { - int framew, frameh; - TQWidget * current = it.current(); - ++it; - if ( ! current->isVisible() ) - continue; - - framew = current->geometry().x() - current->x(); - frameh = current->geometry().y() - current->y(); - - extraw = TQMAX( extraw, framew ); - extrah = TQMAX( extrah, frameh ); - } - delete list; - - // sanity check for decoration frames. With embedding, we - // might get extraordinary values - if ( extraw == 0 || extrah == 0 || extraw >= 10 || extrah >= 40 ) { - extrah = 40; - extraw = 10; - } - - if ( useRelPos && w ) { - p = w->pos() + d->relPos; - } else { -#ifndef Q_OS_TEMP - if ( w ) { - // Use mapToGlobal rather than geometry() in case w might - // be embedded in another application - TQPoint pp = w->mapToGlobal( TQPoint(0,0) ); - p = TQPoint( pp.x() + w->width()/2, - pp.y() + w->height()/ 2 ); - } else { - // p = middle of the desktop - p = TQPoint( desk.x() + desk.width()/2, desk.y() + desk.height()/2 ); - } -#else - p = TQPoint( desk.x() + desk.width()/2, desk.y() + desk.height()/2 ); -#endif - - // p = origin of this - p = TQPoint( p.x()-width()/2 - extraw, - p.y()-height()/2 - extrah ); - } - - - if ( p.x() + extraw + width() > desk.x() + desk.width() ) - p.setX( desk.x() + desk.width() - width() - extraw ); - if ( p.x() < desk.x() ) - p.setX( desk.x() ); - - if ( p.y() + extrah + height() > desk.y() + desk.height() ) - p.setY( desk.y() + desk.height() - height() - extrah ); - if ( p.y() < desk.y() ) - p.setY( desk.y() ); - - move( p ); - did_move = !useRelPos; -} - - -/*! \reimp */ -void TQDialog::hide() -{ - if ( isHidden() ) - return; - -#if defined(QT_ACCESSIBILITY_SUPPORT) - if ( isVisible() ) - TQAccessible::updateAccessibility( this, 0, TQAccessible::DialogEnd ); -#endif - - if ( parentWidget() && !did_move ) { - d->relPos = pos() - parentWidget()->topLevelWidget()->pos(); - has_relpos = 1; - } - - // Reimplemented to exit a modal when the dialog is hidden. - TQWidget::hide(); - if ( in_loop ) { - in_loop = FALSE; - tqApp->exit_loop(); - } -} - - -/***************************************************************************** - Detects any widget geometry changes done by the user. - *****************************************************************************/ - -/*! \reimp */ - -void TQDialog::move( int x, int y ) -{ - did_move = TRUE; - TQWidget::move( x, y ); -} - -/*! \reimp */ - -void TQDialog::move( const TQPoint &p ) -{ - did_move = TRUE; - TQWidget::move( p ); -} - -/*! \reimp */ - -void TQDialog::resize( int w, int h ) -{ - did_resize = TRUE; - TQWidget::resize( w, h ); -} - -/*! \reimp */ - -void TQDialog::resize( const TQSize &s ) -{ - did_resize = TRUE; - TQWidget::resize( s ); -} - -/*! \reimp */ - -void TQDialog::setGeometry( int x, int y, int w, int h ) -{ - did_move = TRUE; - did_resize = TRUE; - TQWidget::setGeometry( x, y, w, h ); -} - -/*! \reimp */ - -void TQDialog::setGeometry( const TQRect &r ) -{ - did_move = TRUE; - did_resize = TRUE; - TQWidget::setGeometry( r ); -} - - -/*! - If \a orientation is \c Horizontal, the extension will be displayed - to the right of the dialog's main area. If \a orientation is \c - Vertical, the extension will be displayed below the dialog's main - area. - - \sa orientation(), setExtension() -*/ -void TQDialog::setOrientation( Orientation orientation ) -{ - d->orientation = orientation; -} - -/*! - Returns the dialog's extension orientation. - - \sa setOrientation() -*/ -TQt::Orientation TQDialog::orientation() const -{ - return d->orientation; -} - -/*! - Sets the widget, \a extension, to be the dialog's extension, - deleting any previous extension. The dialog takes ownership of the - extension. Note that if 0 is passed any existing extension will be - deleted. - - This function must only be called while the dialog is hidden. - - \sa showExtension(), setOrientation(), extension() - */ -void TQDialog::setExtension( TQWidget* extension ) -{ - delete d->extension; - d->extension = extension; - - if ( !extension ) - return; - - if ( extension->parentWidget() != this ) - extension->reparent( this, TQPoint(0,0) ); - extension->hide(); -} - -/*! - Returns the dialog's extension or 0 if no extension has been - defined. - - \sa setExtension() - */ -TQWidget* TQDialog::extension() const -{ - return d->extension; -} - - -/*! - If \a showIt is TRUE, the dialog's extension is shown; otherwise the - extension is hidden. - - This slot is usually connected to the \l TQButton::toggled() signal - of a TQPushButton. - - A dialog with a visible extension is not resizeable. - - \sa show(), setExtension(), setOrientation() - */ -void TQDialog::showExtension( bool showIt ) -{ - d->doShowExtension = showIt; - if ( !d->extension ) - return; - if ( !testWState(WState_Visible) ) - return; - if ( d->extension->isVisible() == showIt ) - return; - - if ( showIt ) { - d->size = size(); - d->min = minimumSize(); - d->max = maximumSize(); -#ifndef TQT_NO_LAYOUT - if ( layout() ) - layout()->setEnabled( FALSE ); -#endif - TQSize s( d->extension->sizeHint() - .expandedTo( d->extension->minimumSize() ) - .boundedTo( d->extension->maximumSize() ) ); - if ( d->orientation == Horizontal ) { - int h = TQMAX( height(), s.height() ); - d->extension->setGeometry( width(), 0, s.width(), h ); - setFixedSize( width() + s.width(), h ); - } else { - int w = TQMAX( width(), s.width() ); - d->extension->setGeometry( 0, height(), w, s.height() ); - setFixedSize( w, height() + s.height() ); - } - d->extension->show(); - } else { - d->extension->hide(); - // workaround for CDE window manager that won't shrink with (-1,-1) - setMinimumSize( d->min.expandedTo( TQSize( 1, 1 ) ) ); - setMaximumSize( d->max ); - resize( d->size ); -#ifndef TQT_NO_LAYOUT - if ( layout() ) - layout()->setEnabled( TRUE ); -#endif - } -} - - -/*! \reimp */ -TQSize TQDialog::sizeHint() const -{ - if ( d->extension ) { - if ( d->orientation == Horizontal ) - return TQSize( TQWidget::sizeHint().width(), - TQMAX( TQWidget::sizeHint().height(),d->extension->sizeHint().height() ) ); - else - return TQSize( TQMAX( TQWidget::sizeHint().width(), d->extension->sizeHint().width() ), - TQWidget::sizeHint().height() ); - } - - return TQWidget::sizeHint(); -} - - -/*! \reimp */ -TQSize TQDialog::minimumSizeHint() const -{ - if ( d->extension ) { - if (d->orientation == Horizontal ) - return TQSize( TQWidget::minimumSizeHint().width(), - TQMAX( TQWidget::minimumSizeHint().height(), d->extension->minimumSizeHint().height() ) ); - else - return TQSize( TQMAX( TQWidget::minimumSizeHint().width(), d->extension->minimumSizeHint().width() ), - TQWidget::minimumSizeHint().height() ); - } - - return TQWidget::minimumSizeHint(); -} - -/*! \property TQDialog::modal - \brief whether show() should pop up the dialog as modal or modeless - - By default, this property is false and show() pops up the dialog as - modeless. - - exec() ignores the value of this property and always pops up the - dialog as modal. - - \sa show(), exec() -*/ - -void TQDialog::setModal( bool modal ) -{ - if ( modal ) - setWFlags( WShowModal ); - else - clearWFlags( WShowModal ); -} - -bool TQDialog::isModal() const -{ - return testWFlags( WShowModal ) != 0; -} - -bool TQDialog::isSizeGripEnabled() const -{ -#ifndef TQT_NO_SIZEGRIP - return !!d->resizer; -#else - return FALSE; -#endif -} - - -void TQDialog::setSizeGripEnabled(bool enabled) -{ -#ifndef TQT_NO_SIZEGRIP - if ( !enabled != !d->resizer ) { - if ( enabled ) { - d->resizer = new TQSizeGrip( this, "TQDialog::resizer" ); - // adjustSize() processes all events, which is suboptimal - d->resizer->resize( d->resizer->sizeHint() ); - if ( TQApplication::reverseLayout() ) - d->resizer->move( rect().bottomLeft() -d->resizer->rect().bottomLeft() ); - else - d->resizer->move( rect().bottomRight() -d->resizer->rect().bottomRight() ); - d->resizer->raise(); - d->resizer->show(); - } else { - delete d->resizer; - d->resizer = 0; - } - } -#endif //TQT_NO_SIZEGRIP -} - - - -/*! \reimp */ -void TQDialog::resizeEvent( TQResizeEvent * ) -{ -#ifndef TQT_NO_SIZEGRIP - if ( d->resizer ) { - if ( TQApplication::reverseLayout() ) - d->resizer->move( rect().bottomLeft() -d->resizer->rect().bottomLeft() ); - else - d->resizer->move( rect().bottomRight() -d->resizer->rect().bottomRight() ); - } -#endif -} - -#endif // TQT_NO_DIALOG diff --git a/src/dialogs/qerrormessage.cpp b/src/dialogs/qerrormessage.cpp index 5d21cf717..2580d9e90 100644 --- a/src/dialogs/qerrormessage.cpp +++ b/src/dialogs/qerrormessage.cpp @@ -43,12 +43,12 @@ #ifndef TQT_NO_ERRORMESSAGE #include "ntqapplication.h" -#include "ntqcheckbox.h" +#include "tqcheckbox.h" #include "tqdict.h" #include "tqlabel.h" #include "ntqlayout.h" #include "ntqmessagebox.h" -#include "ntqpushbutton.h" +#include "tqpushbutton.h" #include "tqstringlist.h" #include "tqstylesheet.h" #include "tqtextview.h" diff --git a/src/dialogs/qinputdialog.cpp b/src/dialogs/qinputdialog.cpp index 6e8e7627c..6b16af01d 100644 --- a/src/dialogs/qinputdialog.cpp +++ b/src/dialogs/qinputdialog.cpp @@ -44,10 +44,10 @@ #include "ntqlayout.h" #include "tqlabel.h" -#include "ntqlineedit.h" -#include "ntqpushbutton.h" -#include "ntqspinbox.h" -#include "ntqcombobox.h" +#include "tqlineedit.h" +#include "tqpushbutton.h" +#include "tqspinbox.h" +#include "tqcombobox.h" #include "tqwidgetstack.h" #include "ntqvalidator.h" #include "ntqapplication.h" diff --git a/src/dialogs/qmessagebox.cpp b/src/dialogs/qmessagebox.cpp index a80a26886..836470eb4 100644 --- a/src/dialogs/qmessagebox.cpp +++ b/src/dialogs/qmessagebox.cpp @@ -44,7 +44,7 @@ #include "ntqaccel.h" #include "tqlabel.h" -#include "ntqpushbutton.h" +#include "tqpushbutton.h" #include "tqimage.h" #include "ntqapplication.h" #include "tqstyle.h" diff --git a/src/dialogs/qprintdialog.cpp b/src/dialogs/qprintdialog.cpp index 0fc6f6935..fee5a49b7 100644 --- a/src/dialogs/qprintdialog.cpp +++ b/src/dialogs/qprintdialog.cpp @@ -45,17 +45,17 @@ #include "tqfiledialog.h" #include "tqfile.h" #include "tqtextstream.h" -#include "ntqcombobox.h" +#include "tqcombobox.h" #include "ntqframe.h" #include "tqlabel.h" -#include "ntqlineedit.h" -#include "ntqpushbutton.h" +#include "tqlineedit.h" +#include "tqpushbutton.h" #include "tqprinter.h" #include "ntqlistview.h" #include "ntqlayout.h" #include "ntqbuttongroup.h" -#include "ntqradiobutton.h" -#include "ntqspinbox.h" +#include "tqradiobutton.h" +#include "tqspinbox.h" #include "ntqapplication.h" #include "ntqheader.h" #include "tqstyle.h" diff --git a/src/dialogs/qprogressdialog.cpp b/src/dialogs/qprogressdialog.cpp index 0527f17d2..9c74a906e 100644 --- a/src/dialogs/qprogressdialog.cpp +++ b/src/dialogs/qprogressdialog.cpp @@ -48,7 +48,7 @@ #include "tqdatetime.h" #include "ntqapplication.h" #include "tqstyle.h" -#include "ntqpushbutton.h" +#include "tqpushbutton.h" #include "ntqcursor.h" #include "tqtimer.h" #include diff --git a/src/dialogs/qt_dialogs.pri b/src/dialogs/qt_dialogs.pri index 669dd70a4..e5c17042a 100644 --- a/src/dialogs/qt_dialogs.pri +++ b/src/dialogs/qt_dialogs.pri @@ -4,7 +4,7 @@ dialogs { DIALOGS_P = dialogs HEADERS += $$DIALOGS_H/tqcolordialog.h \ - $$DIALOGS_H/ntqdialog.h \ + $$DIALOGS_H/tqdialog.h \ $$DIALOGS_H/ntqerrormessage.h \ $$DIALOGS_H/tqfiledialog.h \ $$DIALOGS_H/tqfontdialog.h \ @@ -20,7 +20,7 @@ dialogs { unix:HEADERS += $$DIALOGS_H/ntqprintdialog.h SOURCES += $$DIALOGS_CPP/tqcolordialog.cpp \ - $$DIALOGS_CPP/qdialog.cpp \ + $$DIALOGS_CPP/tqdialog.cpp \ $$DIALOGS_CPP/qerrormessage.cpp \ $$DIALOGS_CPP/tqfiledialog.cpp \ $$DIALOGS_CPP/tqfontdialog.cpp \ diff --git a/src/dialogs/qtabdialog.cpp b/src/dialogs/qtabdialog.cpp index 1a5b1799e..db439d93f 100644 --- a/src/dialogs/qtabdialog.cpp +++ b/src/dialogs/qtabdialog.cpp @@ -45,7 +45,7 @@ #include "tqobjectlist.h" #include "ntqtabbar.h" #include "ntqtabwidget.h" -#include "ntqpushbutton.h" +#include "tqpushbutton.h" #include "tqpainter.h" #include "tqpixmap.h" #include "ntqapplication.h" diff --git a/src/dialogs/qwizard.cpp b/src/dialogs/qwizard.cpp index 6669a4e7a..ef3b4e8f4 100644 --- a/src/dialogs/qwizard.cpp +++ b/src/dialogs/qwizard.cpp @@ -43,7 +43,7 @@ #ifndef TQT_NO_WIZARD #include "ntqlayout.h" -#include "ntqpushbutton.h" +#include "tqpushbutton.h" #include "ntqcursor.h" #include "tqlabel.h" #include "tqwidgetstack.h" diff --git a/src/dialogs/tqcolordialog.cpp b/src/dialogs/tqcolordialog.cpp index 19e08c61a..95b7145c8 100644 --- a/src/dialogs/tqcolordialog.cpp +++ b/src/dialogs/tqcolordialog.cpp @@ -45,8 +45,8 @@ #include "tqpainter.h" #include "ntqlayout.h" #include "tqlabel.h" -#include "ntqpushbutton.h" -#include "ntqlineedit.h" +#include "tqpushbutton.h" +#include "tqlineedit.h" #include "tqimage.h" #include "tqpixmap.h" #include "ntqdrawutil.h" diff --git a/src/dialogs/tqcolordialog.h b/src/dialogs/tqcolordialog.h index 0941a020d..580f82ca0 100644 --- a/src/dialogs/tqcolordialog.h +++ b/src/dialogs/tqcolordialog.h @@ -42,7 +42,7 @@ #define TQCOLORDIALOG_H #ifndef QT_H -#include "ntqdialog.h" +#include "tqdialog.h" #endif // QT_H #ifndef TQT_NO_COLORDIALOG diff --git a/src/dialogs/tqdialog.cpp b/src/dialogs/tqdialog.cpp new file mode 100644 index 000000000..f3f05ae50 --- /dev/null +++ b/src/dialogs/tqdialog.cpp @@ -0,0 +1,1180 @@ +/**************************************************************************** +** +** Implementation of TQDialog class +** +** Created : 950502 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the dialogs module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqdialog.h" + +#ifndef TQT_NO_DIALOG + +#include "tqpushbutton.h" +#include "ntqfocusdata.h" +#include "ntqapplication.h" +#include "tqobjectlist.h" +#include "tqwidgetlist.h" +#include "ntqlayout.h" +#include "tqsizegrip.h" +#include "tqwhatsthis.h" +#include "tqpopupmenu.h" +#include "ntqcursor.h" +#if defined(QT_ACCESSIBILITY_SUPPORT) +#include "ntqaccessible.h" +#endif +#if defined( Q_OS_TEMP ) +#include "qt_windows.h" +#endif + +/*! + \class TQDialog + \brief The TQDialog class is the base class of dialog windows. + + \ingroup dialogs + \ingroup abstractwidgets + \mainclass + + A dialog window is a top-level window mostly used for short-term + tasks and brief communications with the user. TQDialogs may be + modal or modeless. TQDialogs support \link #extensibility + extensibility\endlink and can provide a \link #return return + value\endlink. They can have \link #default default + buttons\endlink. TQDialogs can also have a TQSizeGrip in their + lower-right corner, using setSizeGripEnabled(). + + Note that TQDialog uses the parent widget slightly differently from + other classes in TQt. A dialog is always a top-level widget, but if + it has a parent, its default location is centered on top of the + parent's top-level widget (if it is not top-level itself). It will + also share the parent's taskbar entry. + + \target modal + \section1 Modal Dialogs + + A modal dialog is a dialog that blocks input to other + visible windows in the same application. Users must finish + interacting with the dialog and close it before they can access + any other window in the application. Dialogs that are used to + request a file name from the user or that are used to set + application preferences are usually modal. + + The most common way to display a modal dialog is to call its + exec() function. When the user closes the dialog, exec() will + provide a useful \link #return return value\endlink. Typically we + connect a default button, e.g. "OK", to the accept() slot and a + "Cancel" button to the reject() slot, to get the dialog to close + and return the appropriate value. Alternatively you can connect to + the done() slot, passing it \c Accepted or \c Rejected. + + An alternative is to call setModal(TRUE), then show(). Unlike + exec(), show() returns control to the caller immediately. Calling + setModal(TRUE) is especially useful for progress dialogs, where + the user must have the ability to interact with the dialog, e.g. + to cancel a long running operation. If you use show() and + setModal(TRUE) together you must call + TQApplication::processEvents() periodically during processing to + enable the user to interact with the dialog. (See \l + TQProgressDialog.) + + \target modeless + \section1 Modeless Dialogs + + A modeless dialog is a dialog that operates + independently of other windows in the same application. Find and + replace dialogs in word-processors are often modeless to allow the + user to interact with both the application's main window and with + the dialog. + + Modeless dialogs are displayed using show(), which returns control + to the caller immediately. + + \target default + \section1 Default button + + A dialog's \e default button is the button that's pressed when the + user presses Enter (Return). This button is used to signify that + the user accepts the dialog's settings and wants to close the + dialog. Use TQPushButton::setDefault(), TQPushButton::isDefault() + and TQPushButton::autoDefault() to set and control the dialog's + default button. + + \target escapekey + \section1 Escape Key + + If the user presses the Esc key in a dialog, TQDialog::reject() + will be called. This will cause the window to close: the \link + TQCloseEvent closeEvent \endlink cannot be \link + TQCloseEvent::ignore() ignored \endlink. + + \target extensibility + \section1 Extensibility + + Extensibility is the ability to show the dialog in two ways: a + partial dialog that shows the most commonly used options, and a + full dialog that shows all the options. Typically an extensible + dialog will initially appear as a partial dialog, but with a + "More" toggle button. If the user presses the "More" button down, + the full dialog will appear. The extension widget will be resized + to its sizeHint(). If orientation is \c Horizontal the extension + widget's height() will be expanded to the height() of the dialog. + If the orientation is \c Vertical the extension widget's width() + will be expanded to the width() of the dialog. Extensibility is + controlled with setExtension(), setOrientation() and + showExtension(). + + \target return + \section1 Return value (modal dialogs) + + Modal dialogs are often used in situations where a return value is + required, e.g. to indicate whether the user pressed "OK" or + "Cancel". A dialog can be closed by calling the accept() or the + reject() slots, and exec() will return \c Accepted or \c Rejected + as appropriate. The exec() call returns the result of the dialog. + The result is also available from result() if the dialog has not + been destroyed. If the \c WDestructiveClose flag is set, the + dialog is deleted after exec() returns. + + \target examples + \section1 Examples + + A modal dialog. + + \quotefile network/networkprotocol/view.cpp + \skipto TQFileDialog *dlg + \printuntil return + + A modeless dialog. After the show() call, control returns to the main + event loop. + \quotefile life/main.cpp + \skipto argv + \printuntil TQApplication + \skipto scale + \printline + \skipto LifeDialog + \printuntil show + \skipto exec + \printuntil } + + \sa TQTabDialog TQWidget TQProgressDialog + \link guibooks.html#fowler GUI Design Handbook: Dialogs, Standard\endlink +*/ + +/*! \enum TQDialog::DialogCode + + The value returned by a modal dialog. + + \value Accepted + \value Rejected + +*/ + +/*! + \property TQDialog::sizeGripEnabled + \brief whether the size grip is enabled + + A TQSizeGrip is placed in the bottom right corner of the dialog when this + property is enabled. By default, the size grip is disabled. +*/ + +class TQDialogPrivate : public TQt +{ +public: + + TQDialogPrivate() + : mainDef(0), orientation(Horizontal),extension(0), doShowExtension(FALSE) +#ifndef TQT_NO_SIZEGRIP + ,resizer(0) +#endif + { + } + + TQPushButton* mainDef; + Orientation orientation; + TQWidget* extension; + bool doShowExtension; + TQSize size, min, max; +#ifndef TQT_NO_SIZEGRIP + TQSizeGrip* resizer; +#endif + TQPoint lastRMBPress; + TQPoint relPos; // relative position to the main window +}; + +/*! + Constructs a dialog called \a name, with parent \a parent. + + A dialog is always a top-level widget, but if it has a parent, its + default location is centered on top of the parent. It will also + share the parent's taskbar entry. + + The widget flags \a f are passed on to the TQWidget constructor. + If, for example, you don't want a What's This button in the titlebar + of the dialog, pass WStyle_Customize | WStyle_NormalBorder | + WStyle_Title | WStyle_SysMenu in \a f. + + \warning In TQt 3.2, the \a modal flag is obsolete. There is now a + setModal() function that can be used for obtaining a modal behavior + when calling show(). This is rarely needed, because modal dialogs + are usually invoked using exec(), which ignores the \a modal flag. + + \sa TQWidget::setWFlags() TQt::WidgetFlags +*/ + +TQDialog::TQDialog( TQWidget *parent, const char *name, bool modal, WFlags f ) + : TQWidget( parent, name, + (modal ? (f|WShowModal) : f) | WType_Dialog ), + rescode(0), did_move(0), has_relpos(0), did_resize(0), in_loop(0) +{ + d = new TQDialogPrivate; +} + +/*! + Destroys the TQDialog, deleting all its children. +*/ + +TQDialog::~TQDialog() +{ + // Need to hide() here, as our (to-be) overridden hide() + // will not be called in ~TQWidget. + hide(); + delete d; +} + +/*! + \internal + This function is called by the push button \a pushButton when it + becomes the default button. If \a pushButton is 0, the dialogs + default default button becomes the default button. This is what a + push button calls when it loses focus. +*/ + +void TQDialog::setDefault( TQPushButton *pushButton ) +{ +#ifndef TQT_NO_PUSHBUTTON + TQObjectList *list = queryList( "TQPushButton" ); + Q_ASSERT(list); + TQObjectListIt it( *list ); + TQPushButton *pb; + bool hasMain = FALSE; + while ( (pb = (TQPushButton*)it.current()) ) { + ++it; + if ( pb->topLevelWidget() != this ) + continue; + if ( pb == d->mainDef ) + hasMain = TRUE; + if ( pb != pushButton ) + pb->setDefault( FALSE ); + } + if (!pushButton && hasMain) + d->mainDef->setDefault( TRUE ); + if (!hasMain) + d->mainDef = pushButton; + delete list; +#endif +} + +/*! + \internal + This function sets the default default pushbutton to \a pushButton. + This function is called by TQPushButton::setDefault(). +*/ +void TQDialog::setMainDefault( TQPushButton *pushButton ) +{ +#ifndef TQT_NO_PUSHBUTTON + d->mainDef = 0; + setDefault(pushButton); +#endif +} + +/*! + \internal + Hides the default button indicator. Called when non auto-default + push button get focus. + */ +void TQDialog::hideDefault() +{ +#ifndef TQT_NO_PUSHBUTTON + TQObjectList *list = queryList( "TQPushButton" ); + TQObjectListIt it( *list ); + TQPushButton *pb; + while ( (pb = (TQPushButton*)it.current()) ) { + ++it; + pb->setDefault( FALSE ); + } + delete list; +#endif +} + +#ifdef Q_OS_TEMP +/*! + \internal + Hides special buttons which are rather shown in the titlebar + on WinCE, to conserve screen space. +*/ +# include "ntqmessagebox.h" +extern const char * mb_texts[]; // Defined in qmessagebox.cpp +void TQDialog::hideSpecial() +{ + // "OK" buttons are hidden, and (Ok) shown on titlebar + // "Cancel" buttons are hidden, and (X) shown on titlebar + // "Help" buttons are hidden, and (?) shown on titlebar + bool showOK = FALSE, + showX = FALSE, + showQ = FALSE; + TQObjectList *list = queryList( "TQPushButton" ); + TQObjectListIt it( *list ); + TQPushButton *pb; + while ( (pb = (TQPushButton*)it.current()) ) { + if ( !showOK && + pb->text() == tqApp->translate( "TQMessageBox", mb_texts[TQMessageBox::Ok] ) ) { + pb->hide(); + showOK = TRUE; + } else if ( !showX && + pb->text() == tqApp->translate( "TQMessageBox", mb_texts[TQMessageBox::Cancel] ) ) { + pb->hide(); + showX = TRUE; + } else if ( !showQ && + pb->text() == tqApp->tr("Help") ) { + pb->hide(); + showQ = TRUE; + } + ++it; + } + delete list; + if ( showOK || showQ ) { + DWORD ext = GetWindowLong( winId(), GWL_EXSTYLE ); + ext |= showOK ? WS_EX_CAPTIONOKBTN : 0; + ext |= showQ ? WS_EX_CONTEXTHELP: 0; + SetWindowLong( winId(), GWL_EXSTYLE, ext ); + } + if ( !showX ) { + DWORD ext = GetWindowLong( winId(), GWL_STYLE ); + ext &= ~WS_SYSMENU; + SetWindowLong( winId(), GWL_STYLE, ext ); + } +} +#endif + +/*! + \fn int TQDialog::result() const + + Returns the modal dialog's result code, \c Accepted or \c Rejected. + + Do not call this function if the dialog was constructed with the \c + WDestructiveClose flag. +*/ + +/*! + \fn void TQDialog::setResult( int i ) + + Sets the modal dialog's result code to \a i. +*/ + + +/*! + Shows the dialog as a \link #modal modal \endlink dialog, + blocking until the user closes it. The function returns a \l + DialogCode result. + + Users cannot interact with any other window in the same + application until they close the dialog. + + \sa show(), result() +*/ + +int TQDialog::exec() +{ + if ( in_loop ) { + tqWarning( "TQDialog::exec: Recursive call detected" ); + return -1; + } + + bool destructiveClose = testWFlags( WDestructiveClose ); + clearWFlags( WDestructiveClose ); + + bool wasShowModal = testWFlags( WShowModal ); + setWFlags( WShowModal ); + setResult( 0 ); + + show(); + + in_loop = TRUE; + tqApp->enter_loop(); + + if ( !wasShowModal ) + clearWFlags( WShowModal ); + + int res = result(); + + if ( destructiveClose ) + delete this; + + return res; +} + + +/*! Closes the dialog and sets its result code to \a r. If this dialog + is shown with exec(), done() causes the local event loop to finish, + and exec() to return \a r. + + As with TQWidget::close(), done() deletes the dialog if the \c + WDestructiveClose flag is set. If the dialog is the application's + main widget, the application terminates. If the dialog is the + last window closed, the TQApplication::lastWindowClosed() signal is + emitted. + + \sa accept(), reject(), TQApplication::mainWidget(), TQApplication::quit() +*/ + +void TQDialog::done( int r ) +{ + hide(); + setResult( r ); + + // emulate TQWidget::close() + bool isMain = tqApp->mainWidget() == this; + bool checkLastWindowClosed = isTopLevel() && !isPopup(); + if ( checkLastWindowClosed + && tqApp->receivers(TQ_SIGNAL(lastWindowClosed())) ) { + /* if there is no non-withdrawn top level window left (except + the desktop, popups, or dialogs with parents), we emit the + lastWindowClosed signal */ + TQWidgetList *list = tqApp->topLevelWidgets(); + TQWidget *widget = list->first(); + while ( widget ) { + if ( !widget->isHidden() + && !widget->isDesktop() + && !widget->isPopup() + && (!widget->isDialog() || !widget->parentWidget())) + break; + widget = list->next(); + } + delete list; + if ( widget == 0 ) + emit tqApp->lastWindowClosed(); + } + if ( isMain ) + tqApp->quit(); + else if ( testWFlags(WDestructiveClose) ) { + clearWFlags(WDestructiveClose); + deleteLater(); + } +} + +/*! + Hides the modal dialog and sets the result code to \c Accepted. + + \sa reject() done() +*/ + +void TQDialog::accept() +{ + done( Accepted ); +} + +/*! + Hides the modal dialog and sets the result code to \c Rejected. + + \sa accept() done() +*/ + +void TQDialog::reject() +{ + done( Rejected ); +} + +/*! \reimp */ +bool TQDialog::eventFilter( TQObject *o, TQEvent *e ) +{ + return TQWidget::eventFilter( o, e ); +} + +/***************************************************************************** + Event handlers + *****************************************************************************/ + +/*! \reimp */ +void TQDialog::contextMenuEvent( TQContextMenuEvent *e ) +{ +#if !defined(TQT_NO_WHATSTHIS) && !defined(TQT_NO_POPUPMENU) + TQWidget* w = childAt( e->pos(), TRUE ); + if ( !w ) + return; + TQString s; + while ( s.isEmpty() && w ) { + s = TQWhatsThis::textFor( w, e->pos(), FALSE ); + if ( s.isEmpty() ) + w = w->parentWidget(TRUE); + } + if ( !s.isEmpty() ) { + TQPopupMenu p(0,"qt_whats_this_menu"); + p.insertItem( tr("What's This?"), 42 ); + if ( p.exec( e->globalPos() ) >= 42 ) + TQWhatsThis::display( s, w->mapToGlobal( w->rect().center() ), w ); + } +#endif +} + +/*! \reimp */ +void TQDialog::keyPressEvent( TQKeyEvent *e ) +{ + // Calls reject() if Escape is pressed. Simulates a button + // click for the default button if Enter is pressed. Move focus + // for the arrow keys. Ignore the rest. +#ifdef Q_OS_MAC + if(e->state() == ControlButton && e->key() == Key_Period) { + reject(); + } else +#endif + if ( e->state() == 0 || ( e->state() & Keypad && e->key() == Key_Enter ) ) { + switch ( e->key() ) { + case Key_Enter: + case Key_Return: { +#ifndef TQT_NO_PUSHBUTTON + TQObjectList *list = queryList( "TQPushButton" ); + TQObjectListIt it( *list ); + TQPushButton *pb; + while ( (pb = (TQPushButton*)it.current()) ) { + if ( pb->isDefault() && pb->isVisible() ) { + delete list; + if ( pb->isEnabled() ) { + emit pb->clicked(); + } + return; + } + ++it; + } + delete list; +#endif + } + break; + case Key_Escape: + reject(); + break; + case Key_Up: + case Key_Left: + if ( focusWidget() && + ( focusWidget()->focusPolicy() == TQWidget::StrongFocus || + focusWidget()->focusPolicy() == TQWidget::WheelFocus ) ) { + e->ignore(); + break; + } + // call ours, since c++ blocks us from calling the one + // belonging to focusWidget(). + TQFocusEvent::setReason(TQFocusEvent::Backtab); + focusNextPrevChild( FALSE ); + TQFocusEvent::resetReason(); + break; + case Key_Down: + case Key_Right: + if ( focusWidget() && + ( focusWidget()->focusPolicy() == TQWidget::StrongFocus || + focusWidget()->focusPolicy() == TQWidget::WheelFocus ) ) { + e->ignore(); + break; + } + TQFocusEvent::setReason(TQFocusEvent::Tab); + focusNextPrevChild( TRUE ); + TQFocusEvent::resetReason(); + break; + default: + e->ignore(); + return; + } + } else { + e->ignore(); + } +} + +/*! \reimp */ +void TQDialog::closeEvent( TQCloseEvent *e ) +{ +#ifndef TQT_NO_WHATSTHIS + if ( isModal() && TQWhatsThis::inWhatsThisMode() ) + TQWhatsThis::leaveWhatsThisMode(); +#endif + if ( isShown() ) + reject(); + if ( isHidden() ) + e->accept(); +} + +#ifdef Q_OS_TEMP +/*! \internal + \reimp +*/ +bool TQDialog::event( TQEvent *e ) +{ + switch ( e->type() ) { + case TQEvent::OkRequest: + case TQEvent::HelpRequest: + { + TQString bName = + (e->type() == TQEvent::OkRequest) + ? tqApp->translate( "TQMessageBox", mb_texts[TQMessageBox::Ok] ) + : tqApp->tr( "Help" ); + + TQObjectList *list = queryList( "TQPushButton" ); + TQObjectListIt it( *list ); + TQPushButton *pb; + while ( (pb = (TQPushButton*)it.current()) ) { + if ( pb->text() == bName ) { + delete list; + if ( pb->isEnabled() ) + emit pb->clicked(); + return pb->isEnabled(); + } + ++it; + } + delete list; + } + } + return TQWidget::event( e ); +} +#endif + + +/***************************************************************************** + Geometry management. + *****************************************************************************/ + +#if defined(TQ_WS_X11) +extern "C" { int XSetTransientForHint( Display *, unsigned long, unsigned long ); } +#include +#undef FocusIn +// defined in qapplication_x11.cpp +extern Atom qt_net_wm_full_placement; +extern bool qt_net_supports(Atom atom); +#endif // TQ_WS_X11 + +/*! + Shows the dialog as a \link #modeless modeless \endlink dialog. + Control returns immediately to the calling code. + + The dialog will be modal or modeless according to the value + of the \l modal property. + + \sa exec(), modal +*/ + +void TQDialog::show() +{ + if ( testWState(WState_Visible) ) + return; + + uint state = windowState(); + + if ( !did_resize ) + adjustSize(); + if( !qt_net_supports( qt_net_wm_full_placement )) { + if ( has_relpos && !did_move ) { + adjustPositionInternal( parentWidget(), TRUE ); + } else if ( !did_move ) { + adjustPositionInternal( parentWidget() ); + } + } + + if (windowState() != state) + setWindowState(state); + +#if defined(TQ_WS_X11) + if (!parentWidget() && testWFlags(WShowModal) + && tqApp->mainWidget() && tqApp->mainWidget()->isVisible() + && !tqApp->mainWidget()->isMinimized()) { + // make sure the transient for hint is set properly for modal dialogs + x11SetWindowTransient( tqApp->mainWidget()); + } +#endif // TQ_WS_X11 + +#ifdef Q_OS_TEMP + hideSpecial(); +#endif + + TQWidget::show(); + showExtension( d->doShowExtension ); +#ifndef TQT_NO_PUSHBUTTON + TQWidget *fw = focusWidget(); + TQFocusData *fd = focusData(); + + /* + The following block is to handle a special case, and does not + really follow propper logic in concern of autoDefault and TAB + order. However, it's here to ease usage for the users. If a + dialog has a default TQPushButton, and first widget in the TAB + order also is a TQPushButton, then we give focus to the main + default TQPushButton. This simplifies code for the developers, + and actually catches most cases... If not, then they simply + have to use [widget*]->setFocus() themselves... + */ + if ( !fw || fw->focusPolicy() == NoFocus ) { + fd->home(); // Skip main form + TQWidget *first = fd->next(); // Get first main widget + if ( d->mainDef && + first != d->mainDef && + ::tqt_cast(first) ) + d->mainDef->setFocus(); + } + + if ( !d->mainDef && isTopLevel() ) { + if ( !fw || fw->focusPolicy() == NoFocus ) { + focusNextPrevChild( TRUE ); + fw = focusWidget(); + } + if ( fw ) { + fd = focusData(); + TQWidget *home = fd->home(); + TQWidget *candidate = home; + Q_ASSERT( candidate == fw ); + do { + TQPushButton *pb = ::tqt_cast(candidate); + if ( pb && pb->autoDefault() ) { + pb->setDefault( TRUE ); + break; + } + candidate = fd->next(); + } while ( candidate != home ); + } + } + if ( fw ) { + TQFocusEvent e( TQEvent::FocusIn ); + TQFocusEvent::setReason( TQFocusEvent::Tab ); + TQApplication::sendEvent( fw, &e ); + TQFocusEvent::resetReason(); + } + +#endif +#if defined(QT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( this, 0, TQAccessible::DialogStart ); +#endif +} + +/*! \internal */ +void TQDialog::adjustPosition( TQWidget* w) +{ + adjustPositionInternal( w ); +} + + +void TQDialog::adjustPositionInternal( TQWidget*w, bool useRelPos) +{ + /* need to make sure these events are already sent to be sure + our information below is correct --sam */ + TQApplication::sendPostedEvents( this, TQEvent::LayoutHint ); + TQApplication::sendPostedEvents( this, TQEvent::Resize ); + + // processing the events might call polish(), which is a nice place + // to restore geometries, so return if the dialog has been positioned + if ( did_move || has_relpos ) + return; + + TQPoint p( 0, 0 ); + int extraw = 0, extrah = 0, scrn = 0; + if ( w ) + w = w->topLevelWidget(); + TQRect desk; + if ( w ) { + // Use mapToGlobal rather than geometry() in case w might + // be embedded in another application + scrn = TQApplication::desktop()->screenNumber( w->mapToGlobal( TQPoint(0,0) ) ); + } else if ( TQApplication::desktop()->isVirtualDesktop() ) { + scrn = TQApplication::desktop()->screenNumber( TQCursor::pos() ); + } else { + scrn = TQApplication::desktop()->screenNumber( this ); + } + desk = TQApplication::desktop()->availableGeometry( scrn ); + + TQWidgetList *list = TQApplication::topLevelWidgets(); + TQWidgetListIt it( *list ); + while ( (extraw == 0 || extrah == 0) && + it.current() != 0 ) { + int framew, frameh; + TQWidget * current = it.current(); + ++it; + if ( ! current->isVisible() ) + continue; + + framew = current->geometry().x() - current->x(); + frameh = current->geometry().y() - current->y(); + + extraw = TQMAX( extraw, framew ); + extrah = TQMAX( extrah, frameh ); + } + delete list; + + // sanity check for decoration frames. With embedding, we + // might get extraordinary values + if ( extraw == 0 || extrah == 0 || extraw >= 10 || extrah >= 40 ) { + extrah = 40; + extraw = 10; + } + + if ( useRelPos && w ) { + p = w->pos() + d->relPos; + } else { +#ifndef Q_OS_TEMP + if ( w ) { + // Use mapToGlobal rather than geometry() in case w might + // be embedded in another application + TQPoint pp = w->mapToGlobal( TQPoint(0,0) ); + p = TQPoint( pp.x() + w->width()/2, + pp.y() + w->height()/ 2 ); + } else { + // p = middle of the desktop + p = TQPoint( desk.x() + desk.width()/2, desk.y() + desk.height()/2 ); + } +#else + p = TQPoint( desk.x() + desk.width()/2, desk.y() + desk.height()/2 ); +#endif + + // p = origin of this + p = TQPoint( p.x()-width()/2 - extraw, + p.y()-height()/2 - extrah ); + } + + + if ( p.x() + extraw + width() > desk.x() + desk.width() ) + p.setX( desk.x() + desk.width() - width() - extraw ); + if ( p.x() < desk.x() ) + p.setX( desk.x() ); + + if ( p.y() + extrah + height() > desk.y() + desk.height() ) + p.setY( desk.y() + desk.height() - height() - extrah ); + if ( p.y() < desk.y() ) + p.setY( desk.y() ); + + move( p ); + did_move = !useRelPos; +} + + +/*! \reimp */ +void TQDialog::hide() +{ + if ( isHidden() ) + return; + +#if defined(QT_ACCESSIBILITY_SUPPORT) + if ( isVisible() ) + TQAccessible::updateAccessibility( this, 0, TQAccessible::DialogEnd ); +#endif + + if ( parentWidget() && !did_move ) { + d->relPos = pos() - parentWidget()->topLevelWidget()->pos(); + has_relpos = 1; + } + + // Reimplemented to exit a modal when the dialog is hidden. + TQWidget::hide(); + if ( in_loop ) { + in_loop = FALSE; + tqApp->exit_loop(); + } +} + + +/***************************************************************************** + Detects any widget geometry changes done by the user. + *****************************************************************************/ + +/*! \reimp */ + +void TQDialog::move( int x, int y ) +{ + did_move = TRUE; + TQWidget::move( x, y ); +} + +/*! \reimp */ + +void TQDialog::move( const TQPoint &p ) +{ + did_move = TRUE; + TQWidget::move( p ); +} + +/*! \reimp */ + +void TQDialog::resize( int w, int h ) +{ + did_resize = TRUE; + TQWidget::resize( w, h ); +} + +/*! \reimp */ + +void TQDialog::resize( const TQSize &s ) +{ + did_resize = TRUE; + TQWidget::resize( s ); +} + +/*! \reimp */ + +void TQDialog::setGeometry( int x, int y, int w, int h ) +{ + did_move = TRUE; + did_resize = TRUE; + TQWidget::setGeometry( x, y, w, h ); +} + +/*! \reimp */ + +void TQDialog::setGeometry( const TQRect &r ) +{ + did_move = TRUE; + did_resize = TRUE; + TQWidget::setGeometry( r ); +} + + +/*! + If \a orientation is \c Horizontal, the extension will be displayed + to the right of the dialog's main area. If \a orientation is \c + Vertical, the extension will be displayed below the dialog's main + area. + + \sa orientation(), setExtension() +*/ +void TQDialog::setOrientation( Orientation orientation ) +{ + d->orientation = orientation; +} + +/*! + Returns the dialog's extension orientation. + + \sa setOrientation() +*/ +TQt::Orientation TQDialog::orientation() const +{ + return d->orientation; +} + +/*! + Sets the widget, \a extension, to be the dialog's extension, + deleting any previous extension. The dialog takes ownership of the + extension. Note that if 0 is passed any existing extension will be + deleted. + + This function must only be called while the dialog is hidden. + + \sa showExtension(), setOrientation(), extension() + */ +void TQDialog::setExtension( TQWidget* extension ) +{ + delete d->extension; + d->extension = extension; + + if ( !extension ) + return; + + if ( extension->parentWidget() != this ) + extension->reparent( this, TQPoint(0,0) ); + extension->hide(); +} + +/*! + Returns the dialog's extension or 0 if no extension has been + defined. + + \sa setExtension() + */ +TQWidget* TQDialog::extension() const +{ + return d->extension; +} + + +/*! + If \a showIt is TRUE, the dialog's extension is shown; otherwise the + extension is hidden. + + This slot is usually connected to the \l TQButton::toggled() signal + of a TQPushButton. + + A dialog with a visible extension is not resizeable. + + \sa show(), setExtension(), setOrientation() + */ +void TQDialog::showExtension( bool showIt ) +{ + d->doShowExtension = showIt; + if ( !d->extension ) + return; + if ( !testWState(WState_Visible) ) + return; + if ( d->extension->isVisible() == showIt ) + return; + + if ( showIt ) { + d->size = size(); + d->min = minimumSize(); + d->max = maximumSize(); +#ifndef TQT_NO_LAYOUT + if ( layout() ) + layout()->setEnabled( FALSE ); +#endif + TQSize s( d->extension->sizeHint() + .expandedTo( d->extension->minimumSize() ) + .boundedTo( d->extension->maximumSize() ) ); + if ( d->orientation == Horizontal ) { + int h = TQMAX( height(), s.height() ); + d->extension->setGeometry( width(), 0, s.width(), h ); + setFixedSize( width() + s.width(), h ); + } else { + int w = TQMAX( width(), s.width() ); + d->extension->setGeometry( 0, height(), w, s.height() ); + setFixedSize( w, height() + s.height() ); + } + d->extension->show(); + } else { + d->extension->hide(); + // workaround for CDE window manager that won't shrink with (-1,-1) + setMinimumSize( d->min.expandedTo( TQSize( 1, 1 ) ) ); + setMaximumSize( d->max ); + resize( d->size ); +#ifndef TQT_NO_LAYOUT + if ( layout() ) + layout()->setEnabled( TRUE ); +#endif + } +} + + +/*! \reimp */ +TQSize TQDialog::sizeHint() const +{ + if ( d->extension ) { + if ( d->orientation == Horizontal ) + return TQSize( TQWidget::sizeHint().width(), + TQMAX( TQWidget::sizeHint().height(),d->extension->sizeHint().height() ) ); + else + return TQSize( TQMAX( TQWidget::sizeHint().width(), d->extension->sizeHint().width() ), + TQWidget::sizeHint().height() ); + } + + return TQWidget::sizeHint(); +} + + +/*! \reimp */ +TQSize TQDialog::minimumSizeHint() const +{ + if ( d->extension ) { + if (d->orientation == Horizontal ) + return TQSize( TQWidget::minimumSizeHint().width(), + TQMAX( TQWidget::minimumSizeHint().height(), d->extension->minimumSizeHint().height() ) ); + else + return TQSize( TQMAX( TQWidget::minimumSizeHint().width(), d->extension->minimumSizeHint().width() ), + TQWidget::minimumSizeHint().height() ); + } + + return TQWidget::minimumSizeHint(); +} + +/*! \property TQDialog::modal + \brief whether show() should pop up the dialog as modal or modeless + + By default, this property is false and show() pops up the dialog as + modeless. + + exec() ignores the value of this property and always pops up the + dialog as modal. + + \sa show(), exec() +*/ + +void TQDialog::setModal( bool modal ) +{ + if ( modal ) + setWFlags( WShowModal ); + else + clearWFlags( WShowModal ); +} + +bool TQDialog::isModal() const +{ + return testWFlags( WShowModal ) != 0; +} + +bool TQDialog::isSizeGripEnabled() const +{ +#ifndef TQT_NO_SIZEGRIP + return !!d->resizer; +#else + return FALSE; +#endif +} + + +void TQDialog::setSizeGripEnabled(bool enabled) +{ +#ifndef TQT_NO_SIZEGRIP + if ( !enabled != !d->resizer ) { + if ( enabled ) { + d->resizer = new TQSizeGrip( this, "TQDialog::resizer" ); + // adjustSize() processes all events, which is suboptimal + d->resizer->resize( d->resizer->sizeHint() ); + if ( TQApplication::reverseLayout() ) + d->resizer->move( rect().bottomLeft() -d->resizer->rect().bottomLeft() ); + else + d->resizer->move( rect().bottomRight() -d->resizer->rect().bottomRight() ); + d->resizer->raise(); + d->resizer->show(); + } else { + delete d->resizer; + d->resizer = 0; + } + } +#endif //TQT_NO_SIZEGRIP +} + + + +/*! \reimp */ +void TQDialog::resizeEvent( TQResizeEvent * ) +{ +#ifndef TQT_NO_SIZEGRIP + if ( d->resizer ) { + if ( TQApplication::reverseLayout() ) + d->resizer->move( rect().bottomLeft() -d->resizer->rect().bottomLeft() ); + else + d->resizer->move( rect().bottomRight() -d->resizer->rect().bottomRight() ); + } +#endif +} + +#endif // TQT_NO_DIALOG diff --git a/src/dialogs/tqdialog.h b/src/dialogs/tqdialog.h new file mode 100644 index 000000000..e1d82c179 --- /dev/null +++ b/src/dialogs/tqdialog.h @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Definition of TQDialog class +** +** Created : 950502 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the dialogs module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQDIALOG_H +#define TQDIALOG_H + +#ifndef QT_H +#include "tqwidget.h" +#endif // QT_H +#ifndef TQT_NO_DIALOG +#if 0 +TQ_OBJECT +#endif + +class TQPushButton; +class TQDialogPrivate; + +class TQ_EXPORT TQDialog : public TQWidget +{ +friend class TQPushButton; + TQ_OBJECT + TQ_PROPERTY( bool sizeGripEnabled READ isSizeGripEnabled WRITE setSizeGripEnabled ) + TQ_PROPERTY( bool modal READ isModal WRITE setModal ) + +public: + Q_EXPLICIT TQDialog( TQWidget* parent=0, const char* name=0, bool modal=FALSE, + WFlags f=0 ); + ~TQDialog(); + + enum DialogCode { Rejected, Accepted }; + + int result() const { return rescode; } + + void show(); + void hide(); + void move( int x, int y ); + void move( const TQPoint &p ); + void resize( int w, int h ); + void resize( const TQSize & ); + void setGeometry( int x, int y, int w, int h ); + void setGeometry( const TQRect & ); + + void setOrientation( Orientation orientation ); + Orientation orientation() const; + + void setExtension( TQWidget* extension ); + TQWidget* extension() const; + + TQSize sizeHint() const; + TQSize minimumSizeHint() const; + + void setSizeGripEnabled( bool ); + bool isSizeGripEnabled() const; + + void setModal( bool modal ); + bool isModal() const; +#ifdef Q_OS_TEMP + bool event( TQEvent * ); +#endif + +public slots: + int exec(); + +protected slots: + virtual void done( int ); + virtual void accept(); + virtual void reject(); + + void showExtension( bool ); + +protected: + void setResult( int r ) { rescode = r; } + void keyPressEvent( TQKeyEvent * ); + void closeEvent( TQCloseEvent * ); + void resizeEvent( TQResizeEvent * ); + void contextMenuEvent( TQContextMenuEvent * ); + bool eventFilter( TQObject *, TQEvent * ); + void adjustPosition( TQWidget*); + +private: + void setDefault( TQPushButton * ); + void setMainDefault( TQPushButton * ); + void hideDefault(); +#ifdef Q_OS_TEMP + void hideSpecial(); +#endif + + int rescode; + uint did_move : 1; + uint has_relpos : 1; + uint did_resize : 1; + uint in_loop: 1; + void adjustPositionInternal( TQWidget*, bool useRelPos = FALSE ); + TQDialogPrivate* d; + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQDialog( const TQDialog & ); + TQDialog &operator=( const TQDialog & ); +#endif +}; + +#endif // TQT_NO_DIALOG +#endif // TQDIALOG_H diff --git a/src/dialogs/tqfiledialog.cpp b/src/dialogs/tqfiledialog.cpp index 5ed1ff6be..27ec5d130 100644 --- a/src/dialogs/tqfiledialog.cpp +++ b/src/dialogs/tqfiledialog.cpp @@ -58,9 +58,9 @@ #include "ntqapplication.h" #include "tqbitmap.h" #include "ntqbuttongroup.h" -#include "ntqcheckbox.h" +#include "tqcheckbox.h" #include "ntqcleanuphandler.h" -#include "ntqcombobox.h" +#include "tqcombobox.h" #include "tqcstring.h" #include "ntqcursor.h" #include "tqdragobject.h" @@ -71,7 +71,7 @@ #include "tqlabel.h" #include "ntqlayout.h" #include "ntqlibrary.h" -#include "ntqlineedit.h" +#include "tqlineedit.h" #include "ntqlistbox.h" #include "ntqlistview.h" #include "tqmap.h" @@ -83,7 +83,7 @@ #include "tqpopupmenu.h" #include "ntqprogressbar.h" #include "tqptrvector.h" -#include "ntqpushbutton.h" +#include "tqpushbutton.h" #include "tqregexp.h" #include "ntqsplitter.h" #include "tqstrlist.h" diff --git a/src/dialogs/tqfiledialog.h b/src/dialogs/tqfiledialog.h index b57be85a9..23cd5476e 100644 --- a/src/dialogs/tqfiledialog.h +++ b/src/dialogs/tqfiledialog.h @@ -56,7 +56,7 @@ class TQFileDialogTQFileListView; #ifndef QT_H #include "tqdir.h" -#include "ntqdialog.h" +#include "tqdialog.h" #include "tqurloperator.h" #include "tqurlinfo.h" #endif // QT_H diff --git a/src/dialogs/tqfontdialog.cpp b/src/dialogs/tqfontdialog.cpp index c9b5daef0..e13083b3a 100644 --- a/src/dialogs/tqfontdialog.cpp +++ b/src/dialogs/tqfontdialog.cpp @@ -44,11 +44,11 @@ #include "tqfontdialog.h" -#include "ntqlineedit.h" +#include "tqlineedit.h" #include "ntqlistbox.h" -#include "ntqpushbutton.h" -#include "ntqcheckbox.h" -#include "ntqcombobox.h" +#include "tqpushbutton.h" +#include "tqcheckbox.h" +#include "tqcombobox.h" #include "ntqlayout.h" #include "ntqvgroupbox.h" #include "ntqhgroupbox.h" diff --git a/src/dialogs/tqfontdialog.h b/src/dialogs/tqfontdialog.h index 2c7d3f9d4..1a3b007d5 100644 --- a/src/dialogs/tqfontdialog.h +++ b/src/dialogs/tqfontdialog.h @@ -56,7 +56,7 @@ // #ifndef QT_H -#include "ntqdialog.h" +#include "tqdialog.h" #include "tqfont.h" #endif // QT_H diff --git a/src/kernel/ntqt.h b/src/kernel/ntqt.h index 11305209b..b8e8dca73 100644 --- a/src/kernel/ntqt.h +++ b/src/kernel/ntqt.h @@ -77,9 +77,9 @@ #include "tqfileinfo.h" #include "tqurlinfo.h" #include "tqwidgetlist.h" -#include +#include #include "ntqgroupbox.h" -#include "ntqdialog.h" +#include "tqdialog.h" #include #include "ntqdockwindow.h" #include "ntqcommonstyle.h" @@ -107,7 +107,7 @@ #include "tqbuffer.h" #include "tqimage.h" #include -#include "ntqlineedit.h" +#include "tqlineedit.h" #include #include "tqintdict.h" #include "ntqmotifstyle.h" @@ -118,11 +118,11 @@ #include #include "tqlabel.h" #include "ntqlayout.h" -#include +#include #include #include -#include "ntqscrollbar.h" -#include "ntqscrollview.h" +#include "tqscrollbar.h" +#include "tqscrollview.h" #include "tqdir.h" #include "ntqwindowsstyle.h" #include "ntqconnection.h" @@ -169,9 +169,9 @@ #include #include #include "tqstylesheet.h" -#include -#include -#include +#include +#include +#include #include #include "tqregexp.h" #include @@ -193,12 +193,12 @@ #include #include #include -#include +#include #include #include #include #include -#include +#include #include #include #include "tqsqlerror.h" @@ -264,7 +264,7 @@ #include #include #include -#include +#include #include #include #include @@ -300,7 +300,7 @@ #include "private/tqdir_p.h" #include "private/tqsettings_p.h" #include "private/tqsqlextension_p.h" -#include "private/qdialogbuttons_p.h" +#include "private/tqdialogbuttons_p.h" #include "private/tqwidgetinterface_p.h" #include "private/tqwidgetresizehandler_p.h" #include "private/qlibrary_p.h" diff --git a/src/kernel/tqstyle.cpp b/src/kernel/tqstyle.cpp index 9bf8c4509..cca9ef651 100644 --- a/src/kernel/tqstyle.cpp +++ b/src/kernel/tqstyle.cpp @@ -48,7 +48,7 @@ #include "ntqlayout.h" #include "ntqlistview.h" #include "tqpopupmenu.h" -#include "ntqpushbutton.h" +#include "tqpushbutton.h" #include "tqobjectlist.h" #include "tqwidgetlist.h" diff --git a/src/kernel/tqwidget_x11.cpp b/src/kernel/tqwidget_x11.cpp index 4e07dd115..1d137e943 100644 --- a/src/kernel/tqwidget_x11.cpp +++ b/src/kernel/tqwidget_x11.cpp @@ -3055,7 +3055,7 @@ void TQWidget::destroyInputContext() /*! This function is called when text widgets need to be neutral state to - execute text operations properly. See qlineedit.cpp and tqtextedit.cpp as + execute text operations properly. See tqlineedit.cpp and tqtextedit.cpp as example. Ordinary reset that along with changing focus to another widget, diff --git a/src/libqt.map b/src/libqt.map index 9965ec963..42e353c76 100644 --- a/src/libqt.map +++ b/src/libqt.map @@ -30,7 +30,7 @@ QRollEffect::*; QSharedDoubleBufferCleaner::*; QSmSocketReceiver::*; - QSpinBoxValidator::*; + TQSpinBoxValidator::*; QSplitterHandle::*; TQSqlRecordShared::*; QSVChildRec::*; diff --git a/src/sql/tqeditorfactory.cpp b/src/sql/tqeditorfactory.cpp index 00f625b55..76fa71996 100644 --- a/src/sql/tqeditorfactory.cpp +++ b/src/sql/tqeditorfactory.cpp @@ -40,9 +40,9 @@ #include "ntqcleanuphandler.h" #include "tqlabel.h" -#include "ntqlineedit.h" -#include "ntqspinbox.h" -#include "ntqcombobox.h" +#include "tqlineedit.h" +#include "tqspinbox.h" +#include "tqcombobox.h" #include "tqeditorfactory.h" #include "tqdatetimeedit.h" diff --git a/src/sql/tqsqleditorfactory.cpp b/src/sql/tqsqleditorfactory.cpp index cf4944ae4..31d9108f2 100644 --- a/src/sql/tqsqleditorfactory.cpp +++ b/src/sql/tqsqleditorfactory.cpp @@ -45,9 +45,9 @@ #include "tqsqlfield.h" #include "ntqcleanuphandler.h" #include "tqlabel.h" -#include "ntqlineedit.h" -#include "ntqspinbox.h" -#include "ntqcombobox.h" +#include "tqlineedit.h" +#include "tqspinbox.h" +#include "tqcombobox.h" #include "tqdatetimeedit.h" /*! diff --git a/src/styles/qcommonstyle.cpp b/src/styles/qcommonstyle.cpp index 5f16b5b0e..7b6e475f3 100644 --- a/src/styles/qcommonstyle.cpp +++ b/src/styles/qcommonstyle.cpp @@ -48,27 +48,27 @@ #include "tqpainter.h" #include "ntqdrawutil.h" #include "tqpixmap.h" -#include "ntqpushbutton.h" +#include "tqpushbutton.h" #include "ntqtabbar.h" #include "ntqtabwidget.h" -#include "ntqlineedit.h" -#include "ntqscrollbar.h" +#include "tqlineedit.h" +#include "tqscrollbar.h" #include "tqtoolbutton.h" #include "tqtoolbar.h" -#include "ntqcombobox.h" +#include "tqcombobox.h" #include "ntqdockarea.h" #include "ntqheader.h" -#include "ntqspinbox.h" +#include "tqspinbox.h" #include "ntqrangecontrol.h" #include "ntqgroupbox.h" -#include "ntqslider.h" +#include "tqslider.h" #include "ntqlistview.h" -#include "ntqcheckbox.h" -#include "ntqradiobutton.h" +#include "tqcheckbox.h" +#include "tqradiobutton.h" #include "tqbitmap.h" #include "ntqprogressbar.h" #include "ntqlistbox.h" -#include "private/qdialogbuttons_p.h" +#include "private/tqdialogbuttons_p.h" #include #include #include "../widgets/qtitlebar_p.h" diff --git a/src/styles/qinterlacestyle.cpp b/src/styles/qinterlacestyle.cpp index 43917bd27..7f4838c80 100644 --- a/src/styles/qinterlacestyle.cpp +++ b/src/styles/qinterlacestyle.cpp @@ -50,10 +50,10 @@ #include "tqpalette.h" // for now #include "tqwidget.h" #include "tqlabel.h" -#include "ntqpushbutton.h" +#include "tqpushbutton.h" #include "tqwidget.h" #include "ntqrangecontrol.h" -#include "ntqscrollbar.h" +#include "tqscrollbar.h" #include "ntqlistbox.h" #include diff --git a/src/styles/qmotifplusstyle.cpp b/src/styles/qmotifplusstyle.cpp index 4b0da7c8b..d37419b2e 100644 --- a/src/styles/qmotifplusstyle.cpp +++ b/src/styles/qmotifplusstyle.cpp @@ -47,15 +47,15 @@ #include "tqpainter.h" #include "tqpalette.h" #include "ntqframe.h" -#include "ntqpushbutton.h" -#include "ntqcheckbox.h" -#include "ntqradiobutton.h" -#include "ntqcombobox.h" -#include "ntqlineedit.h" -#include "ntqspinbox.h" -#include "ntqslider.h" +#include "tqpushbutton.h" +#include "tqcheckbox.h" +#include "tqradiobutton.h" +#include "tqcombobox.h" +#include "tqlineedit.h" +#include "tqspinbox.h" +#include "tqslider.h" #include "ntqdrawutil.h" -#include "ntqscrollbar.h" +#include "tqscrollbar.h" #include "ntqtabbar.h" #include "tqtoolbar.h" #include "ntqguardedptr.h" diff --git a/src/styles/qmotifstyle.cpp b/src/styles/qmotifstyle.cpp index 87d310127..55ff6666a 100644 --- a/src/styles/qmotifstyle.cpp +++ b/src/styles/qmotifstyle.cpp @@ -49,14 +49,14 @@ #include "tqpixmap.h" #include "tqpalette.h" #include "tqwidget.h" -#include "ntqpushbutton.h" -#include "ntqscrollbar.h" +#include "tqpushbutton.h" +#include "tqscrollbar.h" #include "ntqtabbar.h" #include "ntqtabwidget.h" #include "ntqlistview.h" #include "ntqsplitter.h" -#include "ntqslider.h" -#include "ntqcombobox.h" +#include "tqslider.h" +#include "tqcombobox.h" #include "ntqdockwindow.h" #include "ntqdockarea.h" #include "ntqprogressbar.h" diff --git a/src/styles/qplatinumstyle.cpp b/src/styles/qplatinumstyle.cpp index ee2823a26..721a480a7 100644 --- a/src/styles/qplatinumstyle.cpp +++ b/src/styles/qplatinumstyle.cpp @@ -43,14 +43,14 @@ #if !defined(TQT_NO_STYLE_PLATINUM) || defined(QT_PLUGIN) #include "ntqapplication.h" -#include "ntqcombobox.h" +#include "tqcombobox.h" #include "ntqdrawutil.h" #include "tqpainter.h" #include "tqpalette.h" #include "tqpixmap.h" -#include "ntqpushbutton.h" -#include "ntqscrollbar.h" -#include "ntqslider.h" +#include "tqpushbutton.h" +#include "tqscrollbar.h" +#include "tqslider.h" #include /*! diff --git a/src/styles/qsgistyle.cpp b/src/styles/qsgistyle.cpp index ef4a6183d..a69ef63b6 100644 --- a/src/styles/qsgistyle.cpp +++ b/src/styles/qsgistyle.cpp @@ -50,13 +50,13 @@ #include "tqpixmap.h" #include "tqpalette.h" #include "tqwidget.h" -#include "ntqpushbutton.h" -#include "ntqscrollbar.h" -#include "ntqcombobox.h" -#include "ntqslider.h" +#include "tqpushbutton.h" +#include "tqscrollbar.h" +#include "tqcombobox.h" +#include "tqslider.h" #include "tqtextedit.h" #include "tqtoolbar.h" -#include "ntqlineedit.h" +#include "tqlineedit.h" #include "tqmenubar.h" #include diff --git a/src/styles/qwindowsstyle.cpp b/src/styles/qwindowsstyle.cpp index 27437724f..23754f786 100644 --- a/src/styles/qwindowsstyle.cpp +++ b/src/styles/qwindowsstyle.cpp @@ -50,13 +50,13 @@ #include "tqwidget.h" #include "tqlabel.h" #include "tqimage.h" -#include "ntqpushbutton.h" -#include "ntqcombobox.h" +#include "tqpushbutton.h" +#include "tqcombobox.h" #include "ntqlistbox.h" #include "tqwidget.h" #include "ntqrangecontrol.h" -#include "ntqscrollbar.h" -#include "ntqslider.h" +#include "tqscrollbar.h" +#include "tqslider.h" #include "ntqtabwidget.h" #include "ntqtabbar.h" #include "ntqlistview.h" diff --git a/src/table/ntqtable.h b/src/table/ntqtable.h index dc2c2c0b8..baeb8bd82 100644 --- a/src/table/ntqtable.h +++ b/src/table/ntqtable.h @@ -42,7 +42,7 @@ #define TQTABLE_H #ifndef QT_H -#include "ntqscrollview.h" +#include "tqscrollview.h" #include "tqpixmap.h" #include "tqptrvector.h" #include "ntqheader.h" diff --git a/src/table/qtable.cpp b/src/table/qtable.cpp index ef4cffc19..d83827a92 100644 --- a/src/table/qtable.cpp +++ b/src/table/qtable.cpp @@ -49,14 +49,14 @@ #ifndef TQT_NO_TABLE #include -#include +#include #include #include #include #include #include -#include -#include +#include +#include #include #include #include @@ -1695,7 +1695,7 @@ TQSize TQCheckTableItem::sizeHint() const 1, although row and column numbers within TQTable begin at 0.) If you want to use mouse tracking call setMouseTracking( TRUE ) on - the \e viewport; (see \link ntqscrollview.html#allviews + the \e viewport; (see \link tqscrollview.html#allviews TQScrollView\endlink). \img qtableitems.png Table Items diff --git a/src/tools/qfeatures.txt b/src/tools/qfeatures.txt index 89917cbec..c13fc7bd2 100644 --- a/src/tools/qfeatures.txt +++ b/src/tools/qfeatures.txt @@ -904,7 +904,7 @@ SeeAlso: ??? Feature: LCDNUMBER Section: Widgets Requires: FRAME -Name: QLCDNumber +Name: TQLCDNumber SeeAlso: ??? Feature: ACTION @@ -916,7 +916,7 @@ SeeAlso: ??? Feature: COMBOBOX Section: Widgets Requires: LISTBOX LINEEDIT POPUPMENU -Name: QComboBox +Name: TQComboBox SeeAlso: ??? Feature: LISTVIEW diff --git a/src/widgets/ntqcheckbox.h b/src/widgets/ntqcheckbox.h deleted file mode 100644 index 4a63e4b4a..000000000 --- a/src/widgets/ntqcheckbox.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Definition of TQCheckBox class -** -** Created : 940222 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQCHECKBOX_H -#define TQCHECKBOX_H - -#ifndef QT_H -#include "ntqbutton.h" -#endif // QT_H - -#ifndef TQT_NO_CHECKBOX - -class TQ_EXPORT TQCheckBox : public TQButton -{ - TQ_OBJECT - TQ_PROPERTY( bool checked READ isChecked WRITE setChecked ) - TQ_PROPERTY( bool tristate READ isTristate WRITE setTristate ) - TQ_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true ) - -public: - TQCheckBox( TQWidget *parent, const char* name=0 ); - TQCheckBox( const TQString &text, TQWidget *parent, const char* name=0 ); - - bool isChecked() const; - - void setNoChange(); - - void setTristate(bool y=TRUE); - bool isTristate() const; - - TQSize sizeHint() const; - -public slots: - void setChecked( bool check ); - -protected: - void resizeEvent( TQResizeEvent* ); - void drawButton( TQPainter * ); - void drawButtonLabel( TQPainter * ); - void updateMask(); - bool hitButton( const TQPoint &pos ) const; -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQCheckBox( const TQCheckBox & ); - TQCheckBox &operator=( const TQCheckBox & ); -#endif -}; - - -inline bool TQCheckBox::isChecked() const -{ return isOn(); } - -inline void TQCheckBox::setChecked( bool check ) -{ setOn( check ); } - - -#endif // TQT_NO_CHECKBOX - -#endif // TQCHECKBOX_H diff --git a/src/widgets/ntqcombobox.h b/src/widgets/ntqcombobox.h deleted file mode 100644 index 296148549..000000000 --- a/src/widgets/ntqcombobox.h +++ /dev/null @@ -1,206 +0,0 @@ -/********************************************************************** -** -** Definition of TQComboBox class -** -** Created : 950426 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQCOMBOBOX_H -#define TQCOMBOBOX_H - -#ifndef QT_H -#include "tqwidget.h" -#endif // QT_H - -#ifndef TQT_NO_COMBOBOX - - -class TQStrList; -class TQStringList; -class TQLineEdit; -class TQValidator; -class TQListBox; -class TQComboBoxData; -class TQWheelEvent; - -class TQ_EXPORT TQComboBox : public TQWidget -{ - TQ_OBJECT - TQ_ENUMS( Policy ) - TQ_PROPERTY( bool editable READ editable WRITE setEditable ) - TQ_PROPERTY( int count READ count ) - TQ_PROPERTY( TQString currentText READ currentText WRITE setCurrentText DESIGNABLE false ) - TQ_PROPERTY( int currentItem READ currentItem WRITE setCurrentItem ) - TQ_PROPERTY( bool autoResize READ autoResize WRITE setAutoResize DESIGNABLE false ) - TQ_PROPERTY( int sizeLimit READ sizeLimit WRITE setSizeLimit ) - TQ_PROPERTY( int maxCount READ maxCount WRITE setMaxCount ) - TQ_PROPERTY( Policy insertionPolicy READ insertionPolicy WRITE setInsertionPolicy ) - TQ_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion ) - TQ_PROPERTY( bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled ) - TQ_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true ) - -public: - TQComboBox( TQWidget* parent=0, const char* name=0 ); - TQComboBox( bool rw, TQWidget* parent=0, const char* name=0 ); - ~TQComboBox(); - - int count() const; - - void insertStringList( const TQStringList &, int index=-1 ); - void insertStrList( const TQStrList &, int index=-1 ); - void insertStrList( const TQStrList *, int index=-1 ); - void insertStrList( const char **, int numStrings=-1, int index=-1); - - void insertItem( const TQString &text, int index=-1 ); - void insertItem( const TQPixmap &pixmap, int index=-1 ); - void insertItem( const TQPixmap &pixmap, const TQString &text, int index=-1 ); - - void removeItem( int index ); - - int currentItem() const; - virtual void setCurrentItem( int index ); - - TQString currentText() const; - virtual void setCurrentText( const TQString& ); - - TQString text( int index ) const; - const TQPixmap *pixmap( int index ) const; - - void changeItem( const TQString &text, int index ); - void changeItem( const TQPixmap &pixmap, int index ); - void changeItem( const TQPixmap &pixmap, const TQString &text, int index ); - - bool autoResize() const; - virtual void setAutoResize( bool ); - TQSize sizeHint() const; - - void setPalette( const TQPalette & ); - void setFont( const TQFont & ); - void setEnabled( bool ); - - virtual void setSizeLimit( int ); - int sizeLimit() const; - - virtual void setMaxCount( int ); - int maxCount() const; - - enum Policy { NoInsertion, AtTop, AtCurrent, AtBottom, - AfterCurrent, BeforeCurrent }; - - virtual void setInsertionPolicy( Policy policy ); - Policy insertionPolicy() const; - - virtual void setValidator( const TQValidator * ); - const TQValidator * validator() const; - - virtual void setListBox( TQListBox * ); - TQListBox * listBox() const; - - virtual void setLineEdit( TQLineEdit *edit ); - TQLineEdit* lineEdit() const; - - virtual void setAutoCompletion( bool ); - bool autoCompletion() const; - - bool eventFilter( TQObject *object, TQEvent *event ); - - void setDuplicatesEnabled( bool enable ); - bool duplicatesEnabled() const; - - bool editable() const; - void setEditable( bool ); - - virtual void popup(); - - void hide(); - -public slots: - void clear(); - void clearValidator(); - void clearEdit(); - virtual void setEditText( const TQString &); - -signals: - void activated( int index ); - void highlighted( int index ); - void activated( const TQString &); - void highlighted( const TQString &); - void textChanged( const TQString &); - -private slots: - void internalActivate( int ); - void internalHighlight( int ); - void internalClickTimeout(); - void returnPressed(); - -protected: - void paintEvent( TQPaintEvent * ); - void resizeEvent( TQResizeEvent * ); - void mousePressEvent( TQMouseEvent * ); - void mouseMoveEvent( TQMouseEvent * ); - void mouseReleaseEvent( TQMouseEvent * ); - void mouseDoubleClickEvent( TQMouseEvent * ); - void keyPressEvent( TQKeyEvent *e ); - void focusInEvent( TQFocusEvent *e ); - void focusOutEvent( TQFocusEvent *e ); -#ifndef TQT_NO_WHEELEVENT - void wheelEvent( TQWheelEvent *e ); -#endif - void styleChange( TQStyle& ); - - void updateMask(); - -private: - void setUpListBox(); - void setUpLineEdit(); - void popDownListBox(); - void reIndex(); - void currentChanged(); - int completionIndex( const TQString &, int ) const; - - TQComboBoxData *d; - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQComboBox( const TQComboBox & ); - TQComboBox &operator=( const TQComboBox & ); -#endif -}; - - -#endif // TQT_NO_COMBOBOX - -#endif // TQCOMBOBOX_H diff --git a/src/widgets/ntqdial.h b/src/widgets/ntqdial.h deleted file mode 100644 index 7baf98e53..000000000 --- a/src/widgets/ntqdial.h +++ /dev/null @@ -1,153 +0,0 @@ -/**************************************************************************** -** -** Definition of the dial widget -** -** Created : 990104 -** -** Copyright (C) 1999-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - - -#ifndef TQDIAL_H -#define TQDIAL_H - -#ifndef QT_H -#include "tqwidget.h" -#include "ntqrangecontrol.h" -#endif // QT_H - -#ifndef TQT_NO_DIAL - -class TQDialPrivate; - -class TQ_EXPORT TQDial: public TQWidget, public TQRangeControl -{ - TQ_OBJECT - TQ_PROPERTY( bool tracking READ tracking WRITE setTracking ) - TQ_PROPERTY( bool wrapping READ wrapping WRITE setWrapping ) - TQ_PROPERTY( int notchSize READ notchSize ) - TQ_PROPERTY( double notchTarget READ notchTarget WRITE setNotchTarget ) - TQ_PROPERTY( bool notchesVisible READ notchesVisible WRITE setNotchesVisible ) - TQ_PROPERTY( int minValue READ minValue WRITE setMinValue ) - TQ_PROPERTY( int maxValue READ maxValue WRITE setMaxValue ) - TQ_PROPERTY( int lineStep READ lineStep WRITE setLineStep ) - TQ_PROPERTY( int pageStep READ pageStep WRITE setPageStep ) - TQ_PROPERTY( int value READ value WRITE setValue ) - -public: - TQDial( TQWidget* parent=0, const char* name=0, WFlags f = 0 ); - TQDial( int minValue, int maxValue, int pageStep, int value, - TQWidget* parent=0, const char* name=0 ); - ~TQDial(); - - bool tracking() const; - - bool wrapping() const; - - int notchSize() const; - - virtual void setNotchTarget( double ); - double notchTarget() const; - - bool notchesVisible() const; - - TQSize sizeHint() const; - TQSize minimumSizeHint() const; - - int minValue() const; - int maxValue() const; - void setMinValue( int ); - void setMaxValue( int ); - int lineStep() const; - int pageStep() const; - void setLineStep( int ); - void setPageStep( int ); - int value() const; - -public slots: - virtual void setValue( int ); - void addLine(); - void subtractLine(); - void addPage(); - void subtractPage(); - virtual void setNotchesVisible( bool b ); - virtual void setWrapping( bool on ); - virtual void setTracking( bool enable ); - -signals: - void valueChanged( int value ); - void dialPressed(); - void dialMoved( int value ); - void dialReleased(); - -protected: - void resizeEvent( TQResizeEvent * ); - void paintEvent( TQPaintEvent * ); - - void keyPressEvent( TQKeyEvent * ); - void mousePressEvent( TQMouseEvent * ); - void mouseReleaseEvent( TQMouseEvent * ); - void mouseMoveEvent( TQMouseEvent * ); -#ifndef TQT_NO_WHEELEVENT - void wheelEvent( TQWheelEvent * ); -#endif - void focusInEvent( TQFocusEvent * ); - void focusOutEvent( TQFocusEvent * ); - - void valueChange(); - void rangeChange(); - - virtual void repaintScreen( const TQRect *cr = 0 ); - -private: - TQDialPrivate * d; - - int valueFromPoint( const TQPoint & ) const; - double angle( const TQPoint &, const TQPoint & ) const; - TQPointArray calcArrow( double &a ) const; - TQRect calcDial() const; - int calcBigLineSize() const; - void calcLines(); - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQDial( const TQDial & ); - TQDial &operator=( const TQDial & ); -#endif - -}; - -#endif // TQT_NO_DIAL - -#endif diff --git a/src/widgets/ntqgridview.h b/src/widgets/ntqgridview.h index 6a8a3c182..1ec47a823 100644 --- a/src/widgets/ntqgridview.h +++ b/src/widgets/ntqgridview.h @@ -42,7 +42,7 @@ #define TQGRIDVIEW_H #ifndef QT_H -#include "ntqscrollview.h" +#include "tqscrollview.h" #endif // QT_H #ifndef TQT_NO_GRIDVIEW diff --git a/src/widgets/ntqlcdnumber.h b/src/widgets/ntqlcdnumber.h deleted file mode 100644 index e74de7cb6..000000000 --- a/src/widgets/ntqlcdnumber.h +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** -** -** Definition of TQLCDNumber class -** -** Created : 940518 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQLCDNUMBER_H -#define TQLCDNUMBER_H - -#ifndef QT_H -#include "ntqframe.h" -#include "tqbitarray.h" -#endif // QT_H - -#ifndef TQT_NO_LCDNUMBER - - -class TQLCDNumberPrivate; - -class TQ_EXPORT TQLCDNumber : public TQFrame // LCD number widget -{ - TQ_OBJECT - TQ_ENUMS( Mode SegmentStyle ) - TQ_PROPERTY( bool smallDecimalPoint READ smallDecimalPoint WRITE setSmallDecimalPoint ) - TQ_PROPERTY( int numDigits READ numDigits WRITE setNumDigits ) - TQ_PROPERTY( Mode mode READ mode WRITE setMode ) - TQ_PROPERTY( SegmentStyle segmentStyle READ segmentStyle WRITE setSegmentStyle ) - TQ_PROPERTY( double value READ value WRITE display ) - TQ_PROPERTY( int intValue READ intValue WRITE display ) - -public: - TQLCDNumber( TQWidget* parent=0, const char* name=0 ); - TQLCDNumber( uint numDigits, TQWidget* parent=0, const char* name=0 ); - ~TQLCDNumber(); - - enum Mode { Hex, Dec, Oct, Bin, HEX = Hex, DEC = Dec, OCT = Oct, - BIN = Bin }; - enum SegmentStyle { Outline, Filled, Flat }; - - bool smallDecimalPoint() const; - - int numDigits() const; - virtual void setNumDigits( int nDigits ); - - bool checkOverflow( double num ) const; - bool checkOverflow( int num ) const; - - Mode mode() const; - virtual void setMode( Mode ); - - SegmentStyle segmentStyle() const; - virtual void setSegmentStyle( SegmentStyle ); - - double value() const; - int intValue() const; - - TQSize sizeHint() const; - -public slots: - void display( const TQString &str ); - void display( int num ); - void display( double num ); - virtual void setHexMode(); - virtual void setDecMode(); - virtual void setOctMode(); - virtual void setBinMode(); - virtual void setSmallDecimalPoint( bool ); - -signals: - void overflow(); - -protected: - void drawContents( TQPainter * ); - -private: - void init(); - void internalDisplay( const TQString &); - void internalSetString( const TQString& s ); - void drawString( const TQString& s, TQPainter &, TQBitArray * = 0, - bool = TRUE ); - //void drawString( const TQString &, TQPainter &, TQBitArray * = 0 ) const; - void drawDigit( const TQPoint &, TQPainter &, int, char, - char = ' ' ); - void drawSegment( const TQPoint &, char, TQPainter &, int, bool = FALSE ); - - int ndigits; - double val; - uint base : 2; - uint smallPoint : 1; - uint fill : 1; - uint shadow : 1; - TQString digitStr; - TQBitArray points; - TQLCDNumberPrivate * d; - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQLCDNumber( const TQLCDNumber & ); - TQLCDNumber &operator=( const TQLCDNumber & ); -#endif -}; - -inline bool TQLCDNumber::smallDecimalPoint() const -{ return (bool)smallPoint; } - -inline int TQLCDNumber::numDigits() const -{ return ndigits; } - - -#endif // TQT_NO_LCDNUMBER - -#endif // TQLCDNUMBER_H diff --git a/src/widgets/ntqlineedit.h b/src/widgets/ntqlineedit.h deleted file mode 100644 index f5bf18c68..000000000 --- a/src/widgets/ntqlineedit.h +++ /dev/null @@ -1,218 +0,0 @@ -/********************************************************************** -** -** Definition of TQLineEdit widget class -** -** Created : 941011 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQLINEEDIT_H -#define TQLINEEDIT_H - -struct TQLineEditPrivate; - -class TQValidator; -class TQPopupMenu; - -#ifndef QT_H -#include "ntqframe.h" -#include "tqstring.h" -#endif // QT_H - -#ifndef TQT_NO_LINEEDIT - -class TQTextParagraph; -class TQTextCursor; - -class TQ_EXPORT TQLineEdit : public TQFrame -{ - TQ_OBJECT - TQ_ENUMS( EchoMode ) - TQ_PROPERTY( TQString text READ text WRITE setText ) - TQ_PROPERTY( int maxLength READ maxLength WRITE setMaxLength ) - TQ_PROPERTY( bool frame READ frame WRITE setFrame ) - TQ_PROPERTY( EchoMode echoMode READ echoMode WRITE setEchoMode ) - TQ_PROPERTY( TQString displayText READ displayText ) - TQ_PROPERTY( int cursorPosition READ cursorPosition WRITE setCursorPosition ) - TQ_PROPERTY( Alignment alignment READ alignment WRITE setAlignment ) - TQ_PROPERTY( bool edited READ edited WRITE setEdited DESIGNABLE false ) - TQ_PROPERTY( bool modified READ isModified ) - TQ_PROPERTY( bool hasSelectedText READ hasSelectedText ) - TQ_PROPERTY( TQString selectedText READ selectedText ) - TQ_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled ) - TQ_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly ) - TQ_PROPERTY( bool undoAvailable READ isUndoAvailable ) - TQ_PROPERTY( bool redoAvailable READ isRedoAvailable ) - TQ_PROPERTY( TQString inputMask READ inputMask WRITE setInputMask ) - TQ_PROPERTY( bool acceptableInput READ hasAcceptableInput ) - -public: - TQLineEdit( TQWidget* parent, const char* name=0 ); - TQLineEdit( const TQString &, TQWidget* parent, const char* name=0 ); - TQLineEdit( const TQString &, const TQString &, TQWidget* parent, const char* name=0 ); - ~TQLineEdit(); - - TQString text() const; - - TQString displayText() const; - - int maxLength() const; - - bool frame() const; - - enum EchoMode { Normal, NoEcho, Password, PasswordThreeStars }; - EchoMode echoMode() const; - - bool isReadOnly() const; - - const TQValidator * validator() const; - - TQSize sizeHint() const; - TQSize minimumSizeHint() const; - - int cursorPosition() const; - bool validateAndSet( const TQString &, int, int, int ); // obsolete - - int alignment() const; - - void cursorForward( bool mark, int steps = 1 ); - void cursorBackward( bool mark, int steps = 1 ); - void cursorWordForward( bool mark ); - void cursorWordBackward( bool mark ); - void backspace(); - void del(); - void home( bool mark ); - void end( bool mark ); - - bool isModified() const; - void clearModified(); - - bool edited() const; // obsolete, use isModified() - void setEdited( bool ); // obsolete, use clearModified() - - bool hasSelectedText() const; - TQString selectedText() const; - int selectionStart() const; - - bool isUndoAvailable() const; - bool isRedoAvailable() const; - - bool dragEnabled() const; - - TQString inputMask() const; - void setInputMask( const TQString &inputMask ); - bool hasAcceptableInput() const; - -public slots: - virtual void setText( const TQString &); - virtual void selectAll(); - virtual void deselect(); - virtual void clearValidator(); - virtual void insert( const TQString &); - virtual void clear(); - virtual void undo(); - virtual void redo(); - virtual void setMaxLength( int ); - virtual void setFrame( bool ); - virtual void setEchoMode( EchoMode ); - virtual void setReadOnly( bool ); - virtual void setValidator( const TQValidator * ); - virtual void setFont( const TQFont & ); - virtual void setPalette( const TQPalette & ); - virtual void setSelection( int, int ); - virtual void setCursorPosition( int ); - virtual void setAlignment( int flag ); -#ifndef TQT_NO_CLIPBOARD - virtual void cut(); - virtual void copy() const; - virtual void paste(); -#endif - virtual void setDragEnabled( bool b ); - -signals: - void textChanged( const TQString &); - void returnPressed(); - void lostFocus(); - void selectionChanged(); - -protected: - bool event( TQEvent * ); - void mousePressEvent( TQMouseEvent * ); - void mouseMoveEvent( TQMouseEvent * ); - void mouseReleaseEvent( TQMouseEvent * ); - void mouseDoubleClickEvent( TQMouseEvent * ); - void keyPressEvent( TQKeyEvent * ); - void imStartEvent( TQIMEvent * ); - void imComposeEvent( TQIMEvent * ); - void imEndEvent( TQIMEvent * ); - void focusInEvent( TQFocusEvent * ); - void focusOutEvent( TQFocusEvent * ); - void resizeEvent( TQResizeEvent * ); - void drawContents( TQPainter * ); -#ifndef TQT_NO_DRAGANDDROP - void dragEnterEvent( TQDragEnterEvent * ); - void dragMoveEvent( TQDragMoveEvent *e ); - void dragLeaveEvent( TQDragLeaveEvent *e ); - void dropEvent( TQDropEvent * ); -#endif - void contextMenuEvent( TQContextMenuEvent * ); - bool sendMouseEventToInputContext( TQMouseEvent *e ); - virtual TQPopupMenu *createPopupMenu(); - void windowActivationChange( bool ); - -private slots: - void clipboardChanged(); - -public: - void setPasswordChar( TQChar c ); // internal obsolete - TQChar passwordChar() const; // obsolete internal - int characterAt( int, TQChar* ) const; // obsolete - bool getSelection( int *, int * ); // obsolete - -private: - friend struct TQLineEditPrivate; - TQLineEditPrivate * d; - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQLineEdit( const TQLineEdit & ); - TQLineEdit &operator=( const TQLineEdit & ); -#endif -}; - - -#endif // TQT_NO_LINEEDIT - -#endif // TQLINEEDIT_H diff --git a/src/widgets/ntqlistbox.h b/src/widgets/ntqlistbox.h index 39a9b75de..cfc2b7682 100644 --- a/src/widgets/ntqlistbox.h +++ b/src/widgets/ntqlistbox.h @@ -42,7 +42,7 @@ #define TQLISTBOX_H #ifndef QT_H -#include "ntqscrollview.h" +#include "tqscrollview.h" #include "tqpixmap.h" #endif // QT_H diff --git a/src/widgets/ntqlistview.h b/src/widgets/ntqlistview.h index b46513372..45eb89a8e 100644 --- a/src/widgets/ntqlistview.h +++ b/src/widgets/ntqlistview.h @@ -42,7 +42,7 @@ #define TQLISTVIEW_H #ifndef QT_H -#include "ntqscrollview.h" +#include "tqscrollview.h" #endif // QT_H #ifndef TQT_NO_LISTVIEW diff --git a/src/widgets/ntqpushbutton.h b/src/widgets/ntqpushbutton.h deleted file mode 100644 index 13b76e9fe..000000000 --- a/src/widgets/ntqpushbutton.h +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************** -** -** Definition of TQPushButton class -** -** Created : 940221 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQPUSHBUTTON_H -#define TQPUSHBUTTON_H - -#ifndef QT_H -#include "ntqbutton.h" -#include "tqiconset.h" -#endif // QT_H - -#ifndef TQT_NO_PUSHBUTTON -class TQPushButtonPrivate; -class TQPopupMenu; - -class TQ_EXPORT TQPushButton : public TQButton -{ - TQ_OBJECT - - TQ_PROPERTY( bool autoDefault READ autoDefault WRITE setAutoDefault ) - TQ_PROPERTY( bool default READ isDefault WRITE setDefault ) - TQ_PROPERTY( bool menuButton READ isMenuButton DESIGNABLE false ) - TQ_PROPERTY( TQIconSet iconSet READ iconSet WRITE setIconSet ) - TQ_OVERRIDE( bool toggleButton WRITE setToggleButton ) - TQ_OVERRIDE( bool on WRITE setOn ) - TQ_PROPERTY( bool flat READ isFlat WRITE setFlat ) - TQ_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true ) - -public: - TQPushButton( TQWidget *parent, const char* name=0 ); - TQPushButton( const TQString &text, TQWidget *parent, const char* name=0 ); -#ifndef TQT_NO_ICONSET - TQPushButton( const TQIconSet& icon, const TQString &text, TQWidget *parent, const char* name=0 ); -#endif - ~TQPushButton(); - - TQSize sizeHint() const; - - void move( int x, int y ); - void move( const TQPoint &p ); - void resize( int w, int h ); - void resize( const TQSize & ); - void setGeometry( int x, int y, int w, int h ); - - void setGeometry( const TQRect & ); - - void setToggleButton( bool ); - - bool autoDefault() const { return autoDefButton; } - virtual void setAutoDefault( bool autoDef ); - bool isDefault() const { return defButton; } - virtual void setDefault( bool def ); - - virtual void setIsMenuButton( bool enable ) { // obsolete functions - if ( (bool)hasMenuArrow == enable ) - return; - hasMenuArrow = enable ? 1 : 0; - update(); - updateGeometry(); - } - bool isMenuButton() const { return hasMenuArrow; } - -#ifndef TQT_NO_POPUPMENU - void setPopup( TQPopupMenu* popup ); - TQPopupMenu* popup() const; -#endif -#ifndef TQT_NO_ICONSET - void setIconSet( const TQIconSet& ); - TQIconSet* iconSet() const; -#endif - void setFlat( bool ); - bool isFlat() const; - -public slots: - virtual void setOn( bool ); - -protected: - void drawButton( TQPainter * ); - void drawButtonLabel( TQPainter * ); - void focusInEvent( TQFocusEvent * ); - void focusOutEvent( TQFocusEvent * ); - void resizeEvent( TQResizeEvent * ); - void updateMask(); -private slots: -#ifndef TQT_NO_POPUPMENU - void popupPressed(); -#endif -private: - void init(); - - uint autoDefButton : 1; - uint defButton : 1; - uint flt : 1; - uint reserved : 1; // UNUSED - uint lastEnabled : 1; // UNUSED - uint hasMenuArrow : 1; - - TQPushButtonPrivate* d; - - friend class TQDialog; - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQPushButton( const TQPushButton & ); - TQPushButton &operator=( const TQPushButton & ); -#endif -}; - - -#endif // TQT_NO_PUSHBUTTON - -#endif // TQPUSHBUTTON_H diff --git a/src/widgets/ntqradiobutton.h b/src/widgets/ntqradiobutton.h deleted file mode 100644 index 1c7c0ae34..000000000 --- a/src/widgets/ntqradiobutton.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Definition of TQRadioButton class -** -** Created : 940222 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQRADIOBUTTON_H -#define TQRADIOBUTTON_H - -#ifndef QT_H -#include "ntqbutton.h" -#endif // QT_H - -#ifndef TQT_NO_RADIOBUTTON - -class TQ_EXPORT TQRadioButton : public TQButton -{ - TQ_OBJECT - TQ_PROPERTY( bool checked READ isChecked WRITE setChecked ) - TQ_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true ) - -public: - TQRadioButton( TQWidget *parent, const char* name=0 ); - TQRadioButton( const TQString &text, TQWidget *parent, const char* name=0 ); - - bool isChecked() const; - - TQSize sizeHint() const; - -public slots: - virtual void setChecked( bool check ); - -protected: - bool hitButton( const TQPoint & ) const; - void drawButton( TQPainter * ); - void drawButtonLabel( TQPainter * ); - void updateMask(); - - void resizeEvent( TQResizeEvent* ); - -private: - void init(); - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQRadioButton( const TQRadioButton & ); - TQRadioButton &operator=( const TQRadioButton & ); -#endif -}; - - -inline bool TQRadioButton::isChecked() const -{ return isOn(); } - -#endif // TQT_NO_RADIOBUTTON - -#endif // TQRADIOBUTTON_H diff --git a/src/widgets/ntqscrollbar.h b/src/widgets/ntqscrollbar.h deleted file mode 100644 index 6a298c96f..000000000 --- a/src/widgets/ntqscrollbar.h +++ /dev/null @@ -1,197 +0,0 @@ -/**************************************************************************** -** -** Definition of TQScrollBar class -** -** Created : 940427 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQSCROLLBAR_H -#define TQSCROLLBAR_H - -class TQTimer; - -#ifndef QT_H -#include "tqwidget.h" -#include "ntqrangecontrol.h" -#endif // QT_H - -#ifndef TQT_NO_SCROLLBAR - -class TQ_EXPORT TQScrollBar : public TQWidget, public TQRangeControl -{ - TQ_OBJECT - TQ_PROPERTY( int minValue READ minValue WRITE setMinValue ) - TQ_PROPERTY( int maxValue READ maxValue WRITE setMaxValue ) - TQ_PROPERTY( int lineStep READ lineStep WRITE setLineStep ) - TQ_PROPERTY( int pageStep READ pageStep WRITE setPageStep ) - TQ_PROPERTY( int value READ value WRITE setValue ) - TQ_PROPERTY( bool tracking READ tracking WRITE setTracking ) - TQ_PROPERTY( bool draggingSlider READ draggingSlider ) - TQ_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) - -public: - TQScrollBar( TQWidget *parent, const char* name = 0 ); - TQScrollBar( Orientation, TQWidget *parent, const char* name = 0 ); - TQScrollBar( int minValue, int maxValue, int lineStep, int pageStep, - int value, Orientation, TQWidget *parent, const char* name = 0 ); - ~TQScrollBar(); - - virtual void setOrientation( Orientation ); - Orientation orientation() const; - virtual void setTracking( bool enable ); - bool tracking() const; - bool draggingSlider() const; - - virtual void setPalette( const TQPalette & ); - virtual TQSize sizeHint() const; - virtual void setSizePolicy( TQSizePolicy sp ); - void setSizePolicy( TQSizePolicy::SizeType hor, TQSizePolicy::SizeType ver, bool hfw = FALSE ); - - int minValue() const; - int maxValue() const; - void setMinValue( int ); - void setMaxValue( int ); - int lineStep() const; - int pageStep() const; - void setLineStep( int ); - void setPageStep( int ); - int value() const; - - int sliderStart() const; - TQRect sliderRect() const; - -public slots: - void setValue( int ); - -signals: - void valueChanged( int value ); - void sliderPressed(); - void sliderMoved( int value ); - void sliderReleased(); - void nextLine(); - void prevLine(); - void nextPage(); - void prevPage(); - -protected: -#ifndef TQT_NO_WHEELEVENT - void wheelEvent( TQWheelEvent * ); -#endif - void keyPressEvent( TQKeyEvent * ); - void resizeEvent( TQResizeEvent * ); - void paintEvent( TQPaintEvent * ); - - void mousePressEvent( TQMouseEvent * ); - void mouseReleaseEvent( TQMouseEvent * ); - void mouseMoveEvent( TQMouseEvent * ); - void contextMenuEvent( TQContextMenuEvent * ); - void hideEvent( TQHideEvent* ); - - void valueChange(); - void stepChange(); - void rangeChange(); - - void styleChange( TQStyle& ); - -private slots: - void doAutoRepeat(); - -private: - void init(); - void positionSliderFromValue(); - int calculateValueFromSlider() const; - - void startAutoRepeat(); - void stopAutoRepeat(); - - int rangeValueToSliderPos( int val ) const; - int sliderPosToRangeValue( int val ) const; - - void action( int control ); - - void drawControls( uint controls, uint activeControl ) const; - void drawControls( uint controls, uint activeControl, - TQPainter *p ) const; - - uint pressedControl; - bool track; - bool clickedAt; - Orientation orient; - - int slidePrevVal; - TQCOORD sliderPos; - TQCOORD clickOffset; - - TQTimer * repeater; - void * d; - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQScrollBar( const TQScrollBar & ); - TQScrollBar &operator=( const TQScrollBar & ); -#endif -}; - - -inline void TQScrollBar::setTracking( bool t ) -{ - track = t; -} - -inline bool TQScrollBar::tracking() const -{ - return track; -} - -inline TQScrollBar::Orientation TQScrollBar::orientation() const -{ - return orient; -} - -inline int TQScrollBar::sliderStart() const -{ - return sliderPos; -} - -inline void TQScrollBar::setSizePolicy( TQSizePolicy::SizeType hor, TQSizePolicy::SizeType ver, bool hfw ) -{ - TQWidget::setSizePolicy( hor, ver, hfw ); -} - - -#endif // TQT_NO_SCROLLBAR - -#endif // TQSCROLLBAR_H diff --git a/src/widgets/ntqscrollview.h b/src/widgets/ntqscrollview.h deleted file mode 100644 index c9dcc8846..000000000 --- a/src/widgets/ntqscrollview.h +++ /dev/null @@ -1,269 +0,0 @@ -/**************************************************************************** -** -** Definition of TQScrollView class -** -** Created : 970523 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ -#ifndef TQSCROLLVIEW_H -#define TQSCROLLVIEW_H - -#ifndef QT_H -#include "ntqframe.h" -#include "ntqscrollbar.h" -#endif // QT_H - -#ifndef TQT_NO_SCROLLVIEW - -class TQScrollViewData; - -class TQ_EXPORT TQScrollView : public TQFrame -{ - TQ_OBJECT - TQ_ENUMS( ResizePolicy ScrollBarMode ) - TQ_PROPERTY( ResizePolicy resizePolicy READ resizePolicy WRITE setResizePolicy ) - TQ_PROPERTY( ScrollBarMode vScrollBarMode READ vScrollBarMode WRITE setVScrollBarMode ) - TQ_PROPERTY( ScrollBarMode hScrollBarMode READ hScrollBarMode WRITE setHScrollBarMode ) - TQ_PROPERTY( int visibleWidth READ visibleWidth ) - TQ_PROPERTY( int visibleHeight READ visibleHeight ) - TQ_PROPERTY( int contentsWidth READ contentsWidth ) - TQ_PROPERTY( int contentsHeight READ contentsHeight ) - TQ_PROPERTY( int contentsX READ contentsX ) - TQ_PROPERTY( int contentsY READ contentsY ) -#ifndef TQT_NO_DRAGANDDROP - TQ_PROPERTY( bool dragAutoScroll READ dragAutoScroll WRITE setDragAutoScroll ) -#endif - -public: - TQScrollView(TQWidget* parent=0, const char* name=0, WFlags f=0); - ~TQScrollView(); - - enum ResizePolicy { Default, Manual, AutoOne, AutoOneFit }; - virtual void setResizePolicy( ResizePolicy ); - ResizePolicy resizePolicy() const; - - void styleChange( TQStyle & ); - void removeChild(TQWidget* child); - virtual void addChild( TQWidget* child, int x=0, int y=0 ); - virtual void moveChild( TQWidget* child, int x, int y ); - int childX(TQWidget* child); - int childY(TQWidget* child); - bool childIsVisible(TQWidget* child) { return child->isVisible(); } // obsolete functions - void showChild(TQWidget* child, bool yes=TRUE) { - if ( yes ) - child->show(); - else - child->hide(); - } - - enum ScrollBarMode { Auto, AlwaysOff, AlwaysOn }; - - ScrollBarMode vScrollBarMode() const; - virtual void setVScrollBarMode( ScrollBarMode ); - - ScrollBarMode hScrollBarMode() const; - virtual void setHScrollBarMode( ScrollBarMode ); - - TQWidget* cornerWidget() const; - virtual void setCornerWidget(TQWidget*); - - // ### 4.0: Consider providing a factory function for scrollbars - // (e.g. make the two following functions virtual) - TQScrollBar* horizontalScrollBar() const; - TQScrollBar* verticalScrollBar() const; - TQWidget* viewport() const; - TQWidget* clipper() const; - - int visibleWidth() const; - int visibleHeight() const; - - int contentsWidth() const; - int contentsHeight() const; - int contentsX() const; - int contentsY() const; - - void resize( int w, int h ); - void resize( const TQSize& ); - void show(); - - void updateContents( int x, int y, int w, int h ); - void updateContents( const TQRect& r ); - void updateContents(); - void repaintContents( int x, int y, int w, int h, bool erase=TRUE ); - void repaintContents( const TQRect& r, bool erase=TRUE ); - void repaintContents( bool erase=TRUE ); - void contentsToViewport( int x, int y, int& vx, int& vy ) const; - void viewportToContents( int vx, int vy, int& x, int& y ) const; - TQPoint contentsToViewport( const TQPoint& ) const; - TQPoint viewportToContents( const TQPoint& ) const; - void enableClipper( bool y ); - - void setStaticBackground( bool y ); - bool hasStaticBackground() const; - - TQSize viewportSize( int, int ) const; - TQSize sizeHint() const; - TQSize minimumSizeHint() const; - - void removeChild(TQObject* child); - - bool isHorizontalSliderPressed(); - bool isVerticalSliderPressed(); - -#ifndef TQT_NO_DRAGANDDROP - virtual void setDragAutoScroll( bool b ); - bool dragAutoScroll() const; -#endif - -signals: - void contentsMoving(int x, int y); - void horizontalSliderPressed(); - void horizontalSliderReleased(); - void verticalSliderPressed(); - void verticalSliderReleased(); - -public slots: - virtual void resizeContents( int w, int h ); - void scrollBy( int dx, int dy ); - virtual void setContentsPos( int x, int y ); - void ensureVisible(int x, int y); - void ensureVisible(int x, int y, int xmargin, int ymargin); - void center(int x, int y); - void center(int x, int y, float xmargin, float ymargin); - - void updateScrollBars(); // ### virtual in 4.0 - void setEnabled( bool enable ); - -protected: - virtual void drawContents(TQPainter*, int cx, int cy, int cw, int ch); - virtual void drawContentsOffset(TQPainter*, int ox, int oy, - int cx, int cy, int cw, int ch); - - - virtual void contentsMousePressEvent( TQMouseEvent* ); - virtual void contentsMouseReleaseEvent( TQMouseEvent* ); - virtual void contentsMouseDoubleClickEvent( TQMouseEvent* ); - virtual void contentsMouseMoveEvent( TQMouseEvent* ); -#ifndef TQT_NO_DRAGANDDROP - virtual void contentsDragEnterEvent( TQDragEnterEvent * ); - virtual void contentsDragMoveEvent( TQDragMoveEvent * ); - virtual void contentsDragLeaveEvent( TQDragLeaveEvent * ); - virtual void contentsDropEvent( TQDropEvent * ); -#endif -#ifndef TQT_NO_WHEELEVENT - virtual void contentsWheelEvent( TQWheelEvent * ); -#endif - virtual void contentsContextMenuEvent( TQContextMenuEvent * ); - - - virtual void viewportPaintEvent( TQPaintEvent* ); - virtual void viewportResizeEvent( TQResizeEvent* ); - virtual void viewportMousePressEvent( TQMouseEvent* ); - virtual void viewportMouseReleaseEvent( TQMouseEvent* ); - virtual void viewportMouseDoubleClickEvent( TQMouseEvent* ); - virtual void viewportMouseMoveEvent( TQMouseEvent* ); -#ifndef TQT_NO_DRAGANDDROP - virtual void viewportDragEnterEvent( TQDragEnterEvent * ); - virtual void viewportDragMoveEvent( TQDragMoveEvent * ); - virtual void viewportDragLeaveEvent( TQDragLeaveEvent * ); - virtual void viewportDropEvent( TQDropEvent * ); -#endif -#ifndef TQT_NO_WHEELEVENT - virtual void viewportWheelEvent( TQWheelEvent * ); -#endif - virtual void viewportContextMenuEvent( TQContextMenuEvent * ); - - void frameChanged(); - - virtual void setMargins(int left, int top, int right, int bottom); - int leftMargin() const; - int topMargin() const; - int rightMargin() const; - int bottomMargin() const; - - bool focusNextPrevChild( bool next ); - - virtual void setHBarGeometry(TQScrollBar& hbar, int x, int y, int w, int h); - virtual void setVBarGeometry(TQScrollBar& vbar, int x, int y, int w, int h); - - void resizeEvent(TQResizeEvent*); - void mousePressEvent( TQMouseEvent * ); - void mouseReleaseEvent( TQMouseEvent * ); - void mouseDoubleClickEvent( TQMouseEvent * ); - void mouseMoveEvent( TQMouseEvent * ); -#ifndef TQT_NO_WHEELEVENT - void wheelEvent( TQWheelEvent * ); -#endif - void contextMenuEvent( TQContextMenuEvent * ); - bool eventFilter( TQObject *, TQEvent *e ); - - void setCachedSizeHint( const TQSize &sh ) const; - TQSize cachedSizeHint() const; - void fontChange( const TQFont & ); - -private: - void drawContents( TQPainter* ); - void moveContents(int x, int y); - - TQScrollViewData* d; - -private slots: - void hslide(int); - void vslide(int); - void hbarIsPressed(); - void hbarIsReleased(); - void vbarIsPressed(); - void vbarIsReleased(); -#ifndef TQT_NO_DRAGANDDROP - void doDragAutoScroll(); - void startDragAutoScroll(); - void stopDragAutoScroll(); -#endif - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQScrollView( const TQScrollView & ); - TQScrollView &operator=( const TQScrollView & ); -#endif - void changeFrameRect(const TQRect&); - -public: - void disableSizeHintCaching(); - -}; - -#endif // TQT_NO_SCROLLVIEW - -#endif // TQSCROLLVIEW_H diff --git a/src/widgets/ntqslider.h b/src/widgets/ntqslider.h deleted file mode 100644 index af60245e3..000000000 --- a/src/widgets/ntqslider.h +++ /dev/null @@ -1,199 +0,0 @@ -/**************************************************************************** -** -** Definition of TQSlider class -** -** Created : 961019 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQSLIDER_H -#define TQSLIDER_H - -#ifndef QT_H -#include "tqwidget.h" -#include "ntqrangecontrol.h" -#endif // QT_H - -#ifndef TQT_NO_SLIDER - -struct TQSliderPrivate; - -class TQTimer; - -class TQ_EXPORT TQSlider : public TQWidget, public TQRangeControl -{ - TQ_OBJECT - TQ_ENUMS( TickSetting ) - TQ_PROPERTY( int minValue READ minValue WRITE setMinValue ) - TQ_PROPERTY( int maxValue READ maxValue WRITE setMaxValue ) - TQ_PROPERTY( int lineStep READ lineStep WRITE setLineStep ) - TQ_PROPERTY( int pageStep READ pageStep WRITE setPageStep ) - TQ_PROPERTY( int value READ value WRITE setValue ) - TQ_PROPERTY( bool tracking READ tracking WRITE setTracking ) - TQ_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) - TQ_PROPERTY( TickSetting tickmarks READ tickmarks WRITE setTickmarks ) - TQ_PROPERTY( int tickInterval READ tickInterval WRITE setTickInterval ) - -public: - enum TickSetting { NoMarks = 0, Above = 1, Left = Above, - Below = 2, Right = Below, Both = 3 }; - - TQSlider( TQWidget *parent, const char* name = 0 ); - TQSlider( Orientation, TQWidget *parent, const char* name = 0 ); - TQSlider( int minValue, int maxValue, int pageStep, int value, Orientation, - TQWidget *parent, const char* name = 0 ); - ~TQSlider(); - - virtual void setOrientation( Orientation ); - Orientation orientation() const; - virtual void setTracking( bool enable ); - bool tracking() const; - virtual void setPalette( const TQPalette & ); - - int sliderStart() const; - TQRect sliderRect() const; - TQSize sizeHint() const; - void setSizePolicy( TQSizePolicy sp ); - void setSizePolicy( TQSizePolicy::SizeType hor, TQSizePolicy::SizeType ver, bool hfw = FALSE ); - - TQSizePolicy sizePolicy() const; - TQSize minimumSizeHint() const; - - virtual void setTickmarks( TickSetting ); - TickSetting tickmarks() const { return ticks; } - - virtual void setTickInterval( int ); - int tickInterval() const { return tickInt; } - - int minValue() const; - int maxValue() const; - void setMinValue( int ); - void setMaxValue( int ); - int lineStep() const; - int pageStep() const; - void setLineStep( int ); - void setPageStep( int ); - int value() const; - -public slots: - virtual void setValue( int ); - void addStep(); - void subtractStep(); - void addLine(); - void subtractLine(); - -signals: - void valueChanged( int value ); - void sliderPressed(); - void sliderMoved( int value ); - void sliderReleased(); - -protected: - void resizeEvent( TQResizeEvent * ); - void paintEvent( TQPaintEvent * ); - - void keyPressEvent( TQKeyEvent * ); - void mousePressEvent( TQMouseEvent * ); - void mouseReleaseEvent( TQMouseEvent * ); - void mouseMoveEvent( TQMouseEvent * ); -#ifndef TQT_NO_WHEELEVENT - void wheelEvent( TQWheelEvent * ); -#endif - void focusInEvent( TQFocusEvent *e ); - void focusOutEvent( TQFocusEvent *e ); - - void styleChange( TQStyle& ); - - void valueChange(); - void rangeChange(); - -private slots: - void repeatTimeout(); - -private: - enum State { Idle, Dragging, TimingUp, TimingDown }; - - void init(); - int positionFromValue( int ) const; - int valueFromPosition( int ) const; - void moveSlider( int ); - void reallyMoveSlider( int ); - void resetState(); - int available() const; - int goodPart( const TQPoint& ) const; - void initTicks(); - - TQSliderPrivate *d; - TQTimer *timer; - TQCOORD sliderPos; - int sliderVal; - TQCOORD clickOffset; - State state; - bool track; - TQCOORD tickOffset; - TickSetting ticks; - int tickInt; - Orientation orient; - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQSlider( const TQSlider & ); - TQSlider &operator=( const TQSlider & ); -#endif -}; - -inline bool TQSlider::tracking() const -{ - return track; -} - -inline TQSlider::Orientation TQSlider::orientation() const -{ - return orient; -} - -inline int TQSlider::sliderStart() const -{ - return sliderPos; -} - -inline void TQSlider::setSizePolicy( TQSizePolicy::SizeType hor, TQSizePolicy::SizeType ver, bool hfw ) -{ - TQWidget::setSizePolicy( hor, ver, hfw ); -} - -#endif // TQT_NO_SLIDER - -#endif // TQSLIDER_H diff --git a/src/widgets/ntqspinbox.h b/src/widgets/ntqspinbox.h deleted file mode 100644 index 345857c74..000000000 --- a/src/widgets/ntqspinbox.h +++ /dev/null @@ -1,172 +0,0 @@ -/**************************************************************************** -** -** Definition of TQSpinBox widget class -** -** Created : 970101 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQSPINBOX_H -#define TQSPINBOX_H - -#ifndef QT_H -#include "tqwidget.h" -#include "ntqrangecontrol.h" -#endif // QT_H - -#ifndef TQT_NO_SPINBOX - -class TQLineEdit; -class TQValidator; -class TQSpinBoxPrivate; - -class TQ_EXPORT TQSpinBox: public TQWidget, public TQRangeControl -{ - TQ_OBJECT - TQ_ENUMS( ButtonSymbols ) - TQ_PROPERTY( TQString text READ text ) - TQ_PROPERTY( TQString prefix READ prefix WRITE setPrefix ) - TQ_PROPERTY( TQString suffix READ suffix WRITE setSuffix ) - TQ_PROPERTY( TQString cleanText READ cleanText ) - TQ_PROPERTY( TQString specialValueText READ specialValueText WRITE setSpecialValueText ) - TQ_PROPERTY( bool wrapping READ wrapping WRITE setWrapping ) - TQ_PROPERTY( ButtonSymbols buttonSymbols READ buttonSymbols WRITE setButtonSymbols ) - TQ_PROPERTY( int maxValue READ maxValue WRITE setMaxValue ) - TQ_PROPERTY( int minValue READ minValue WRITE setMinValue ) - TQ_PROPERTY( int lineStep READ lineStep WRITE setLineStep ) - TQ_PROPERTY( int value READ value WRITE setValue ) - -public: - TQSpinBox( TQWidget* parent=0, const char* name=0 ); - TQSpinBox( int minValue, int maxValue, int step = 1, - TQWidget* parent=0, const char* name=0 ); - ~TQSpinBox(); - - TQString text() const; - - virtual TQString prefix() const; - virtual TQString suffix() const; - virtual TQString cleanText() const; - - virtual void setSpecialValueText( const TQString &text ); - TQString specialValueText() const; - - virtual void setWrapping( bool on ); - bool wrapping() const; - - enum ButtonSymbols { UpDownArrows, PlusMinus }; - virtual void setButtonSymbols( ButtonSymbols ); - ButtonSymbols buttonSymbols() const; - - virtual void setValidator( const TQValidator* v ); - const TQValidator * validator() const; - - TQSize sizeHint() const; - TQSize minimumSizeHint() const; - - int minValue() const; - int maxValue() const; - void setMinValue( int ); - void setMaxValue( int ); - int lineStep() const; - void setLineStep( int ); - int value() const; - - TQRect upRect() const; - TQRect downRect() const; - -public slots: - virtual void setValue( int value ); - virtual void setPrefix( const TQString &text ); - virtual void setSuffix( const TQString &text ); - virtual void stepUp(); - virtual void stepDown(); - virtual void setEnabled( bool enabled ); - virtual void selectAll(); - -signals: - void valueChanged( int value ); - void valueChanged( const TQString &valueText ); - -protected: - virtual TQString mapValueToText( int value ); - virtual int mapTextToValue( bool* ok ); - TQString currentValueText(); - - virtual void updateDisplay(); - virtual void interpretText(); - - TQLineEdit* editor() const; - - virtual void valueChange(); - virtual void rangeChange(); - - bool eventFilter( TQObject* obj, TQEvent* ev ); - void resizeEvent( TQResizeEvent* ev ); -#ifndef TQT_NO_WHEELEVENT - void wheelEvent( TQWheelEvent * ); -#endif - void leaveEvent( TQEvent* ); - - void styleChange( TQStyle& ); - -protected slots: - void textChanged(); - -private: - void initSpinBox(); - TQSpinBoxPrivate* d; - TQLineEdit* vi; - TQValidator* validate; - TQString pfix; - TQString sfix; - TQString specText; - - uint wrap : 1; - uint edited : 1; - - void arrangeWidgets(); - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQSpinBox( const TQSpinBox& ); - TQSpinBox& operator=( const TQSpinBox& ); -#endif - -}; - -#endif // TQT_NO_SPINBOX - -#endif // TQSPINBOX_H diff --git a/src/widgets/qbutton.cpp b/src/widgets/qbutton.cpp index 31fbe6349..8446c7f46 100644 --- a/src/widgets/qbutton.cpp +++ b/src/widgets/qbutton.cpp @@ -47,8 +47,8 @@ #include "ntqaccel.h" #include "tqpixmapcache.h" #include "ntqapplication.h" -#include "ntqpushbutton.h" -#include "ntqradiobutton.h" +#include "tqpushbutton.h" +#include "tqradiobutton.h" #include "ntqguardedptr.h" #include "../kernel/qinternal_p.h" diff --git a/src/widgets/qbuttongroup.cpp b/src/widgets/qbuttongroup.cpp index c1a708b80..08c1919a7 100644 --- a/src/widgets/qbuttongroup.cpp +++ b/src/widgets/qbuttongroup.cpp @@ -43,7 +43,7 @@ #include "ntqbutton.h" #include "tqptrlist.h" #include "ntqapplication.h" -#include "ntqradiobutton.h" +#include "tqradiobutton.h" diff --git a/src/widgets/qcheckbox.cpp b/src/widgets/qcheckbox.cpp deleted file mode 100644 index 4e4d913ba..000000000 --- a/src/widgets/qcheckbox.cpp +++ /dev/null @@ -1,364 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQCheckBox class -** -** Created : 940222 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqcheckbox.h" -#ifndef TQT_NO_CHECKBOX -#include "tqpainter.h" -#include "ntqdrawutil.h" -#include "tqpixmap.h" -#include "tqpixmapcache.h" -#include "tqbitmap.h" -#include "tqtextstream.h" -#include "ntqapplication.h" -#include "tqstyle.h" - -/*! - \class TQCheckBox ntqcheckbox.h - \brief The TQCheckBox widget provides a checkbox with a text label. - - \ingroup basic - \mainclass - - TQCheckBox and TQRadioButton are both option buttons. That is, they - can be switched on (checked) or off (unchecked). The classes - differ in how the choices for the user are restricted. Radio - buttons define a "one of many" choice, whereas checkboxes provide - "many of many" choices. - - A TQButtonGroup can be used to group check buttons visually. - - Whenever a checkbox is checked or cleared it emits the signal - toggled(). Connect to this signal if you want to trigger an action - each time the checkbox changes state. You can use isChecked() to - query whether or not a checkbox is checked. - - \warning The toggled() signal can not be trusted for tristate - checkboxes. - - In addition to the usual checked and unchecked states, TQCheckBox - optionally provides a third state to indicate "no change". This - is useful whenever you need to give the user the option of neither - checking nor unchecking a checkbox. If you need this third state, - enable it with setTristate() and use state() to query the current - toggle state. When a tristate checkbox changes state, it emits the - stateChanged() signal. - - Just like TQPushButton, a checkbox can display text or a pixmap. - The text can be set in the constructor or with setText(); the - pixmap is set with setPixmap(). - - \important text(), setText(), text(), pixmap(), setPixmap(), - accel(), setAccel(), isToggleButton(), setDown(), isDown(), - isOn(), state(), autoRepeat(), isExclusiveToggle(), group(), - setAutoRepeat(), toggle(), pressed(), released(), clicked(), - toggled(), state() stateChanged() - - - - \sa TQButton TQRadioButton - \link guibooks.html#fowler Fowler: Check Box \endlink -*/ - -/*! - \property TQCheckBox::checked - \brief whether the checkbox is checked - - The default is unchecked, i.e. FALSE. -*/ - -/*! - \property TQCheckBox::autoMask - \brief whether the checkbox is automatically masked - - \sa TQWidget::setAutoMask() -*/ - -/*! - \property TQCheckBox::tristate - \brief whether the checkbox is a tri-state checkbox - - The default is two-state, i.e. tri-state is FALSE. -*/ - -/*! - Constructs a checkbox with no text. - - The \a parent and \a name arguments are sent to the TQWidget - constructor. -*/ - -TQCheckBox::TQCheckBox( TQWidget *parent, const char *name ) - : TQButton( parent, name, WNoAutoErase | WMouseNoMask ) -{ - setToggleButton( TRUE ); - setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) ); -} - -/*! - Constructs a checkbox with text \a text. - - The \a parent and \a name arguments are sent to the TQWidget - constructor. -*/ - -TQCheckBox::TQCheckBox( const TQString &text, TQWidget *parent, const char *name ) - : TQButton( parent, name, WNoAutoErase | WMouseNoMask ) -{ - setText( text ); - setToggleButton( TRUE ); - setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) ); -} - -/*! - Sets the checkbox to the "no change" state. - - \sa setTristate() -*/ -void TQCheckBox::setNoChange() -{ - setTristate(TRUE); - setState( NoChange ); -} - -void TQCheckBox::setTristate(bool y) -{ - setToggleType( y ? Tristate : Toggle ); -} - -bool TQCheckBox::isTristate() const -{ - return toggleType() == Tristate; -} - - -/*!\reimp -*/ -TQSize TQCheckBox::sizeHint() const -{ - // NB: TQRadioButton::sizeHint() is similar - constPolish(); - - TQPainter p(this); - TQSize sz = style().itemRect(&p, TQRect(0, 0, 1, 1), ShowPrefix, FALSE, - pixmap(), text()).size(); - - return (style().sizeFromContents(TQStyle::CT_CheckBox, this, sz). - expandedTo(TQApplication::globalStrut())); -} - - -/*!\reimp -*/ - -void TQCheckBox::drawButton( TQPainter *paint ) -{ - TQPainter *p = paint; - TQRect irect = TQStyle::visualRect( style().subRect(TQStyle::SR_CheckBoxIndicator, this), this ); - const TQColorGroup &cg = colorGroup(); - -#if !defined( TQT_NO_TEXTSTREAM ) && !defined( TQ_WS_MACX ) -# define SAVE_CHECKBOX_PIXMAPS -#endif -#if defined(SAVE_CHECKBOX_PIXMAPS) - TQString pmkey; // pixmap key - int kf = 0; - if ( isDown() ) - kf |= 1; - if ( isEnabled() ) - kf |= 2; - if ( hasFocus() ) - kf |= 4; // active vs. normal colorgroup - if( isActiveWindow() ) - kf |= 8; - if ( hasMouse() ) - kf |= 16; - - kf |= state() << 5; - TQTextOStream os(&pmkey); - os << "$qt_check_" << style().className() << "_" - << palette().serialNumber() << "_" << irect.width() << "x" << irect.height() << "_" << kf; - TQPixmap *pm = TQPixmapCache::find( pmkey ); - if ( pm ) { // pixmap exists - p->drawPixmap( irect.topLeft(), *pm ); - drawButtonLabel( p ); - return; - } - bool use_pm = TRUE; - TQPainter pmpaint; - int wx = 0, wy = 0; - if ( use_pm ) { - pm = new TQPixmap( irect.size() ); // create new pixmap - TQ_CHECK_PTR( pm ); - pm->fill( cg.background() ); - TQPainter::redirect(this, pm); - pmpaint.begin(this); - p = &pmpaint; // draw in pixmap - wx = irect.x(); // save x,y coords - wy = irect.y(); - irect.moveTopLeft(TQPoint(0, 0)); - p->setBackgroundColor( cg.background() ); - } -#endif - - TQStyle::SFlags flags = TQStyle::Style_Default; - if ( isEnabled() ) - flags |= TQStyle::Style_Enabled; - if ( hasFocus() ) - flags |= TQStyle::Style_HasFocus; - if ( isDown() ) - flags |= TQStyle::Style_Down; - if ( hasMouse() ) - flags |= TQStyle::Style_MouseOver; - if ( state() == TQButton::On ) - flags |= TQStyle::Style_On; - else if ( state() == TQButton::Off ) - flags |= TQStyle::Style_Off; - else if ( state() == TQButton::NoChange ) - flags |= TQStyle::Style_NoChange; - - style().drawControl(TQStyle::CE_CheckBox, p, this, irect, cg, flags); - -#if defined(SAVE_CHECKBOX_PIXMAPS) - if ( use_pm ) { - pmpaint.end(); - TQPainter::redirect( this, 0 ); - if ( backgroundPixmap() || backgroundMode() == X11ParentRelative ) { - TQBitmap bm( pm->size() ); - bm.fill( color0 ); - pmpaint.begin( &bm ); - style().drawControlMask(TQStyle::CE_CheckBox, &pmpaint, this, irect); - pmpaint.end(); - pm->setMask( bm ); - } - p = paint; // draw in default device - p->drawPixmap( wx, wy, *pm ); - if (!TQPixmapCache::insert(pmkey, pm) ) // save in cache - delete pm; - } -#endif - - drawButtonLabel( paint ); -} - - -/*!\reimp -*/ -void TQCheckBox::drawButtonLabel( TQPainter *p ) -{ - TQRect r = - TQStyle::visualRect( style().subRect(TQStyle::SR_CheckBoxContents, this), this ); - - TQStyle::SFlags flags = TQStyle::Style_Default; - if (isEnabled()) - flags |= TQStyle::Style_Enabled; - if (hasFocus()) - flags |= TQStyle::Style_HasFocus; - if (isDown()) - flags |= TQStyle::Style_Down; - if (state() == TQButton::On) - flags |= TQStyle::Style_On; - else if (state() == TQButton::Off) - flags |= TQStyle::Style_Off; - else if (state() == TQButton::NoChange) - flags |= TQStyle::Style_NoChange; - - style().drawControl(TQStyle::CE_CheckBoxLabel, p, this, r, colorGroup(), flags); -} - -/*! - \reimp -*/ -void TQCheckBox::resizeEvent( TQResizeEvent *e ) -{ - TQButton::resizeEvent(e); - if ( isVisible() ) { - TQPainter p(this); - TQSize isz = style().itemRect(&p, TQRect(0, 0, 1, 1), ShowPrefix, FALSE, - pixmap(), text()).size(); - TQSize wsz = (style().sizeFromContents(TQStyle::CT_CheckBox, this, isz). - expandedTo(TQApplication::globalStrut())); - - update(wsz.width(), isz.width(), 0, wsz.height()); - } - if (autoMask()) - updateMask(); -} - -/*! - \reimp -*/ -void TQCheckBox::updateMask() -{ - TQRect irect = - TQStyle::visualRect( style().subRect(TQStyle::SR_CheckBoxIndicator, this), this ); - - TQBitmap bm(width(), height()); - bm.fill(color0); - - TQPainter p( &bm, this ); - style().drawControlMask(TQStyle::CE_CheckBox, &p, this, irect); - if ( ! text().isNull() || ( pixmap() && ! pixmap()->isNull() ) ) { - TQRect crect = - TQStyle::visualRect( style().subRect( TQStyle::SR_CheckBoxContents, - this ), this ); - TQRect frect = - TQStyle::visualRect( style().subRect( TQStyle::SR_CheckBoxFocusRect, - this ), this ); - TQRect label(crect.unite(frect)); - p.fillRect(label, color1); - } - p.end(); - - setMask(bm); -} - -/*!\reimp*/ -bool TQCheckBox::hitButton( const TQPoint &pos ) const -{ - TQRect r = TQStyle::visualRect( style().subRect( TQStyle::SR_CheckBoxFocusRect, this ), this ); - if ( tqApp->reverseLayout() ) { - r.setRight( width() ); - } else { - r.setLeft( 0 ); - } - return r.contains( pos ); -} - -#endif diff --git a/src/widgets/qcombobox.cpp b/src/widgets/qcombobox.cpp deleted file mode 100644 index a491e7ca6..000000000 --- a/src/widgets/qcombobox.cpp +++ /dev/null @@ -1,2338 +0,0 @@ -/********************************************************************** -** -** Implementation of TQComboBox widget class -** -** Created : 940426 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqcombobox.h" -#ifndef TQT_NO_COMBOBOX -#include "tqpopupmenu.h" -#include "ntqlistbox.h" -#include "tqpainter.h" -#include "ntqdrawutil.h" -#include "tqstrlist.h" -#include "tqpixmap.h" -#include "tqtimer.h" -#include "ntqapplication.h" -#include "ntqlineedit.h" -#include "tqbitmap.h" -#include "qeffects_p.h" -#include "tqstringlist.h" -#include "ntqcombobox.h" -#include "tqstyle.h" -#include -#if defined(QT_ACCESSIBILITY_SUPPORT) -#include "ntqaccessible.h" -#endif - -/*! - \class TQComboBox ntqcombobox.h - \brief The TQComboBox widget is a combined button and popup list. - - \ingroup basic - \mainclass - - A combobox is a selection widget which displays the current item - and can pop up a list of items. A combobox may be editable in - which case the user can enter arbitrary strings. - - Comboboxes provide a means of showing the user's current choice - out of a list of options in a way that takes up the minimum amount - of screen space. - - TQComboBox supports three different display styles: Aqua/Motif 1.x, - Motif 2.0 and Windows. In Motif 1.x, a combobox was called - XmOptionMenu. In Motif 2.0, OSF introduced an improved combobox - and named that XmComboBox. TQComboBox provides both. - - TQComboBox provides two different constructors. The simplest - constructor creates an "old-style" combobox in Motif (or Aqua) - style: - \code - TQComboBox *c = new TQComboBox( this, "read-only combobox" ); - \endcode - - The other constructor creates a new-style combobox in Motif style, - and can create both read-only and editable comboboxes: - \code - TQComboBox *c1 = new TQComboBox( FALSE, this, "read-only combobox" ); - TQComboBox *c2 = new TQComboBox( TRUE, this, "editable combobox" ); - \endcode - - New-style comboboxes use a list box in both Motif and Windows - styles, and both the content size and the on-screen size of the - list box can be limited with sizeLimit() and setMaxCount() - respectively. Old-style comboboxes use a popup in Aqua and Motif - style, and that popup will happily grow larger than the desktop if - you put enough data into it. - - The two constructors create identical-looking comboboxes in - Windows style. - - Comboboxes can contain pixmaps as well as strings; the - insertItem() and changeItem() functions are suitably overloaded. - For editable comboboxes, the function clearEdit() is provided, - to clear the displayed string without changing the combobox's - contents. - - A combobox emits two signals, activated() and highlighted(), when - a new item has been activated (selected) or highlighted (made - current). Both signals exist in two versions, one with a \c - TQString argument and one with an \c int argument. If the user - highlights or activates a pixmap, only the \c int signals are - emitted. Whenever the text of an editable combobox is changed the - textChanged() signal is emitted. - - When the user enters a new string in an editable combobox, the - widget may or may not insert it, and it can insert it in several - locations. The default policy is is \c AtBottom but you can change - this using setInsertionPolicy(). - - It is possible to constrain the input to an editable combobox - using TQValidator; see setValidator(). By default, any input is - accepted. - - If the combobox is not editable then it has a default - focusPolicy() of \c TabFocus, i.e. it will not grab focus if - clicked. This differs from both Windows and Motif. If the combobox - is editable then it has a default focusPolicy() of \c StrongFocus, - i.e. it will grab focus if clicked. - - A combobox can be populated using the insert functions, - insertStringList() and insertItem() for example. Items can be - changed with changeItem(). An item can be removed with - removeItem() and all items can be removed with clear(). The text - of the current item is returned by currentText(), and the text of - a numbered item is returned with text(). The current item can be - set with setCurrentItem() or setCurrentText(). The number of items - in the combobox is returned by count(); the maximum number of - items can be set with setMaxCount(). You can allow editing using - setEditable(). For editable comboboxes you can set auto-completion - using setAutoCompletion() and whether or not the user can add - duplicates is set with setDuplicatesEnabled(). - - (Motif 1, read-only)
            - (Motif 2, editable)
            - (Motif 2, read-only)
            - (Windows style) - - Depending on the style, TQComboBox will use a TQListBox or a - TQPopupMenu to display the list of items. See setListBox() for - more information. - - \sa TQLineEdit TQListBox TQSpinBox TQRadioButton TQButtonGroup - \link guibooks.html#fowler GUI Design Handbook: Combo Box,\endlink - \link guibooks.html#fowler GUI Design Handbook: Drop-Down List Box.\endlink -*/ - - -/*! - \enum TQComboBox::Policy - - This enum specifies what the TQComboBox should do when a new string - is entered by the user. - - \value NoInsertion the string will not be inserted into the - combobox. - - \value AtTop insert the string as the first item in the combobox. - - \value AtCurrent replace the previously selected item with the - string the user has entered. - - \value AtBottom insert the string as the last item in the - combobox. - - \value AfterCurrent insert the string after the previously - selected item. - - \value BeforeCurrent insert the string before the previously - selected item. - - activated() is always emitted when the string is entered. - - If inserting the new string would cause the combobox to breach its - content size limit, the item at the other end of the list is - deleted. The definition of "other end" is - implementation-dependent. -*/ - - -/*! - \fn void TQComboBox::activated( int index ) - - This signal is emitted when a new item has been activated - (selected). The \a index is the position of the item in the - combobox. - - This signal is not emitted if the item is changed - programmatically, e.g. using setCurrentItem(). -*/ - -/*! - \overload void TQComboBox::activated( const TQString &string ) - - This signal is emitted when a new item has been activated - (selected). \a string is the selected string. - - You can also use the activated(int) signal, but be aware that its - argument is meaningful only for selected strings, not for user - entered strings. -*/ - -/*! - \fn void TQComboBox::highlighted( int index ) - - This signal is emitted when a new item has been set to be the - current item. The \a index is the position of the item in the - combobox. - - This signal is not emitted if the item is changed - programmatically, e.g. using setCurrentItem(). -*/ - -/*! - \overload void TQComboBox::highlighted( const TQString &string ) - - This signal is emitted when a new item has been set to be the - current item. \a string is the item's text. - - You can also use the highlighted(int) signal. -*/ - -/*! - \fn void TQComboBox::textChanged( const TQString &string ) - - This signal is used for editable comboboxes. It is emitted - whenever the contents of the text entry field changes. \a string - contains the new text. -*/ - -/*! - \property TQComboBox::autoCompletion - \brief whether auto-completion is enabled - - This property can only be set for editable comboboxes, for - non-editable comboboxes it has no effect. It is FALSE by default. -*/ - -/*! - \property TQComboBox::autoMask - \brief whether the combobox is automatically masked - - \sa TQWidget::setAutoMask() -*/ - -/*! \property TQComboBox::autoResize - \brief whether auto resize is enabled - \obsolete - - If this property is set to TRUE then the combobox will resize itself - whenever its contents change. The default is FALSE. -*/ - -/*! - \property TQComboBox::count - \brief the number of items in the combobox -*/ - -/*! - \property TQComboBox::currentItem - \brief the index of the current item in the combobox - - Note that the activated() and highlighted() signals are only - emitted when the user changes the current item, not when it is - changed programmatically. -*/ - -/*! - \property TQComboBox::currentText - \brief the text of the combobox's current item -*/ - -/*! - \property TQComboBox::duplicatesEnabled - \brief whether duplicates are allowed - - If the combobox is editable and the user enters some text in the - combobox's lineedit and presses Enter (and the insertionPolicy() - is not \c NoInsertion), then what happens is this: - \list - \i If the text is not already in the list, the text is inserted. - \i If the text is in the list and this property is TRUE (the - default), the text is inserted. - \i If the text is in the list and this property is FALSE, the text - is \e not inserted; instead the item which has matching text becomes - the current item. - \endlist - - This property only affects user-interaction. You can use - insertItem() to insert duplicates if you wish regardless of this - setting. -*/ - -/*! - \property TQComboBox::editable - \brief whether the combobox is editable - - This property's default is FALSE. Note that the combobox will be - cleared if this property is set to TRUE for a 1.x Motif style - combobox. To avoid this, use setEditable() before inserting any - items. Also note that the 1.x version of Motif didn't have any - editable comboboxes, so the combobox will change it's appearance - to a 2.0 style Motif combobox is it is set to be editable. -*/ - -/*! - \property TQComboBox::insertionPolicy - \brief the position of the items inserted by the user - - The default insertion policy is \c AtBottom. See \l Policy. -*/ - -/*! - \property TQComboBox::maxCount - \brief the maximum number of items allowed in the combobox -*/ - -/*! - \property TQComboBox::sizeLimit - \brief the maximum on-screen size of the combobox. - - This property is ignored for both Motif 1.x style and non-editable - comboboxes in Mac style. The default limit is ten - lines. If the number of items in the combobox is or grows larger - than lines, a scrollbar is added. -*/ - -class TQComboBoxPopup : public TQPopupMenu -{ -public: - TQComboBoxPopup( TQWidget *parent=0, const char *name=0 ) - : TQPopupMenu( parent, name ) - { - } - - int itemHeight( int index ) - { - return TQPopupMenu::itemHeight( index ); - } -}; - -static inline TQString escapedComboString(const TQString &str) -{ - TQString stringToReturn = str; - return stringToReturn.replace('&', "&&"); -} - -class TQComboBoxPopupItem : public TQCustomMenuItem -{ - TQListBoxItem *li; - TQSize sc; // Size cache optimization -public: - TQComboBoxPopupItem(TQListBoxItem *i) : TQCustomMenuItem(), li(i), sc(0, 0) { } - virtual bool fullSpan() const { return TRUE; } - virtual void paint( TQPainter*, const TQColorGroup&, bool, bool, int, int, int, int); - virtual TQSize sizeHint() { if (sc.isNull()) sc = TQSize(li->width(li->listBox()), TQMAX(25, li->height(li->listBox()))); return sc; } -}; -void TQComboBoxPopupItem::paint( TQPainter* p, const TQColorGroup&, bool, - bool, int x, int y, int, int) -{ - p->save(); - p->translate(x, y + ((sizeHint().height() / 2) - (li->height(li->listBox()) / 2))); - li->paint(p); - p->restore(); -} - - -class TQComboBoxData -{ -public: - TQComboBoxData( TQComboBox *cb ): ed( 0 ), usingLBox( FALSE ), pop( 0 ), lBox( 0 ), combo( cb ) - { - duplicatesEnabled = TRUE; - cb->setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) ); - } - - inline bool usingListBox() { return usingLBox; } - inline TQListBox * listBox() { return lBox; } - inline TQComboBoxPopup * popup() { return pop; } - void updateLinedGeometry(); - void setListBox( TQListBox *l ); - void setPopupMenu( TQComboBoxPopup * pm, bool isPopup=TRUE ); - - int current; - int maxCount; - int sizeLimit; - TQComboBox::Policy p; - bool autoresize; - bool poppedUp; - bool mouseWasInsidePopup; - bool arrowPressed; - bool arrowDown; - bool discardNextMousePress; - bool shortClick; - bool useCompletion; - bool completeNow; - int completeAt; - bool duplicatesEnabled; - int fullHeight, currHeight; - - TQLineEdit * ed; // /bin/ed rules! - TQTimer *completionTimer; - - TQSize sizeHint; - -private: - bool usingLBox; - TQComboBoxPopup *pop; - TQListBox *lBox; - TQComboBox *combo; - -}; - -void TQComboBoxData::updateLinedGeometry() -{ - if ( !ed || !combo ) - return; - TQRect r = TQStyle::visualRect( combo->style().querySubControlMetrics(TQStyle::CC_ComboBox, combo, - TQStyle::SC_ComboBoxEditField), combo ); - - const TQPixmap *pix = current < combo->count() ? combo->pixmap( current ) : 0; - if ( pix && pix->width() < r.width() ) - r.setLeft( r.left() + pix->width() + 4 ); - if ( r != ed->geometry() ) - ed->setGeometry( r ); -} - -void TQComboBoxData::setListBox( TQListBox *l ) -{ - lBox = l; - usingLBox = TRUE; - l->setMouseTracking( TRUE ); -#ifdef TQ_WS_X11 - l->x11SetWindowType( TQWidget::X11WindowTypeCombo ); - l->x11SetWindowTransient( combo->topLevelWidget()); -#endif -} - -void TQComboBoxData::setPopupMenu( TQComboBoxPopup * pm, bool isPopup ) -{ - pop = pm; - if(isPopup) - usingLBox = FALSE; -#ifdef TQ_WS_X11 - if( pm ) { - pm->x11SetWindowType( TQWidget::X11WindowTypeCombo ); - pm->x11SetWindowTransient( combo->topLevelWidget()); - } -#endif -} - -static inline bool checkInsertIndex( const char *method, const char * name, - int count, int *index) -{ - bool range_err = (*index > count); -#if defined(QT_CHECK_RANGE) - if ( range_err ) - tqWarning( "TQComboBox::%s: (%s) Index %d out of range", - method, name ? name : "", *index ); -#else - Q_UNUSED( method ) - Q_UNUSED( name ) -#endif - if ( *index < 0 ) // append - *index = count; - return !range_err; -} - - -static inline bool checkIndex( const char *method, const char * name, - int count, int index ) -{ - bool range_err = (index >= count); -#if defined(QT_CHECK_RANGE) - if ( range_err ) - tqWarning( "TQComboBox::%s: (%s) Index %i out of range", - method, name ? name : "", index ); -#else - Q_UNUSED( method ) - Q_UNUSED( name ) -#endif - return !range_err; -} - - - -/*! - Constructs a combobox widget with parent \a parent called \a name. - - This constructor creates a popup list if the program uses Motif - (or Aqua) look and feel; this is compatible with Motif 1.x and - Aqua. - - Note: If you use this constructor to create your TQComboBox, then - the pixmap() function will always return 0. To workaround this, - use the other constructor. - -*/ - - - -TQComboBox::TQComboBox( TQWidget *parent, const char *name ) - : TQWidget( parent, name, WNoAutoErase ) -{ - d = new TQComboBoxData( this ); - if ( style().styleHint(TQStyle::SH_ComboBox_Popup, this) || - style().styleHint(TQStyle::SH_GUIStyle) == TQt::MotifStyle ) { - d->setPopupMenu( new TQComboBoxPopup( this, "in-combo" ) ); - d->popup()->setFont( font() ); - connect( d->popup(), TQ_SIGNAL(activated(int)), - TQ_SLOT(internalActivate(int)) ); - connect( d->popup(), TQ_SIGNAL(highlighted(int)), - TQ_SLOT(internalHighlight(int)) ); - } else { - setUpListBox(); - } - d->ed = 0; - d->current = 0; - d->maxCount = INT_MAX; - d->sizeLimit = 10; - d->p = AtBottom; - d->autoresize = FALSE; - d->poppedUp = FALSE; - d->arrowDown = FALSE; - d->arrowPressed = FALSE; - d->discardNextMousePress = FALSE; - d->shortClick = FALSE; - d->useCompletion = FALSE; - d->completeAt = 0; - d->completeNow = FALSE; - d->completionTimer = new TQTimer( this ); - - setFocusPolicy( TabFocus ); - setBackgroundMode( PaletteButton ); -} - - -/*! - Constructs a combobox with a maximum size and either Motif 2.0 or - Windows look and feel. - - The input field can be edited if \a rw is TRUE, otherwise the user - may only choose one of the items in the combobox. - - The \a parent and \a name arguments are passed on to the TQWidget - constructor. -*/ - - -TQComboBox::TQComboBox( bool rw, TQWidget *parent, const char *name ) - : TQWidget( parent, name, WNoAutoErase ) -{ - d = new TQComboBoxData( this ); - setUpListBox(); - - if(d->popup() && style().styleHint(TQStyle::SH_ComboBox_Popup, this)) - d->popup()->setItemChecked(d->current, FALSE); - d->current = 0; - d->maxCount = INT_MAX; - setSizeLimit(10); - d->p = AtBottom; - d->autoresize = FALSE; - d->poppedUp = FALSE; - d->arrowDown = FALSE; - d->discardNextMousePress = FALSE; - d->shortClick = FALSE; - d->useCompletion = FALSE; - d->completeAt = 0; - d->completeNow = FALSE; - d->completionTimer = new TQTimer( this ); - - setFocusPolicy( StrongFocus ); - - d->ed = 0; - if ( rw ) - setUpLineEdit(); - setBackgroundMode( PaletteButton, PaletteBase ); -} - - - -/*! - Destroys the combobox. -*/ - -TQComboBox::~TQComboBox() -{ - delete d; -} - -void TQComboBox::setDuplicatesEnabled( bool enable ) -{ - d->duplicatesEnabled = enable; -} - -bool TQComboBox::duplicatesEnabled() const -{ - return d->duplicatesEnabled; -} - -int TQComboBox::count() const -{ - if ( d->usingListBox() ) - return d->listBox()->count(); - else - return d->popup()->count(); -} - - -/*! - \overload - - Inserts the \a list of strings at position \a index in the - combobox. - - This is only for compatibility since it does not support Unicode - strings. See insertStringList(). -*/ - -void TQComboBox::insertStrList( const TQStrList &list, int index ) -{ - insertStrList( &list, index ); -} - -/*! - \overload - - Inserts the \a list of strings at position \a index in the - combobox. - - This is only for compatibility since it does not support Unicode - strings. See insertStringList(). -*/ - -void TQComboBox::insertStrList( const TQStrList *list, int index ) -{ - if ( !list ) { -#if defined(QT_CHECK_NULL) - Q_ASSERT( list != 0 ); -#endif - return; - } - TQStrListIterator it( *list ); - const char* tmp; - if ( index < 0 ) - index = count(); - while ( (tmp=it.current()) ) { - ++it; - if ( d->usingListBox() ) - d->listBox()->insertItem( TQString::fromLatin1(tmp), index ); - else - d->popup()->insertItem( escapedComboString(TQString::fromLatin1(tmp)), index, index ); - if ( index++ == d->current && d->current < count() ) { - if ( d->ed ) { - d->ed->setText( text( d->current ) ); - d->updateLinedGeometry(); - } else - update(); - currentChanged(); - } - } - if ( index != count() ) - reIndex(); -} - -/*! - Inserts the \a list of strings at position \a index in the - combobox. -*/ - -void TQComboBox::insertStringList( const TQStringList &list, int index ) -{ - TQStringList::ConstIterator it = list.begin(); - if ( index < 0 ) - index = count(); - while ( it != list.end() ) { - if ( d->usingListBox() ) - d->listBox()->insertItem( *it, index ); - else - d->popup()->insertItem( escapedComboString(*it), index, index ); - if ( index++ == d->current && d->current < count() ) { - if ( d->ed ) { - d->ed->setText( text( d->current ) ); - d->updateLinedGeometry(); - } else - update(); - currentChanged(); - } - ++it; - } - if ( index != count() ) - reIndex(); -} - -/*! - Inserts the array of char * \a strings at position \a index in the - combobox. - - The \a numStrings argument is the number of strings. If \a - numStrings is -1 (default), the \a strings array must be - terminated with 0. - - Example: - \code - static const char* items[] = { "red", "green", "blue", 0 }; - combo->insertStrList( items ); - \endcode - - \sa insertStringList() -*/ - -void TQComboBox::insertStrList( const char **strings, int numStrings, int index) -{ - if ( !strings ) { -#if defined(QT_CHECK_NULL) - Q_ASSERT( strings != 0 ); -#endif - return; - } - if ( index < 0 ) - index = count(); - int i = 0; - while ( (numStrings<0 && strings[i]!=0) || iusingListBox() ) - d->listBox()->insertItem( TQString::fromLatin1(strings[i]), index ); - else - d->popup()->insertItem( escapedComboString(TQString::fromLatin1(strings[i])), index, index ); - i++; - if ( index++ == d->current && d->current < count() ) { - if ( d->ed ) { - d->ed->setText( text( d->current ) ); - d->updateLinedGeometry(); - } else - update(); - currentChanged(); - } - } - if ( index != count() ) - reIndex(); -} - - -/*! - Inserts a text item with text \a t, at position \a index. The item - will be appended if \a index is negative. -*/ - -void TQComboBox::insertItem( const TQString &t, int index ) -{ - int cnt = count(); - if ( !checkInsertIndex( "insertItem", name(), cnt, &index ) ) - return; - if ( d->usingListBox() ) - d->listBox()->insertItem( t, index ); - else - d->popup()->insertItem( escapedComboString(t), index, index ); - if ( index != cnt ) - reIndex(); - if ( index == d->current && d->current < count() ) { - if ( d->ed ) { - d->ed->setText( text( d->current ) ); - d->updateLinedGeometry(); - } else - update(); - } - if ( index == d->current ) - currentChanged(); -} - -/*! - \overload - - Inserts a \a pixmap item at position \a index. The item will be - appended if \a index is negative. -*/ - -void TQComboBox::insertItem( const TQPixmap &pixmap, int index ) -{ - int cnt = count(); - if ( !checkInsertIndex( "insertItem", name(), cnt, &index ) ) - return; - if ( d->usingListBox() ) - d->listBox()->insertItem( pixmap, index ); - else - d->popup()->insertItem( pixmap, index, index ); - if ( index != cnt ) - reIndex(); - if ( index == d->current && d->current < count() ) { - if ( d->ed ) { - d->ed->setText( text( d->current ) ); - d->updateLinedGeometry(); - } else - update(); - } - if ( index == d->current ) - currentChanged(); -} - -/*! - \overload - - Inserts a \a pixmap item with additional text \a text at position - \a index. The item will be appended if \a index is negative. -*/ - -void TQComboBox::insertItem( const TQPixmap &pixmap, const TQString& text, int index ) -{ - int cnt = count(); - if ( !checkInsertIndex( "insertItem", name(), cnt, &index ) ) - return; - if ( d->usingListBox() ) - d->listBox()->insertItem( pixmap, text, index ); - else - d->popup()->insertItem( pixmap, escapedComboString(text), index, index ); - if ( index != cnt ) - reIndex(); - if ( index == d->current && d->current < count() ) { - if ( d->ed ) { - d->ed->setText( this->text( d->current ) ); - d->updateLinedGeometry(); - } else - update(); - } - if ( index == d->current ) - currentChanged(); -} - - -/*! - Removes the item at position \a index. -*/ - -void TQComboBox::removeItem( int index ) -{ - int cnt = count(); - if ( !checkIndex( "removeItem", name(), cnt, index ) ) - return; - if ( d->usingListBox() ) { - if ( style().styleHint(TQStyle::SH_ComboBox_Popup, this) && d->popup() ) - d->popup()->removeItemAt( index ); - d->listBox()->removeItem( index ); - } else { - d->popup()->removeItemAt( index ); - } - if ( index != cnt-1 ) - reIndex(); - if ( index == d->current ) { - if ( d->ed ) { - TQString s = TQString::fromLatin1(""); - if (d->current < cnt - 1) - s = text( d->current ); - d->ed->setText( s ); - d->updateLinedGeometry(); - } - else { - if ( d->usingListBox() ) { - d->current = d->listBox()->currentItem(); - } else { - if (d->current > count()-1 && d->current > 0) - d->current--; - } - update(); - } - currentChanged(); - } - else { - if ( !d->ed ) { - if (d->current < cnt - 1) - setCurrentItem( d->current ); - else - setCurrentItem( d->current - 1 ); - } - } - -} - - -/*! - Removes all combobox items. -*/ - -void TQComboBox::clear() -{ - if ( d->usingListBox() ) { - if ( style().styleHint(TQStyle::SH_ComboBox_Popup, this) && d->popup() ) - d->popup()->clear(); - d->listBox()->resize( 0, 0 ); - d->listBox()->clear(); - } else { - d->popup()->clear(); - } - - if(d->popup() && style().styleHint(TQStyle::SH_ComboBox_Popup, this)) - d->popup()->setItemChecked(d->current, FALSE); - d->current = 0; - if ( d->ed ) { - d->ed->setText( TQString::fromLatin1("") ); - d->updateLinedGeometry(); - } - currentChanged(); -} - - -TQString TQComboBox::currentText() const -{ - if ( d->ed ) - return d->ed->text(); - else if ( d->current < count() ) - return text( currentItem() ); - else - return TQString::null; -} - -void TQComboBox::setCurrentText( const TQString& txt ) -{ - int i; - for ( i = 0; i < count(); i++) - if ( text( i ) == txt ) - break; - if ( i < count() ) - setCurrentItem( i ); - else if ( d->ed ) - d->ed->setText( txt ); - else - changeItem( txt, currentItem() ); -} - - -/*! - Returns the text item at position \a index, or TQString::null if - the item is not a string. - - \sa currentText() -*/ - -TQString TQComboBox::text( int index ) const -{ - if ( !checkIndex( "text", name(), count(), index ) ) - return TQString::null; - if ( d->usingListBox() ) { - return d->listBox()->text( index ); - } else { - TQString retText = d->popup()->text(index); - retText.replace("&&", "&"); - return retText; - } -} - -/*! - Returns the pixmap item at position \a index, or 0 if the item is - not a pixmap. -*/ - -const TQPixmap *TQComboBox::pixmap( int index ) const -{ - if ( !checkIndex( "pixmap", name(), count(), index ) ) - return 0; - if ( d->usingListBox() ) - return d->listBox()->pixmap( index ); - else - return d->popup()->pixmap( index ); -} - -/*! - Replaces the item at position \a index with the text \a t. -*/ - -void TQComboBox::changeItem( const TQString &t, int index ) -{ - if ( !checkIndex( "changeItem", name(), count(), index ) ) - return; - if ( d->usingListBox() ) - d->listBox()->changeItem( t, index ); - else - d->popup()->changeItem( t, index ); - if ( index == d->current ) { - if ( d->ed ) { - d->ed->setText( text( d->current ) ); - d->updateLinedGeometry(); - } else - update(); - } -} - -/*! - \overload - - Replaces the item at position \a index with the pixmap \a im, - unless the combobox is editable. - - \sa insertItem() -*/ - -void TQComboBox::changeItem( const TQPixmap &im, int index ) -{ - if ( !checkIndex( "changeItem", name(), count(), index ) ) - return; - if ( d->usingListBox() ) - d->listBox()->changeItem( im, index ); - else - d->popup()->changeItem( im, index ); - if ( index == d->current ) - update(); -} - -/*! - \overload - - Replaces the item at position \a index with the pixmap \a im and - the text \a t. - - \sa insertItem() -*/ - -void TQComboBox::changeItem( const TQPixmap &im, const TQString &t, int index ) -{ - if ( !checkIndex( "changeItem", name(), count(), index ) ) - return; - if ( d->usingListBox() ) - d->listBox()->changeItem( im, t, index ); - else - d->popup()->changeItem( im, t, index ); - if ( index == d->current ) - update(); -} - - -int TQComboBox::currentItem() const -{ - return d->current; -} - -void TQComboBox::setCurrentItem( int index ) -{ - if ( index == d->current && !d->ed ) { - return; - } - if ( !checkIndex( "setCurrentItem", name(), count(), index ) ) { - return; - } - - if ( d->usingListBox() && !( listBox()->item(index) && listBox()->item(index)->isSelectable() ) ) - return; - - if(d->popup() && style().styleHint(TQStyle::SH_ComboBox_Popup, this)) - d->popup()->setItemChecked(d->current, FALSE); - d->current = index; - d->completeAt = 0; - if ( d->ed ) { - d->ed->setText( text( index ) ); - d->updateLinedGeometry(); - } - // ### We want to keep ListBox's currentItem in sync, even if NOT popuped... - if ( d->usingListBox() && d->listBox() ) { - d->listBox()->setCurrentItem( index ); - } else { - internalHighlight( index ); - // internalActivate( index ); ### this leads to weird behavior, as in 3.0.1 - } - - currentChanged(); -} - -bool TQComboBox::autoResize() const -{ - return d->autoresize; -} - -void TQComboBox::setAutoResize( bool enable ) -{ - if ( (bool)d->autoresize != enable ) { - d->autoresize = enable; - if ( enable ) - adjustSize(); - } -} - - -/*! - \reimp - - This implementation caches the size hint to avoid resizing when - the contents change dynamically. To invalidate the cached value - call setFont(). -*/ -TQSize TQComboBox::sizeHint() const -{ - if ( isVisible() && d->sizeHint.isValid() ) - return d->sizeHint; - - constPolish(); - int i, w; - TQFontMetrics fm = fontMetrics(); - - int maxW = count() ? 18 : 7 * fm.width(TQChar('x')) + 18; - int maxH = TQMAX( fm.lineSpacing(), 14 ) + 2; - - if ( !d->usingListBox() ) { - w = d->popup()->sizeHint().width() - 2* d->popup()->frameWidth(); - if ( w > maxW ) - maxW = w; - } else { - for( i = 0; i < count(); i++ ) { - w = d->listBox()->item( i )->width( d->listBox() ); - if ( w > maxW ) - maxW = w; - } - } - - d->sizeHint = (style().sizeFromContents(TQStyle::CT_ComboBox, this, - TQSize(maxW, maxH)). - expandedTo(TQApplication::globalStrut())); - - return d->sizeHint; -} - - -/*! - \internal - Receives activated signals from an internal popup list and emits - the activated() signal. -*/ - -void TQComboBox::internalActivate( int index ) -{ - if ( d->current != index ) { - if ( !d->usingListBox() || listBox()->item( index )->isSelectable() ) { - if(d->popup() && style().styleHint(TQStyle::SH_ComboBox_Popup, this)) - d->popup()->setItemChecked(d->current, FALSE); - d->current = index; - currentChanged(); - } - } - if ( d->usingListBox() ) - popDownListBox(); - else - d->popup()->removeEventFilter( this ); - d->poppedUp = FALSE; - - TQString t( text( index ) ); - if ( d->ed ) { - d->ed->setText( t ); - d->updateLinedGeometry(); - } - emit activated( index ); - emit activated( t ); -} - -/*! - \internal - Receives highlighted signals from an internal popup list and emits - the highlighted() signal. -*/ - -void TQComboBox::internalHighlight( int index ) -{ - emit highlighted( index ); - TQString t = text( index ); - if ( !t.isNull() ) - emit highlighted( t ); -} - -/*! - \internal - Receives timeouts after a click. Used to decide if a Motif style - popup should stay up or not after a click. -*/ -void TQComboBox::internalClickTimeout() -{ - d->shortClick = FALSE; -} - -/*! - Sets the palette for both the combobox button and the combobox - popup list to \a palette. -*/ - -void TQComboBox::setPalette( const TQPalette &palette ) -{ - TQWidget::setPalette( palette ); - if ( d->listBox() ) - d->listBox()->setPalette( palette ); - if ( d->popup() ) - d->popup()->setPalette( palette ); -} - -/*! - Sets the font for both the combobox button and the combobox popup - list to \a font. -*/ - -void TQComboBox::setFont( const TQFont &font ) -{ - d->sizeHint = TQSize(); // invalidate size hint - TQWidget::setFont( font ); - if ( d->usingListBox() ) - d->listBox()->setFont( font ); - else - d->popup()->setFont( font ); - if (d->ed) - d->ed->setFont( font ); - if ( d->autoresize ) - adjustSize(); -} - - -/*!\reimp -*/ - -void TQComboBox::resizeEvent( TQResizeEvent * e ) -{ - if ( d->ed ) - d->updateLinedGeometry(); - if ( d->listBox() ) - d->listBox()->resize( width(), d->listBox()->height() ); - TQWidget::resizeEvent( e ); -} - -/*!\reimp -*/ - -void TQComboBox::paintEvent( TQPaintEvent * ) -{ - TQPainter p( this ); - const TQColorGroup & g = colorGroup(); - p.setPen(g.text()); - - TQStyle::SFlags flags = TQStyle::Style_Default; - if (isEnabled()) - flags |= TQStyle::Style_Enabled; - if (hasFocus()) - flags |= TQStyle::Style_HasFocus; - if (hasMouse()) - flags |= TQStyle::Style_MouseOver; - - if ( width() < 5 || height() < 5 ) { - qDrawShadePanel( &p, rect(), g, FALSE, 2, - &g.brush( TQColorGroup::Button ) ); - return; - } - - bool reverse = TQApplication::reverseLayout(); - if ( !d->usingListBox() && - style().styleHint(TQStyle::SH_GUIStyle) == TQt::MotifStyle) { // motif 1.x style - int dist, buttonH, buttonW; - dist = 8; - buttonH = 7; - buttonW = 11; - int xPos; - int x0; - int w = width() - dist - buttonW - 1; - if ( reverse ) { - xPos = dist + 1; - x0 = xPos + 4; - } else { - xPos = w; - x0 = 4; - } - qDrawShadePanel( &p, rect(), g, FALSE, - style().pixelMetric(TQStyle::PM_DefaultFrameWidth, this), - &g.brush( TQColorGroup::Button ) ); - qDrawShadePanel( &p, xPos, (height() - buttonH)/2, - buttonW, buttonH, g, FALSE, - style().pixelMetric(TQStyle::PM_DefaultFrameWidth, this) ); - TQRect clip( x0, 2, w - 2 - 4 - 5, height() - 4 ); - TQString str = d->popup()->text( this->d->current ); - if ( !str.isNull() ) { - p.drawText( clip, AlignCenter | SingleLine, str ); - } - - TQPixmap *pix = d->popup()->pixmap( this->d->current ); - TQIconSet *iconSet = d->popup()->iconSet( this->d->current ); - if (pix || iconSet) { - TQPixmap pm = ( pix ? *pix : iconSet->pixmap() ); - p.setClipRect( clip ); - p.drawPixmap( 4, (height()-pm.height())/2, pm ); - p.setClipping( FALSE ); - } - - if ( hasFocus() ) - p.drawRect( xPos - 5, 4, width() - xPos + 1 , height() - 8 ); - } else if(!d->usingListBox()) { - style().drawComplexControl( TQStyle::CC_ComboBox, &p, this, rect(), g, - flags, (uint)TQStyle::SC_All, - (d->arrowDown ? - TQStyle::SC_ComboBoxArrow : - TQStyle::SC_None )); - - TQRect re = style().querySubControlMetrics( TQStyle::CC_ComboBox, this, - TQStyle::SC_ComboBoxEditField ); - re = TQStyle::visualRect(re, this); - p.setClipRect( re ); - - TQString str = d->popup()->text( this->d->current ); - TQPixmap *pix = d->popup()->pixmap( this->d->current ); - if ( !str.isNull() ) { - p.save(); - p.setFont(font()); - TQFontMetrics fm(font()); - int x = re.x(), y = re.y() + fm.ascent(); - if( pix ) - x += pix->width() + 5; - p.drawText( x, y, str ); - p.restore(); - } - if ( pix ) { - p.fillRect( re.x(), re.y(), pix->width() + 4, re.height(), - colorGroup().brush( TQColorGroup::Base ) ); - p.drawPixmap( re.x() + 2, re.y() + - ( re.height() - pix->height() ) / 2, *pix ); - } - } else { - style().drawComplexControl( TQStyle::CC_ComboBox, &p, this, rect(), g, - flags, (uint)TQStyle::SC_All, - (d->arrowDown ? - TQStyle::SC_ComboBoxArrow : - TQStyle::SC_None )); - - TQRect re = style().querySubControlMetrics( TQStyle::CC_ComboBox, this, - TQStyle::SC_ComboBoxEditField ); - re = TQStyle::visualRect(re, this); - p.setClipRect( re ); - - if ( !d->ed ) { - TQListBoxItem * item = d->listBox()->item( d->current ); - if ( item ) { - int itemh = item->height( d->listBox() ); - p.translate( re.x(), re.y() + (re.height() - itemh)/2 ); - item->paint( &p ); - } - } else if ( d->listBox() && d->listBox()->item( d->current ) ) { - TQListBoxItem * item = d->listBox()->item( d->current ); - const TQPixmap *pix = item->pixmap(); - if ( pix ) { - p.fillRect( re.x(), re.y(), pix->width() + 4, re.height(), - colorGroup().brush( TQColorGroup::Base ) ); - p.drawPixmap( re.x() + 2, re.y() + - ( re.height() - pix->height() ) / 2, *pix ); - } - } - p.setClipping( FALSE ); - } -} - - -/*!\reimp -*/ - -void TQComboBox::mousePressEvent( TQMouseEvent *e ) -{ - if ( e->button() != LeftButton ) - return; - if ( d->discardNextMousePress ) { - d->discardNextMousePress = FALSE; - return; - } - TQRect arrowRect = style().querySubControlMetrics( TQStyle::CC_ComboBox, this, - TQStyle::SC_ComboBoxArrow); - arrowRect = TQStyle::visualRect(arrowRect, this); - - // Correction for motif style, where arrow is smaller - // and thus has a rect that doesn't fit the button. - arrowRect.setHeight( TQMAX( height() - (2 * arrowRect.y()), arrowRect.height() ) ); - - if ( count() && ( !editable() || arrowRect.contains( e->pos() ) ) ) { - d->arrowPressed = FALSE; - - if ( d->usingListBox() ) { - listBox()->blockSignals( TRUE ); - tqApp->sendEvent( listBox(), e ); // trigger the listbox's autoscroll - listBox()->setCurrentItem(d->current); - listBox()->blockSignals( FALSE ); - popup(); - if ( arrowRect.contains( e->pos() ) ) { - d->arrowPressed = TRUE; - d->arrowDown = TRUE; - repaint( FALSE ); - } - } else { - popup(); - } - TQTimer::singleShot( 200, this, TQ_SLOT(internalClickTimeout())); - d->shortClick = TRUE; - } -} - -/*!\reimp -*/ - -void TQComboBox::mouseMoveEvent( TQMouseEvent * ) -{ -} - -/*!\reimp -*/ - -void TQComboBox::mouseReleaseEvent( TQMouseEvent * ) -{ -} - -/*!\reimp -*/ - -void TQComboBox::mouseDoubleClickEvent( TQMouseEvent *e ) -{ - mousePressEvent( e ); -} - - -/*!\reimp -*/ - -void TQComboBox::keyPressEvent( TQKeyEvent *e ) -{ - int c = currentItem(); - if ( ( e->key() == Key_F4 && e->state() == 0 ) || - ( e->key() == Key_Down && (e->state() & AltButton) ) || - ( !d->ed && e->key() == Key_Space ) ) { - if ( count() ) { - if ( !d->usingListBox() ) - d->popup()->setActiveItem( this->d->current ); - popup(); - } - return; - } else if ( d->usingListBox() && e->key() == Key_Up ) { - if ( c > 0 ) - setCurrentItem( c-1 ); - } else if ( d->usingListBox() && e->key() == Key_Down ) { - if ( ++c < count() ) - setCurrentItem( c ); - } else if ( d->usingListBox() && e->key() == Key_Home && ( !d->ed || !d->ed->hasFocus() ) ) { - setCurrentItem( 0 ); - } else if ( d->usingListBox() && e->key() == Key_End && ( !d->ed || !d->ed->hasFocus() ) ) { - setCurrentItem( count()-1 ); - } else if ( !d->ed && e->ascii() >= 32 && !e->text().isEmpty() ) { - if ( !d->completionTimer->isActive() ) { - d->completeAt = 0; - c = completionIndex( e->text(), ++c ); - if ( c >= 0 ) { - setCurrentItem( c ); - d->completeAt = e->text().length(); - } - } else { - d->completionTimer->stop(); - TQString ct = currentText().left( d->completeAt ) + e->text(); - c = completionIndex( ct, c ); - if ( c < 0 && d->completeAt > 0 ) { - c = completionIndex( e->text(), 0 ); - ct = e->text(); - } - d->completeAt = 0; - if ( c >= 0 ) { - setCurrentItem( c ); - d->completeAt = ct.length(); - } - } - d->completionTimer->start( 400, TRUE ); - } else { - e->ignore(); - return; - } - - c = currentItem(); - if ( count() && !text( c ).isNull() ) - emit activated( text( c ) ); - emit activated( c ); -} - - -/*!\reimp -*/ - -void TQComboBox::focusInEvent( TQFocusEvent * e ) -{ - TQWidget::focusInEvent( e ); - d->completeNow = FALSE; - d->completeAt = 0; -} - -/*!\reimp -*/ - -void TQComboBox::focusOutEvent( TQFocusEvent * e ) -{ - TQWidget::focusOutEvent( e ); - d->completeNow = FALSE; - d->completeAt = 0; -} - -/*!\reimp -*/ -#ifndef TQT_NO_WHEELEVENT -void TQComboBox::wheelEvent( TQWheelEvent *e ) -{ - if ( d->poppedUp ) { - if ( d->usingListBox() ) { - TQApplication::sendEvent( d->listBox(), e ); - } - } else { - if ( e->delta() > 0 ) { - int c = currentItem(); - if ( c > 0 ) { - setCurrentItem( c-1 ); - emit activated( currentItem() ); - emit activated( currentText() ); - } - } else { - int c = currentItem(); - if ( ++c < count() ) { - setCurrentItem( c ); - emit activated( currentItem() ); - emit activated( currentText() ); - } - } - e->accept(); - } -} -#endif - -/*! - \internal - Calculates the listbox height needed to contain all items, or as - many as the list box is supposed to contain. -*/ -static int listHeight( TQListBox *l, int sl ) -{ - if ( l->count() > 0 ) - return TQMIN( l->count(), (uint)sl) * l->item( 0 )->height(l); - else - return l->sizeHint().height(); -} - - -/*! - Pops up the combobox popup list. - - If the list is empty, no items appear. -*/ - -void TQComboBox::popup() -{ - if ( !count() || d->poppedUp ) - return; - - if( !d->usingListBox() || style().styleHint(TQStyle::SH_ComboBox_Popup, this) ) { - if(d->usingListBox()) { - if(!d->popup()) { - TQComboBoxPopup *p = new TQComboBoxPopup( this, "in-combo" ); - d->setPopupMenu( p, FALSE ); - p->setFont( font() ); - connect( p, TQ_SIGNAL(activated(int)), TQ_SLOT(internalActivate(int)) ); - connect( p, TQ_SIGNAL(highlighted(int)), TQ_SLOT(internalHighlight(int)) ); - } - d->popup()->clear(); - for(unsigned int i = 0; i < d->listBox()->count(); i++) { - TQListBoxItem *item = d->listBox()->item(i); - if(item->rtti() == TQListBoxText::RTTI) { - d->popup()->insertItem(escapedComboString(item->text()), i, i); - } else if(item->rtti() == TQListBoxPixmap::RTTI) { - if(item->pixmap()) - d->popup()->insertItem(TQIconSet(*item->pixmap()), escapedComboString(item->text()), i, i); - else - d->popup()->insertItem(escapedComboString(item->text()), i, i); - } else { - d->popup()->insertItem(new TQComboBoxPopupItem(item), i, i); - } - } - } - d->popup()->installEventFilter( this ); - if(d->popup() && style().styleHint(TQStyle::SH_ComboBox_Popup, this)) - d->popup()->setItemChecked(this->d->current, TRUE); - d->popup()->popup( mapToGlobal( TQPoint(0,0) ), this->d->current ); - update(); - } else { - // Send all listbox events to eventFilter(): - TQListBox* lb = d->listBox(); - lb->triggerUpdate( TRUE ); - lb->installEventFilter( this ); - d->mouseWasInsidePopup = FALSE; - int w = lb->variableWidth() ? lb->sizeHint().width() : width(); - int h = listHeight( lb, d->sizeLimit ) + 2; - TQRect screen = TQApplication::desktop()->availableGeometry( this ); - - int sx = screen.x(); // screen pos - int sy = screen.y(); - int sw = screen.width(); // screen width - int sh = screen.height(); // screen height - TQPoint pos = mapToGlobal( TQPoint(0,height()) ); - // ## Similar code is in TQPopupMenu - int x = pos.x(); - int y = pos.y(); - - // the complete widget must be visible - if ( x + w > sx + sw ) - x = sx+sw - w; - if ( x < sx ) - x = sx; - if (y + h > sy+sh && y - h - height() >= 0 ) - y = y - h - height(); - - TQRect rect = - style().querySubControlMetrics( TQStyle::CC_ComboBox, this, - TQStyle::SC_ComboBoxListBoxPopup, - TQStyleOption( x, y, w, h ) ); - // work around older styles that don't implement the combobox - // listbox popup subcontrol - if ( rect.isNull() ) - rect.setRect( x, y, w, h ); - lb->setGeometry( rect ); - - lb->raise(); - bool block = lb->signalsBlocked(); - lb->blockSignals( TRUE ); - TQListBoxItem* currentLBItem = 0; - if ( editable() && currentText() != text( currentItem() ) ) - currentLBItem = lb->findItem( currentText() ); - - currentLBItem = currentLBItem ? currentLBItem : lb->item( d->current ); - - lb->setCurrentItem( currentLBItem ); - lb->setContentsPos( lb->contentsX(), - lb->viewportToContents( lb->itemRect( currentLBItem ).topLeft() ).y() ); - - // set the current item to also be the selected item if it isn't already - if ( currentLBItem && currentLBItem->isSelectable() && !currentLBItem->isSelected() ) - lb->setSelected( currentLBItem, TRUE ); - lb->blockSignals( block ); - lb->setVScrollBarMode(TQScrollView::Auto); - -#ifndef TQT_NO_EFFECTS - if ( TQApplication::isEffectEnabled( UI_AnimateCombo ) ) { - if ( lb->y() < mapToGlobal(TQPoint(0,0)).y() ) - qScrollEffect( lb, TQEffects::UpScroll ); - else - qScrollEffect( lb ); - } else -#endif - lb->show(); - } - d->poppedUp = TRUE; -} - - -/*! - \reimp -*/ -void TQComboBox::updateMask() -{ - TQBitmap bm( size() ); - bm.fill( color0 ); - - { - TQPainter p( &bm, this ); - style().drawComplexControlMask(TQStyle::CC_ComboBox, &p, this, rect()); - } - - setMask( bm ); -} - -/*! - \internal - Pops down (removes) the combobox popup list box. -*/ -void TQComboBox::popDownListBox() -{ - Q_ASSERT( d->usingListBox() ); - d->listBox()->removeEventFilter( this ); - d->listBox()->viewport()->removeEventFilter( this ); - d->listBox()->hide(); - d->listBox()->setCurrentItem( d->current ); - if ( d->arrowDown ) { - d->arrowDown = FALSE; - repaint( FALSE ); - } - d->poppedUp = FALSE; - - update(); -} - - -/*! - \internal - Re-indexes the identifiers in the popup list. -*/ - -void TQComboBox::reIndex() -{ - if ( !d->usingListBox() ) { - int cnt = count(); - while ( cnt-- ) - d->popup()->setId( cnt, cnt ); - } -} - -/*! - \internal - Repaints the combobox. -*/ - -void TQComboBox::currentChanged() -{ - if ( d->autoresize ) - adjustSize(); - update(); - -#if defined(QT_ACCESSIBILITY_SUPPORT) - TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); -#endif -} - -/*! \reimp - - \internal - - The event filter steals events from the popup or listbox when they - are popped up. It makes the popup stay up after a short click in - motif style. In windows style it toggles the arrow button of the - combobox field, and activates an item and takes down the listbox - when the mouse button is released. -*/ - -bool TQComboBox::eventFilter( TQObject *object, TQEvent *event ) -{ - if ( !event ) - return TRUE; - else if ( object == d->ed ) { - if ( event->type() == TQEvent::KeyPress ) { - bool isAccepted = ( (TQKeyEvent*)event )->isAccepted(); - keyPressEvent( (TQKeyEvent *)event ); - if ( ((TQKeyEvent *)event)->isAccepted() ) { - d->completeNow = FALSE; - return TRUE; - } else if ( ((TQKeyEvent *)event)->key() != Key_End ) { - d->completeNow = TRUE; - d->completeAt = d->ed->cursorPosition(); - } - if ( isAccepted ) - ( (TQKeyEvent*)event )->accept(); - else - ( (TQKeyEvent*)event )->ignore(); - } else if ( event->type() == TQEvent::KeyRelease ) { - keyReleaseEvent( (TQKeyEvent *)event ); - return ((TQKeyEvent *)event)->isAccepted(); - } else if ( event->type() == TQEvent::FocusIn ) { - focusInEvent( (TQFocusEvent *)event ); - } else if ( event->type() == TQEvent::FocusOut ) { - focusOutEvent( (TQFocusEvent *)event ); - } else if ( d->useCompletion && d->completeNow ) { - d->completeNow = FALSE; - if ( !d->ed->text().isNull() && - d->ed->cursorPosition() > d->completeAt && - d->ed->cursorPosition() == (int)d->ed->text().length() ) { - TQString ct( d->ed->text() ); - int i = completionIndex( ct, currentItem() ); - if ( i > -1 ) { - TQString it = text( i ); - d->ed->validateAndSet( it, ct.length(), - ct.length(), it.length() ); - d->current = i; - // ### sets current item without emitting signals. This is to - // make sure the right item is current if you change current with - // wheel/up/down. While typing current is not valid anyway. Fix properly - // in 4.0. - } - } - } - } else if ( d->usingListBox() && ( object == d->listBox() || - object == d->listBox()->viewport() )) { - TQMouseEvent *e = (TQMouseEvent*)event; - switch( event->type() ) { - case TQEvent::MouseMove: - if ( !d->mouseWasInsidePopup ) { - TQPoint pos = e->pos(); - if ( d->listBox()->rect().contains( pos ) ) - d->mouseWasInsidePopup = TRUE; - // Check if arrow button should toggle - if ( d->arrowPressed ) { - TQPoint comboPos; - comboPos = mapFromGlobal( d->listBox()->mapToGlobal(pos) ); - TQRect arrowRect = - style().querySubControlMetrics( TQStyle::CC_ComboBox, this, - TQStyle::SC_ComboBoxArrow); - arrowRect = TQStyle::visualRect(arrowRect, this); - if ( arrowRect.contains( comboPos ) ) { - if ( !d->arrowDown ) { - d->arrowDown = TRUE; - repaint( FALSE ); - } - } else { - if ( d->arrowDown ) { - d->arrowDown = FALSE; - repaint( FALSE ); - } - } - } - } else if ((e->state() & ( RightButton | LeftButton | MidButton ) ) == 0 && - style().styleHint(TQStyle::SH_ComboBox_ListMouseTracking, this)) { - TQWidget *mouseW = TQApplication::widgetAt( e->globalPos(), TRUE ); - if ( mouseW == d->listBox()->viewport() ) { //### - TQMouseEvent m( TQEvent::MouseMove, e->pos(), e->globalPos(), - LeftButton, LeftButton ); - TQApplication::sendEvent( object, &m ); //### Evil - return TRUE; - } - } - - break; - case TQEvent::MouseButtonRelease: - if ( d->listBox()->rect().contains( e->pos() ) ) { - TQMouseEvent tmp( TQEvent::MouseButtonDblClick, - e->pos(), e->button(), e->state() ) ; - // will hide popup - TQApplication::sendEvent( object, &tmp ); - return TRUE; - } else { - if ( d->mouseWasInsidePopup ) { - popDownListBox(); - } else { - d->arrowPressed = FALSE; - if ( d->arrowDown ) { - d->arrowDown = FALSE; - repaint( FALSE ); - } - } - } - break; - case TQEvent::MouseButtonDblClick: - case TQEvent::MouseButtonPress: - if ( !d->listBox()->rect().contains( e->pos() ) ) { - TQPoint globalPos = d->listBox()->mapToGlobal(e->pos()); - if ( TQApplication::widgetAt( globalPos, TRUE ) == this ) { - d->discardNextMousePress = TRUE; - // avoid popping up again - } - popDownListBox(); - return TRUE; - } - break; - case TQEvent::KeyPress: - switch( ((TQKeyEvent *)event)->key() ) { - case Key_Up: - case Key_Down: - if ( !(((TQKeyEvent *)event)->state() & AltButton) ) - break; - case Key_F4: - case Key_Escape: - if ( d->poppedUp ) { - popDownListBox(); - return TRUE; - } - break; - case Key_Enter: - case Key_Return: - // work around TQDialog's enter handling - return FALSE; - default: - break; - } - break; - case TQEvent::Hide: - popDownListBox(); - break; - default: - break; - } - } else if ( (!d->usingListBox() || style().styleHint(TQStyle::SH_ComboBox_Popup, this)) && - object == d->popup() ) { - TQMouseEvent *e = (TQMouseEvent*)event; - switch ( event->type() ) { - case TQEvent::MouseButtonRelease: - if ( d->shortClick ) { - TQMouseEvent tmp( TQEvent::MouseMove, - e->pos(), e->button(), e->state() ) ; - // highlight item, but don't pop down: - TQApplication::sendEvent( object, &tmp ); - return TRUE; - } - break; - case TQEvent::MouseButtonDblClick: - case TQEvent::MouseButtonPress: - if ( !d->popup()->rect().contains( e->pos() ) ) { - d->poppedUp = FALSE; - d->arrowDown = FALSE; - // remove filter, event will take down popup: - d->popup()->removeEventFilter( this ); - // ### uglehack! - // call internalHighlight so the highlighed signal - // will be emitted at least as often as necessary. - // it may be called more often than necessary - internalHighlight( d->current ); - } - break; - case TQEvent::Hide: - d->poppedUp = FALSE; - break; - default: - break; - } - } - return TQWidget::eventFilter( object, event ); -} - - -/*! - Returns the index of the first item \e after \a startingAt of - which \a prefix is a case-insensitive prefix. Returns -1 if no - items start with \a prefix. -*/ - -int TQComboBox::completionIndex( const TQString & prefix, - int startingAt = 0 ) const -{ - int start = startingAt; - if ( start < 0 || start >= count() ) - start = 0; - if ( start >= count() ) - return -1; - TQString match = prefix.lower(); - if ( match.length() < 1 ) - return start; - - TQString current; - int i = start; - do { - current = text( i ).lower(); - if ( current.startsWith( match ) ) - return i; - i++; - if ( i == count() ) - i = 0; - } while ( i != start ); - return -1; -} - - -int TQComboBox::sizeLimit() const -{ - return d ? d->sizeLimit : INT_MAX; -} - -void TQComboBox::setSizeLimit( int lines ) -{ - d->sizeLimit = lines; -} - - -int TQComboBox::maxCount() const -{ - return d ? d->maxCount : INT_MAX; -} - -void TQComboBox::setMaxCount( int count ) -{ - int l = this->count(); - while( --l > count ) - removeItem( l ); - d->maxCount = count; -} - -TQComboBox::Policy TQComboBox::insertionPolicy() const -{ - return d->p; -} - -void TQComboBox::setInsertionPolicy( Policy policy ) -{ - d->p = policy; -} - - - -/*! - Internal slot to keep the line editor up to date. -*/ - -void TQComboBox::returnPressed() -{ - TQString s( d->ed->text() ); - - if ( s.isEmpty() ) - return; - - int c = 0; - bool doInsert = TRUE; - if ( !d->duplicatesEnabled ) { - for ( int i = 0; i < count(); ++i ) { - if ( s == text( i ) ) { - doInsert = FALSE; - c = i; - break; - } - } - } - - if ( doInsert ) { - if ( insertionPolicy() != NoInsertion ) { - int cnt = count(); - while ( cnt >= d->maxCount ) { - removeItem( --cnt ); - } - } - - switch ( insertionPolicy() ) { - case AtCurrent: - if (count() == 0) - insertItem(s); - else if ( s != text( currentItem() ) ) - changeItem( s, currentItem() ); - emit activated( currentItem() ); - emit activated( s ); - return; - case NoInsertion: - emit activated( s ); - return; - case AtTop: - c = 0; - break; - case AtBottom: - c = count(); - break; - case BeforeCurrent: - c = currentItem(); - break; - case AfterCurrent: - c = count() == 0 ? 0 : currentItem() + 1; - break; - } - insertItem( s, c ); - } - - setCurrentItem( c ); - emit activated( c ); - emit activated( s ); -} - - -/*! \reimp -*/ - -void TQComboBox::setEnabled( bool enable ) -{ - if ( !enable ) { - if ( d->usingListBox() ) { - popDownListBox(); - } else { - d->popup()->removeEventFilter( this ); - d->popup()->close(); - d->poppedUp = FALSE; - } - } - TQWidget::setEnabled( enable ); -} - - - -/*! - Applies the validator \a v to the combobox so that only text which - is valid according to \a v is accepted. - - This function does nothing if the combobox is not editable. - - \sa validator() clearValidator() TQValidator -*/ - -void TQComboBox::setValidator( const TQValidator * v ) -{ - if ( d && d->ed ) - d->ed->setValidator( v ); -} - - -/*! - Returns the validator which constrains editing for this combobox - if there is one; otherwise returns 0. - - \sa setValidator() clearValidator() TQValidator -*/ - -const TQValidator * TQComboBox::validator() const -{ - return d && d->ed ? d->ed->validator() : 0; -} - - -/*! - This slot is equivalent to setValidator( 0 ). -*/ - -void TQComboBox::clearValidator() -{ - if ( d && d->ed ) - d->ed->setValidator( 0 ); -} - - -/*! - Sets the combobox to use \a newListBox instead of the current list - box or popup. As a side effect, it clears the combobox of its - current contents. - - \warning TQComboBox assumes that newListBox->text(n) returns - non-null for 0 \<= n \< newListbox->count(). This assumption is - necessary because of the line edit in TQComboBox. -*/ - -void TQComboBox::setListBox( TQListBox * newListBox ) -{ - clear(); - - if ( d->usingListBox() ) { - delete d->listBox(); - } else { - delete d->popup(); - d->setPopupMenu(0, FALSE); - } - - newListBox->reparent( this, WType_Popup, TQPoint(0,0), FALSE ); - d->setListBox( newListBox ); - d->listBox()->setFont( font() ); - d->listBox()->setPalette( palette() ); - d->listBox()->setVScrollBarMode(TQScrollView::AlwaysOff); - d->listBox()->setHScrollBarMode(TQScrollView::AlwaysOff); - d->listBox()->setFrameStyle( TQFrame::Box | TQFrame::Plain ); - d->listBox()->setLineWidth( 1 ); - d->listBox()->resize( 100, 10 ); - - connect( d->listBox(), TQ_SIGNAL(selected(int)), - TQ_SLOT(internalActivate(int)) ); - connect( d->listBox(), TQ_SIGNAL(highlighted(int)), - TQ_SLOT(internalHighlight(int))); -} - - -/*! - Returns the current list box, or 0 if there is no list box. - (TQComboBox can use TQPopupMenu instead of TQListBox.) Provided to - match setListBox(). - - \sa setListBox() -*/ - -TQListBox * TQComboBox::listBox() const -{ - return d && d->usingListBox() ? d->listBox() : 0; -} - -/*! - Returns the line edit, or 0 if there is no line edit. - - Only editable listboxes have a line editor. -*/ -TQLineEdit* TQComboBox::lineEdit() const -{ - return d->ed; -} - - - -/*! - Clears the line edit without changing the combobox's contents. - Does nothing if the combobox isn't editable. - - This is particularly useful when using a combobox as a line edit - with history. For example you can connect the combobox's - activated() signal to clearEdit() in order to present the user - with a new, empty line as soon as Enter is pressed. - - \sa setEditText() -*/ - -void TQComboBox::clearEdit() -{ - if ( d && d->ed ) - d->ed->clear(); -} - - -/*! - Sets the text in the line edit to \a newText without changing the - combobox's contents. Does nothing if the combobox isn't editable. - - This is useful e.g. for providing a good starting point for the - user's editing and entering the change in the combobox only when - the user presses Enter. - - \sa clearEdit() insertItem() -*/ - -void TQComboBox::setEditText( const TQString &newText ) -{ - if ( d && d->ed ) { - d->updateLinedGeometry(); - d->ed->setText( newText ); - } -} - -void TQComboBox::setAutoCompletion( bool enable ) -{ - d->useCompletion = enable; - d->completeNow = FALSE; -} - - -bool TQComboBox::autoCompletion() const -{ - return d->useCompletion; -} - -/*!\reimp - */ -void TQComboBox::styleChange( TQStyle& s ) -{ - d->sizeHint = TQSize(); // invalidate size hint... - if ( d->ed ) - d->updateLinedGeometry(); - TQWidget::styleChange( s ); -} - -bool TQComboBox::editable() const -{ - return d->ed != 0; -} - -void TQComboBox::setEditable( bool y ) -{ - if ( y == editable() ) - return; - if ( y ) { - if ( !d->usingListBox() ) - setUpListBox(); - setUpLineEdit(); - d->ed->show(); - if ( currentItem() ) - setEditText( currentText() ); - } else { - delete d->ed; - d->ed = 0; - } - - setFocusPolicy( StrongFocus ); - updateGeometry(); - update(); -} - - -void TQComboBox::setUpListBox() -{ - d->setListBox( new TQListBox( this, "in-combo", WType_Popup ) ); - d->listBox()->setFont( font() ); - d->listBox()->setPalette( palette() ); - d->listBox()->setVScrollBarMode( TQListBox::AlwaysOff ); - d->listBox()->setHScrollBarMode( TQListBox::AlwaysOff ); - d->listBox()->setFrameStyle( TQFrame::Box | TQFrame::Plain ); - d->listBox()->setLineWidth( 1 ); - d->listBox()->resize( 100, 10 ); - - connect( d->listBox(), TQ_SIGNAL(selected(int)), - TQ_SLOT(internalActivate(int)) ); - connect( d->listBox(), TQ_SIGNAL(highlighted(int)), - TQ_SLOT(internalHighlight(int))); -} - - -void TQComboBox::setUpLineEdit() -{ - if ( !d->ed ) - setLineEdit( new TQLineEdit( this, "combo edit" ) ); -} - -/*! - Sets the line edit to use \a edit instead of the current line edit. -*/ - -void TQComboBox::setLineEdit( TQLineEdit *edit ) -{ - if ( !edit ) { -#if defined(QT_CHECK_NULL) - Q_ASSERT( edit != 0 ); -#endif - return; - } - - edit->setText( currentText() ); - delete d->ed; - d->ed = edit; - - if ( edit->parent() != this ) - edit->reparent( this, TQPoint(0,0), FALSE ); - - connect (edit, TQ_SIGNAL( textChanged(const TQString&) ), - this, TQ_SIGNAL( textChanged(const TQString&) ) ); - connect( edit, TQ_SIGNAL(returnPressed()), TQ_SLOT(returnPressed()) ); - - edit->setFrame( FALSE ); - d->updateLinedGeometry(); - edit->installEventFilter( this ); - setFocusProxy( edit ); - setFocusPolicy( StrongFocus ); - setInputMethodEnabled( TRUE ); - - if ( !d->usingListBox() ) - setUpListBox(); - - if ( isVisible() ) - edit->show(); - - updateGeometry(); - update(); -} - -/*! - \reimp -*/ -void TQComboBox::hide() -{ - TQWidget::hide(); - - if (listBox()) - listBox()->hide(); - else if (d->popup()) - d->popup()->hide(); -} - -#endif // TQT_NO_COMBOBOX diff --git a/src/widgets/qdial.cpp b/src/widgets/qdial.cpp deleted file mode 100644 index f11218bf3..000000000 --- a/src/widgets/qdial.cpp +++ /dev/null @@ -1,976 +0,0 @@ -/**************************************************************************** -** -** Implementation of the dial widget -** -** Created : 979899 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqdial.h" - -#ifndef TQT_NO_DIAL - -#include "tqpainter.h" -#include "tqpointarray.h" -#include "tqcolor.h" -#include "ntqapplication.h" -#include "tqregion.h" -#include "tqbitmap.h" -#include "tqstyle.h" -#if defined(QT_ACCESSIBILITY_SUPPORT) -#include "ntqaccessible.h" -#endif - -#include // sin(), cos(), atan() -//### Forutsetter linking med math lib - Jfr kommentar i tqpainter_x11.cpp! - -static const double m_pi = 3.14159265358979323846; -static const double rad_factor = 180.0 / m_pi; - - -class TQDialPrivate -{ -public: - TQDialPrivate() - { - wrapping = FALSE; - tracking = TRUE; - doNotEmit = FALSE; - target = 3.7; - mousePressed = FALSE; - } - - bool wrapping; - bool tracking; - bool doNotEmit; - double target; - TQRect eraseArea; - bool eraseAreaValid; - bool showNotches; - bool onlyOutside; - bool mousePressed; - - TQPointArray lines; -}; - - -/*! - \class TQDial ntqdial.h - - \brief The TQDial class provides a rounded range control (like a speedometer or potentiometer). - - \ingroup basic - \mainclass - - TQDial is used when the user needs to control a value within a - program-definable range, and the range either wraps around - (typically, 0..359 degrees) or the dialog layout needs a square - widget. - - Both API- and UI-wise, the dial is very similar to a \link TQSlider - slider. \endlink Indeed, when wrapping() is FALSE (the default) - there is no real difference between a slider and a dial. They - have the same signals, slots and member functions, all of which do - the same things. Which one you use depends only on your taste - and on the application. - - The dial initially emits valueChanged() signals continuously while - the slider is being moved; you can make it emit the signal less - often by calling setTracking(FALSE). dialMoved() is emitted - continuously even when tracking() is FALSE. - - The slider also emits dialPressed() and dialReleased() signals - when the mouse button is pressed and released. But note that the - dial's value can change without these signals being emitted; the - keyboard and wheel can be used to change the value. - - Unlike the slider, TQDial attempts to draw a "nice" number of - notches rather than one per lineStep(). If possible, the number - of notches drawn is one per lineStep(), but if there aren't enough - pixels to draw every one, TQDial will draw every second, third - etc., notch. notchSize() returns the number of units per notch, - hopefully a multiple of lineStep(); setNotchTarget() sets the - target distance between neighbouring notches in pixels. The - default is 3.75 pixels. - - Like the slider, the dial makes the TQRangeControl functions - setValue(), addLine(), subtractLine(), addPage() and - subtractPage() available as slots. - - The dial's keyboard interface is fairly simple: The left/up and - right/down arrow keys move by lineStep(), page up and page down by - pageStep() and Home and End to minValue() and maxValue(). - - - - \sa TQScrollBar TQSpinBox - \link guibooks.html#fowler GUI Design Handbook: Slider\endlink -*/ - - - - -/*! - Constructs a dial called \a name with parent \a parent. \a f is - propagated to the TQWidget constructor. It has the default range of - a TQRangeControl. -*/ - -TQDial::TQDial( TQWidget *parent, const char *name, WFlags f ) - : TQWidget( parent, name, f | WNoAutoErase ), TQRangeControl() -{ - d = new TQDialPrivate; - d->eraseAreaValid = FALSE; - d->showNotches = FALSE; - d->onlyOutside = FALSE; - setFocusPolicy( TQWidget::WheelFocus ); -} - - - -/*! - Constructs a dial called \a name with parent \a parent. The dial's - value can never be smaller than \a minValue or greater than \a - maxValue. Its page step size is \a pageStep, and its initial value - is \a value. - - \a value is forced to be within the legal range. -*/ - -TQDial::TQDial( int minValue, int maxValue, int pageStep, int value, - TQWidget *parent, const char *name ) - : TQWidget( parent, name, WNoAutoErase ), - TQRangeControl( minValue, maxValue, 1, pageStep, value ) -{ - d = new TQDialPrivate; - d->eraseAreaValid = FALSE; - d->showNotches = FALSE; - d->onlyOutside = FALSE; - setFocusPolicy( TQWidget::WheelFocus ); -} - -/*! - Destroys the dial. -*/ -TQDial::~TQDial() -{ - delete d; -} - - -void TQDial::setTracking( bool enable ) -{ - d->tracking = enable; -} - - -/*! - \property TQDial::tracking - \brief whether tracking is enabled - - If TRUE (the default), tracking is enabled. This means that the - arrow can be moved using the mouse; otherwise the arrow cannot be - moved with the mouse. -*/ - -bool TQDial::tracking() const -{ - return d ? d->tracking : TRUE; -} - -void TQDial::setValue( int newValue ) -{ // ### set doNotEmit? Matthias? - TQRangeControl::setValue( newValue ); -} - - -/*! - Increments the dial's value() by one lineStep(). -*/ - -void TQDial::addLine() -{ - TQRangeControl::addLine(); -} - - -/*! - Decrements the dial's value() by one lineStep(). -*/ - -void TQDial::subtractLine() -{ - TQRangeControl::subtractLine(); -} - - -/*! \reimp */ - -void TQDial::resizeEvent( TQResizeEvent * e ) -{ - d->lines.resize( 0 ); - TQWidget::resizeEvent( e ); -} - - -/*! - \reimp -*/ - -void TQDial::paintEvent( TQPaintEvent * e ) -{ - repaintScreen( &e->rect() ); -} - -/*! - Paints the dial using clip region \a cr. -*/ - -void TQDial::repaintScreen( const TQRect *cr ) -{ - TQPainter p; - p.begin( this ); - - bool resetClipping = FALSE; - - // calculate clip-region for erasing background - if ( cr ) { - p.setClipRect( *cr ); - } else if ( !d->onlyOutside && d->eraseAreaValid ) { - TQRegion reg = d->eraseArea; - double a; - reg = reg.subtract( calcArrow( a ) ); - p.setClipRegion( reg ); - resetClipping = TRUE; - } - - TQRect br( calcDial() ); - p.setPen( NoPen ); - // if ( style() == MotifStyle ) - // p.setBrush( colorGroup().brush( TQColorGroup::Mid ) ); - // else { - TQBrush b; - if ( colorGroup().brush( TQColorGroup::Light ).pixmap() ) - b = TQBrush( colorGroup().brush( TQColorGroup::Light ) ); - else - b = TQBrush( colorGroup().light(), Dense4Pattern ); - p.setBrush( b ); - p.setBackgroundMode( OpaqueMode ); - // } - - TQRect te = br; - te.setWidth(te.width()+2); - te.setHeight(te.height()+2); - // erase background of dial - if ( !d->onlyOutside ) { - p.drawEllipse( te ); - } - - // erase remaining space around the dial - TQRegion remaining( 0, 0, width(), height() ); - remaining = remaining.subtract( TQRegion( te, TQRegion::Ellipse ) ); - if ( p.hasClipping() ) - remaining = remaining.intersect( p.clipRegion() ); - erase(remaining); - - if ( resetClipping ) { - if ( cr ) - p.setClipRect( *cr ); - else - p.setClipRect( TQRect( 0, 0, width(), height() ) ); - } - - // draw notches - if ( d->showNotches ) { - calcLines(); - p.setPen( colorGroup().foreground() ); - p.drawLineSegments( d->lines ); - } - - // calculate and paint arrow - p.setPen( TQPen( colorGroup().dark() ) ); - p.drawArc( te, 60 * 16, 180 * 16 ); - p.setPen( TQPen( colorGroup().light() ) ); - p.drawArc( te, 240 * 16, 180 * 16 ); - - double a; - TQPointArray arrow( calcArrow( a ) ); - TQRect ea( arrow.boundingRect() ); - d->eraseArea = ea; - d->eraseAreaValid = TRUE; - - p.setPen( NoPen ); - p.setBrush( colorGroup().brush( TQColorGroup::Button ) ); - if ( !d->onlyOutside ) - p.drawPolygon( arrow ); - - a = angle( TQPoint( width() / 2, height() / 2 ), arrow[ 0 ] ); - p.setBrush( TQt::NoBrush ); - - // that's still a hack... - if ( a <= 0 || a > 200 ) { - p.setPen( colorGroup().light() ); - p.drawLine( arrow[ 2 ], arrow[ 0 ] ); - p.drawLine( arrow[ 1 ], arrow[ 2 ] ); - p.setPen( colorGroup().dark() ); - p.drawLine( arrow[ 0 ], arrow[ 1 ] ); - } else if ( a > 0 && a < 45 ) { - p.setPen( colorGroup().light() ); - p.drawLine( arrow[ 2 ], arrow[ 0 ] ); - p.setPen( colorGroup().dark() ); - p.drawLine( arrow[ 1 ], arrow[ 2 ] ); - p.drawLine( arrow[ 0 ], arrow[ 1 ] ); - } else if ( a >= 45 && a < 135 ) { - p.setPen( colorGroup().dark() ); - p.drawLine( arrow[ 2 ], arrow[ 0 ] ); - p.drawLine( arrow[ 1 ], arrow[ 2 ] ); - p.setPen( colorGroup().light() ); - p.drawLine( arrow[ 0 ], arrow[ 1 ] ); - } else if ( a >= 135 && a < 200 ) { - p.setPen( colorGroup().dark() ); - p.drawLine( arrow[ 2 ], arrow[ 0 ] ); - p.setPen( colorGroup().light() ); - p.drawLine( arrow[ 0 ], arrow[ 1 ] ); - p.drawLine( arrow[ 1 ], arrow[ 2 ] ); - } - - // draw focus rect around the dial - if ( hasFocus() ) { - p.setClipping( FALSE ); - br.setWidth( br.width() + 2 ); - br.setHeight( br.height() + 2 ); - if ( d->showNotches ) { - int r = TQMIN( width(), height() ) / 2; - br.moveBy( -r / 6, - r / 6 ); - br.setWidth( br.width() + r / 3 ); - br.setHeight( br.height() + r / 3 ); - } - // strange, but else we get redraw errors on Windows - p.end(); - p.begin( this ); - p.save(); - p.setPen( TQPen( colorGroup().background() ) ); - p.setBrush( NoBrush ); - p.drawRect( br ); - p.restore(); - style().drawPrimitive( TQStyle::PE_FocusRect, &p, br, colorGroup()); - } - p.end(); -} - - -/*! - \reimp -*/ - -void TQDial::keyPressEvent( TQKeyEvent * e ) -{ - switch ( e->key() ) { - case Key_Left: case Key_Down: - subtractLine(); - break; - case Key_Right: case Key_Up: - addLine(); - break; - case Key_Prior: - subtractPage(); - break; - case Key_Next: - addPage(); - break; - case Key_Home: - setValue( minValue() ); - break; - case Key_End: - setValue( maxValue() ); - break; - default: - e->ignore(); - break; - } -} - - -/*! - \reimp -*/ - -void TQDial::mousePressEvent( TQMouseEvent * e ) -{ - d->mousePressed = TRUE; - setValue( valueFromPoint( e->pos() ) ); - emit dialPressed(); -} - - -/*! - \reimp -*/ - -void TQDial::mouseReleaseEvent( TQMouseEvent * e ) -{ - d->mousePressed = FALSE; - setValue( valueFromPoint( e->pos() ) ); - emit dialReleased(); -} - - -/*! - \reimp -*/ - -void TQDial::mouseMoveEvent( TQMouseEvent * e ) -{ - if ( !d->mousePressed ) - return; - if ( !d->tracking || (e->state() & LeftButton) == 0 ) - return; - d->doNotEmit = TRUE; - setValue( valueFromPoint( e->pos() ) ); - emit dialMoved( value() ); - d->doNotEmit = FALSE; -} - - -/*! - \reimp -*/ -#ifndef TQT_NO_WHEELEVENT -void TQDial::wheelEvent( TQWheelEvent *e ) -{ - setValue( value() - e->delta() / 120 ); -} -#endif - -/*! - \reimp -*/ - -void TQDial::focusInEvent( TQFocusEvent * ) -{ - d->onlyOutside = TRUE; - repaintScreen(); - d->onlyOutside = FALSE; -} - - -/*! - \reimp -*/ - -void TQDial::focusOutEvent( TQFocusEvent * ) -{ - d->onlyOutside = TRUE; - repaintScreen(); - d->onlyOutside = FALSE; -} - -/*! - Reimplemented to ensure the display is correct and to emit the - valueChanged(int) signal when appropriate. -*/ - -void TQDial::valueChange() -{ - d->lines.resize( 0 ); - repaintScreen(); - if ( d->tracking || !d->doNotEmit ) { - emit valueChanged( value() ); -#if defined(QT_ACCESSIBILITY_SUPPORT) - TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); -#endif - } -} - - -/*! - Reimplemented to ensure tick-marks are consistent with the new range. -*/ - -void TQDial::rangeChange() -{ - d->lines.resize( 0 ); - repaintScreen(); -} - - -/*! - \internal -*/ - -int TQDial::valueFromPoint( const TQPoint & p ) const -{ - double yy = (double)height()/2.0 - p.y(); - double xx = (double)p.x() - width()/2.0; - double a = (xx || yy) ? atan2(yy, xx) : 0; - - if ( a < m_pi/-2 ) - a = a + m_pi*2; - - int dist = 0; - int minv = minValue(), maxv = maxValue(); - - if ( minValue() < 0 ) { - dist = -minValue(); - minv = 0; - maxv = maxValue() + dist; - } - - int r = maxv - minv; - int v; - if ( d->wrapping ) - v = (int)(0.5 + minv + r*(m_pi*3/2-a)/(2*m_pi)); - else - v = (int)(0.5 + minv + r*(m_pi*4/3-a)/(m_pi*10/6)); - - if ( dist > 0 ) - v -= dist; - - return bound( v ); -} - - -/*! - \internal -*/ - -double TQDial::angle( const TQPoint &p1, const TQPoint &p2 ) const -{ - double _angle = 0.0; - - if ( p1.x() == p2.x() ) { - if ( p1.y() < p2.y() ) - _angle = 270.0; - else - _angle = 90.0; - } else { - double x1, x2, y1, y2; - - if ( p1.x() <= p2.x() ) { - x1 = p1.x(); y1 = p1.y(); - x2 = p2.x(); y2 = p2.y(); - } else { - x2 = p1.x(); y2 = p1.y(); - x1 = p2.x(); y1 = p2.y(); - } - - double m = -( y2 - y1 ) / ( x2 - x1 ); - _angle = atan( m ) * rad_factor; - - if ( p1.x() < p2.x() ) - _angle = 180.0 - _angle; - else - _angle = -_angle; - } - - return _angle; -} - -void TQDial::setWrapping( bool enable ) -{ - if ( d->wrapping == enable ) - return; - d->lines.resize( 0 ); - d->wrapping = enable; - d->eraseAreaValid = FALSE; - repaintScreen(); -} - - -/*! - \property TQDial::wrapping - \brief whether wrapping is enabled - - If TRUE, wrapping is enabled. This means that the arrow can be - turned around 360. Otherwise there is some space at the bottom of - the dial which is skipped by the arrow. - - This property's default is FALSE. -*/ - -bool TQDial::wrapping() const -{ - return d->wrapping; -} - - -/*! - \property TQDial::notchSize - \brief the current notch size - - The notch size is in range control units, not pixels, and if - possible it is a multiple of lineStep() that results in an - on-screen notch size near notchTarget(). - - \sa notchTarget() lineStep() -*/ - -int TQDial::notchSize() const -{ - // radius of the arc - int r = TQMIN( width(), height() )/2; - // length of the whole arc - int l = (int)(r*(d->wrapping ? 6 : 5)*m_pi/6); - // length of the arc from minValue() to minValue()+pageStep() - if ( maxValue() > minValue()+pageStep() ) - l = (int)(0.5 + l * pageStep() / (maxValue()-minValue())); - // length of a lineStep() arc - l = l * lineStep() / pageStep(); - if ( l < 1 ) - l = 1; - // how many times lineStep can be draw in d->target pixels - l = (int)(0.5 + d->target / l); - // we want notchSize() to be a non-zero multiple of lineStep() - if ( !l ) - l = 1; - return lineStep() * l; -} - -void TQDial::setNotchTarget( double target ) -{ - d->lines.resize( 0 ); - d->target = target; - d->eraseAreaValid = FALSE; - d->onlyOutside = TRUE; - repaintScreen(); - d->onlyOutside = FALSE; -} - - -/*! - \property TQDial::notchTarget - \brief the target number of pixels between notches - - The notch target is the number of pixels TQDial attempts to put - between each notch. - - The actual size may differ from the target size. -*/ - -double TQDial::notchTarget() const -{ - return d->target; -} - - -/*! - Increments the dial's value() by one pageStep() of steps. -*/ - -void TQDial::addPage() -{ - TQRangeControl::addPage(); -} - - -/*! - Decrements the dial's value() by one pageStep() of steps. -*/ - -void TQDial::subtractPage() -{ - TQRangeControl::subtractPage(); -} - - -/*! - \fn void TQDial::valueChanged( int value ) - - This signal is emitted whenever the dial's \a value changes. The - frequency of this signal is influenced by setTracking(). -*/ - -/*! - \fn void TQDial::dialPressed() - - This signal is emitted when the user begins mouse interaction with - the dial. - - \sa dialReleased() -*/ - -/*! - \fn void TQDial::dialMoved( int value ) - - This signal is emitted whenever the dial \a value changes. The - frequency of this signal is \e not influenced by setTracking(). - - \sa valueChanged() -*/ - -/*! - \fn void TQDial::dialReleased() - - This signal is emitted when the user ends mouse interaction with - the dial. - - \sa dialPressed() -*/ - -void TQDial::setNotchesVisible( bool b ) -{ - d->showNotches = b; - d->eraseAreaValid = FALSE; - d->onlyOutside = TRUE; - repaintScreen(); - d->onlyOutside = FALSE; -} - -/*! - \property TQDial::notchesVisible - \brief whether the notches are shown - - If TRUE, the notches are shown. If FALSE (the default) notches are - not shown. -*/ -bool TQDial::notchesVisible() const -{ - return d->showNotches; -} - -/*! - \reimp -*/ - -TQSize TQDial::minimumSizeHint() const -{ - return TQSize( 50, 50 ); -} - -/*! - \reimp -*/ - -TQSize TQDial::sizeHint() const -{ - return TQSize( 100, 100 ).expandedTo( TQApplication::globalStrut() ); -} - - - -/*! - \internal -*/ - -TQPointArray TQDial::calcArrow( double &a ) const -{ - int r = TQMIN( width(), height() ) / 2; - if ( maxValue() == minValue() ) - a = m_pi / 2; - else if ( d->wrapping ) - a = m_pi * 3 / 2 - ( value() - minValue() ) * 2 * m_pi / ( maxValue() - minValue() ); - else - a = ( m_pi * 8 - ( value() - minValue() ) * 10 * m_pi / ( maxValue() - minValue() ) ) / 6; - - int xc = width() / 2; - int yc = height() / 2; - - int len = r - calcBigLineSize() - 5; - if ( len < 5 ) - len = 5; - int back = len / 4; - if ( back < 1 ) - back = 1; - - TQPointArray arrow( 3 ); - arrow[0] = TQPoint( (int)( 0.5 + xc + len * cos(a) ), - (int)( 0.5 + yc -len * sin( a ) ) ); - arrow[1] = TQPoint( (int)( 0.5 + xc + back * cos( a + m_pi * 5 / 6 ) ), - (int)( 0.5 + yc - back * sin( a + m_pi * 5 / 6 ) ) ); - arrow[2] = TQPoint( (int)( 0.5 + xc + back * cos( a - m_pi * 5 / 6 ) ), - (int)( 0.5 + yc - back * sin( a - m_pi * 5 / 6 ) ) ); - return arrow; -} - -/*! - \internal -*/ - -TQRect TQDial::calcDial() const -{ - double r = TQMIN( width(), height() ) / 2.0; - double d_ = r / 6.0; - double dx = d_ + ( width() - 2 * r ) / 2.0 + 1; - double dy = d_ + ( height() - 2 * r ) / 2.0 + 1; - return TQRect( int(dx), int(dy), - int(r * 2 - 2 * d_ - 2), int(r * 2 - 2 * d_ - 2) ); -} - -/*! - \internal -*/ - -int TQDial::calcBigLineSize() const -{ - int r = TQMIN( width(), height() ) / 2; - int bigLineSize = r / 6; - if ( bigLineSize < 4 ) - bigLineSize = 4; - if ( bigLineSize > r / 2 ) - bigLineSize = r / 2; - return bigLineSize; -} - -/*! - \internal -*/ - -void TQDial::calcLines() -{ - if ( !d->lines.size() ) { - double r = TQMIN( width(), height() ) / 2.0; - int bigLineSize = calcBigLineSize(); - double xc = width() / 2.0; - double yc = height() / 2.0; - int ns = notchSize(); - int notches = ( maxValue() + ns - 1 - minValue() ) / ns; - d->lines.resize( 2 + 2 * notches ); - int smallLineSize = bigLineSize / 2; - int i; - for( i = 0; i <= notches; i++ ) { - double angle = d->wrapping - ? m_pi * 3 / 2 - i * 2 * m_pi / notches - : (m_pi * 8 - i * 10 * m_pi / notches) / 6; - - double s = sin( angle ); // sin/cos aren't defined as const... - double c = cos( angle ); - if ( i == 0 || ( ((ns * i ) % pageStep() ) == 0 ) ) { - d->lines[2*i] = TQPoint( (int)( xc + ( r - bigLineSize ) * c ), - (int)( yc - ( r - bigLineSize ) * s ) ); - d->lines[2*i+1] = TQPoint( (int)( xc + r * c ), - (int)( yc - r * s ) ); - } else { - d->lines[2*i] = TQPoint( (int)( xc + ( r - 1 - smallLineSize ) * c ), - (int)( yc - ( r - 1 - smallLineSize ) * s ) ); - d->lines[2*i+1] = TQPoint( (int)( xc + ( r - 1 ) * c ), - (int)( yc -( r - 1 ) * s ) ); - } - } - } -} - -/*! - \property TQDial::minValue - \brief the current minimum value - - When setting this property, the \l TQDial::maxValue is adjusted if - necessary to ensure that the range remains valid. - - \sa setRange() -*/ -int TQDial::minValue() const -{ - return TQRangeControl::minValue(); -} - -/*! - \property TQDial::maxValue - \brief the current maximum value - - When setting this property, the \l TQDial::minValue is adjusted if - necessary to ensure that the range remains valid. - - \sa setRange() -*/ -int TQDial::maxValue() const -{ - return TQRangeControl::maxValue(); -} - -void TQDial::setMinValue( int minVal ) -{ - TQRangeControl::setMinValue( minVal ); -} - -void TQDial::setMaxValue( int maxVal ) -{ - TQRangeControl::setMaxValue( maxVal ); -} - -/*! - \property TQDial::lineStep - \brief the current line step - - setLineStep() calls the virtual stepChange() function if the new - line step is different from the previous setting. - - \sa TQRangeControl::setSteps() pageStep setRange() -*/ - -int TQDial::lineStep() const -{ - return TQRangeControl::lineStep(); -} - -/*! - \property TQDial::pageStep - \brief the current page step - - setPageStep() calls the virtual stepChange() function if the new - page step is different from the previous setting. - - \sa stepChange() -*/ -int TQDial::pageStep() const -{ - return TQRangeControl::pageStep(); -} - -void TQDial::setLineStep( int i ) -{ - setSteps( i, pageStep() ); -} - -void TQDial::setPageStep( int i ) -{ - setSteps( lineStep(), i ); -} - -/*! - \property TQDial::value - \brief the current dial value - - This is guaranteed to be within the range - \l{TQDial::minValue}..\l{TQDial::maxValue}. - - \sa minValue maxValue -*/ - -int TQDial::value() const -{ - return TQRangeControl::value(); -} - -#endif // QT_FEATURE_DIAL diff --git a/src/widgets/qdialogbuttons.cpp b/src/widgets/qdialogbuttons.cpp deleted file mode 100644 index d75a16f96..000000000 --- a/src/widgets/qdialogbuttons.cpp +++ /dev/null @@ -1,462 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQDialogButtons class -** -** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "qdialogbuttons_p.h" -#ifndef TQT_NO_DIALOGBUTTONS - -#include -#include -#include -#include -#include -#ifndef TQT_NO_DIALOG -#include -#endif // TQT_NO_DIALOG -#include -#include -#include - -struct TQDialogButtonsPrivate -{ - TQMap text; - TQMap buttons; - TQGuardedPtr custom; - TQ_UINT32 enabled, visible; - TQDialogButtons::Button def; - TQt::Orientation orient; - bool questionMode; -}; - -#ifndef TQT_NO_DIALOG -TQDialogButtons::TQDialogButtons(TQDialog *parent, bool autoConnect, TQ_UINT32 buttons, - Orientation orient, const char *name ) : TQWidget(parent, name) -{ - init(buttons, orient); - if(parent && autoConnect) { - TQObject::connect(this, TQ_SIGNAL(acceptClicked()), parent, TQ_SLOT(accept())); - TQObject::connect(this, TQ_SIGNAL(rejectClicked()), parent, TQ_SLOT(reject())); - } -} -#endif // TQT_NO_DIALOG - -TQDialogButtons::TQDialogButtons(TQWidget *parent, TQ_UINT32 buttons, - Orientation orient, const char *name ) : TQWidget(parent, name) -{ - init(buttons, orient); -} - -void -TQDialogButtons::init(TQ_UINT32 buttons, Orientation orient) -{ - if(buttons == All) { - tqWarning("TQDialogButtons: cannot specify All by itself!"); - buttons = None; - } - d = new TQDialogButtonsPrivate; - d->questionMode = FALSE; - d->orient = orient; - d->def = (Button)style().styleHint(TQStyle::SH_DialogButtons_DefaultButton, this); - d->enabled = d->visible = buttons; -} - -TQDialogButtons::~TQDialogButtons() -{ - delete (TQWidget *)d->custom; - delete d; -} - -void -TQDialogButtons::setQuestionMode(bool b) -{ - d->questionMode = b; -} - -bool -TQDialogButtons::questionMode() const -{ - return d->questionMode; -} - -void -TQDialogButtons::setButtonEnabled(Button button, bool enabled) -{ - if(enabled) - d->enabled |= button; - else - d->enabled ^= button; - if(d->buttons.contains(button)) - d->buttons[button]->setEnabled(enabled); -} - -bool -TQDialogButtons::isButtonEnabled(Button button) const -{ - return ((int)(d->enabled & button)) == button; -} - -void -TQDialogButtons::setButtonVisible(Button button, bool visible) -{ - if(visible) { - if(d->buttons.contains(button)) - d->buttons[button]->show(); - d->visible |= button; - } else { - if(d->buttons.contains(button)) - d->buttons[button]->hide(); - d->visible ^= button; - } - layoutButtons(); -} - -bool -TQDialogButtons::isButtonVisible(Button button) const -{ - return ((int)(d->visible & button)) == button; -} - -TQ_UINT32 -TQDialogButtons::visibleButtons() const -{ - return d->visible; -} - -void -TQDialogButtons::addWidget(TQWidget *w) -{ - TQBoxLayout *lay = NULL; - if(!d->custom) { - d->custom = new TQWidget(this, "dialog_custom_area"); - if(orientation() == Horizontal) - lay = new TQHBoxLayout(d->custom); - else - lay = new TQVBoxLayout(d->custom); - layoutButtons(); - } else { - lay = (TQBoxLayout*)d->custom->layout(); - } - if(w->parent() != d->custom) - w->reparent(d->custom, 0, TQPoint(0, 0), TRUE); - lay->addWidget(w); -} - -void -TQDialogButtons::setDefaultButton(Button button) -{ - if(!((int)(d->visible & button) == button)) { - tqWarning("TQDialogButtons: Button '%d' is not visible (so cannot be default)", button); - return; - } - if(d->def != button) { -#ifndef TQT_NO_PROPERTIES - if(d->buttons.contains(d->def)) - d->buttons[d->def]->setProperty("default", TQVariant(false)); -#endif - d->def = button; -#ifndef TQT_NO_PROPERTIES - if(d->buttons.contains(d->def)) - d->buttons[d->def]->setProperty("default", TQVariant(false)); -#endif - } -} - -TQDialogButtons::Button -TQDialogButtons::defaultButton() const -{ - return d->def; -} - -void -TQDialogButtons::setButtonText(Button button, const TQString &str) -{ - d->text[button] = str; -#ifndef TQT_NO_PROPERTIES - if(d->buttons.contains(button)) - d->buttons[button]->setProperty("text", TQVariant(str)); -#endif - layoutButtons(); -} - -TQString -TQDialogButtons::buttonText(Button b) const -{ - if(d->text.contains(b)) - return d->text[b]; - return TQString(); //null if it is default.. -} - -void -TQDialogButtons::setOrientation(Orientation orient) -{ - if(d->orient != orient) { - d->orient = orient; - if(d->custom && d->custom->layout()) - ((TQBoxLayout*)d->custom->layout())->setDirection(orient == Horizontal ? TQBoxLayout::LeftToRight : - TQBoxLayout::TopToBottom); - layoutButtons(); - } -} - -TQt::Orientation -TQDialogButtons::orientation() const -{ - return d->orient; -} - -TQWidget * -TQDialogButtons::createButton(Button b) -{ - TQPushButton *ret = new TQPushButton(this, "qdialog_button"); - TQObject::connect(ret, TQ_SIGNAL(clicked()), this, TQ_SLOT(handleClicked())); - if(d->text.contains(b)) { - ret->setText(d->text[b]); - } else { - switch(b) { - case All: { - TQString txt = buttonText(defaultButton()); - if(txt.isNull()) { - if(defaultButton() == Accept) { - if(questionMode()) - txt = tr("Yes to All"); - else - txt = tr("OK to All"); - } else { - if(questionMode()) - txt = tr("No to All"); - else - txt = tr("Cancel All"); - } - } else { - txt += tr(" to All"); //ick, I can't really do this!! - } - ret->setText(txt); - break; } - case Accept: - if(questionMode()) - ret->setText(tr("Yes")); - else - ret->setText(tr("OK")); - break; - case Reject: - if(questionMode()) - ret->setText(tr("No")); - else - ret->setText(tr("Cancel")); - break; - case Apply: - ret->setText(tr("Apply")); - break; - case Ignore: - ret->setText(tr("Ignore")); - break; - case Retry: - ret->setText(tr("Retry")); - break; - case Abort: - ret->setText(tr("Abort")); - break; - case Help: - ret->setText(tr("Help")); - break; - default: - break; - } - } - return ret; -} - -void -TQDialogButtons::handleClicked() -{ - const TQObject *s = sender(); - if(!s) - return; - - for(TQMapIterator it = d->buttons.begin(); it != d->buttons.end(); ++it) { - if(it.data() == s) { - emit clicked((TQDialogButtons::Button)it.key()); - switch(it.key()) { - case Retry: - emit retryClicked(); - break; - case Ignore: - emit ignoreClicked(); - break; - case Abort: - emit abortClicked(); - break; - case All: - emit allClicked(); - break; - case Accept: - emit acceptClicked(); - break; - case Reject: - emit rejectClicked(); - break; - case Apply: - emit applyClicked(); - break; - case Help: - emit helpClicked(); - break; - default: - break; - } - return; - } - } -} - -void -TQDialogButtons::resizeEvent(TQResizeEvent *) -{ - layoutButtons(); -} - -void -TQDialogButtons::showEvent(TQShowEvent *) -{ - layoutButtons(); -} - -void -TQDialogButtons::styleChanged(TQStyle &old) -{ - layoutButtons(); - TQWidget::styleChange(old); -} - -void -TQDialogButtons::layoutButtons() -{ - if(!isVisible()) //nah.. - return; - - TQStyle::SubRect rects[] = { - TQStyle::SR_DialogButtonAccept, TQStyle::SR_DialogButtonReject, - TQStyle::SR_DialogButtonApply, TQStyle::SR_DialogButtonHelp, - TQStyle::SR_DialogButtonCustom, TQStyle::SR_DialogButtonAll, - TQStyle::SR_DialogButtonRetry, TQStyle::SR_DialogButtonIgnore, - TQStyle::SR_DialogButtonAbort }; - for(unsigned int i = 0; i < (sizeof(rects) / sizeof(rects[0])); i++) { - TQWidget *w = NULL; - if(rects[i] == TQStyle::SR_DialogButtonCustom) { - w = d->custom; - } else { - Button b = None; - if(rects[i] == TQStyle::SR_DialogButtonApply) - b = Apply; - else if(rects[i] == TQStyle::SR_DialogButtonAll) - b = All; - else if(rects[i] == TQStyle::SR_DialogButtonAccept) - b = Accept; - else if(rects[i] == TQStyle::SR_DialogButtonReject) - b = Reject; - else if(rects[i] == TQStyle::SR_DialogButtonHelp) - b = Help; - else if(rects[i] == TQStyle::SR_DialogButtonRetry) - b = Retry; - else if(rects[i] == TQStyle::SR_DialogButtonAbort) - b = Abort; - else if(rects[i] == TQStyle::SR_DialogButtonIgnore) - b = Ignore; - if(b != None) { - if(d->buttons.contains(b)) { - w = d->buttons[b]; - if(!(d->visible & b)) { - w->hide(); - continue; - } - } else if(d->visible & b) { - w = createButton(b); - d->buttons.insert(b, w); - } else { - continue; - } - if(w) { - if(b == d->def) { - w->setFocus(); -#ifndef TQT_NO_PROPERTIES - w->setProperty("default", TQVariant(true)); -#endif - } - w->setEnabled(d->enabled & b); - } - } - } - if(w) { - w->show(); - w->setGeometry(style().subRect(rects[i], this)); - } - } -} - -TQSize -TQDialogButtons::sizeHint() const -{ - constPolish(); - TQSize s; - if(d->custom) - s = d->custom->sizeHint(); - return (style().sizeFromContents(TQStyle::CT_DialogButtons, this, s. - expandedTo(TQApplication::globalStrut()))); -} - -TQSize -TQDialogButtons::sizeHint(TQDialogButtons::Button button) const -{ - TQWidget *w = NULL; - if(d->visible & button) { - if(!d->buttons.contains(button)) { - TQDialogButtons *that = (TQDialogButtons*)this; //ick, constness.. - w = that->createButton(button); - that->d->buttons.insert(button, w); - } else { - w = d->buttons[button]; - } - } - return w->sizeHint(); -} - -TQSize -TQDialogButtons::minimumSizeHint() const -{ - return sizeHint(); -} -#endif diff --git a/src/widgets/qdialogbuttons_p.h b/src/widgets/qdialogbuttons_p.h deleted file mode 100644 index a5667245f..000000000 --- a/src/widgets/qdialogbuttons_p.h +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Definition of TQDialogButtons class. -** -** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQDIALOGBUTTONS_P_H -#define TQDIALOGBUTTONS_P_H - -#ifndef QT_H -#ifndef QT_H -#include "tqwidget.h" -#endif // QT_H -#endif - -#ifndef TQT_NO_DIALOGBUTTONS -struct TQDialogButtonsPrivate; - -class -TQDialogButtons : public TQWidget -{ - TQ_OBJECT -public: - enum Button { None=0, Accept=0x01, Reject=0x02, Help=0x04, Apply=0x08, All=0x10, Abort=0x20, Retry=0x40, Ignore=0x80 }; -#ifndef TQT_NO_DIALOG - TQDialogButtons(TQDialog *parent, bool autoConnect = TRUE, TQ_UINT32 buttons = Accept | Reject, - Orientation orient = Horizontal, const char *name = NULL); -#endif // TQT_NO_DIALOG - TQDialogButtons(TQWidget *parent, TQ_UINT32 buttons = Accept | Reject, - Orientation orient = Horizontal, const char *name = NULL); - ~TQDialogButtons(); - - void setQuestionMode(bool); - bool questionMode() const; - - void setButtonEnabled(Button button, bool enabled); - bool isButtonEnabled(Button) const; - - inline void showButton(Button b) { setButtonVisible(b, TRUE) ; } - inline void hideButton(Button b) { setButtonVisible(b, FALSE); } - virtual void setButtonVisible(Button, bool visible); - bool isButtonVisible(Button) const; - TQ_UINT32 visibleButtons() const; - - void addWidget(TQWidget *); - - virtual void setDefaultButton(Button); - Button defaultButton() const; - - virtual void setButtonText(Button, const TQString &); - TQString buttonText(Button) const; - - void setOrientation(Orientation); - Orientation orientation() const; - - virtual TQSize sizeHint(Button) const; - TQSize minimumSizeHint() const; - TQSize sizeHint() const; - -protected: - void layoutButtons(); - virtual TQWidget *createButton(Button); - - void showEvent(TQShowEvent *); - void resizeEvent(TQResizeEvent *); - void styleChanged(TQStyle &); - -private slots: - void handleClicked(); - -signals: - void clicked(Button); - void acceptClicked(); - void rejectClicked(); - void helpClicked(); - void applyClicked(); - void allClicked(); - void retryClicked(); - void ignoreClicked(); - void abortClicked(); - -private: - TQDialogButtonsPrivate *d; - void init(TQ_UINT32, Orientation); -}; -#endif //TQT_NO_DIALOGBUTTONS -#endif //TQDIALOGBUTTONS_P_H diff --git a/src/widgets/qeffects.cpp b/src/widgets/qeffects.cpp index 6f9176175..b98de479f 100644 --- a/src/widgets/qeffects.cpp +++ b/src/widgets/qeffects.cpp @@ -47,7 +47,7 @@ #include "tqtimer.h" #include "tqdatetime.h" #include "ntqguardedptr.h" -#include "ntqscrollview.h" +#include "tqscrollview.h" /* Internal class to get access to protected TQWidget-members diff --git a/src/widgets/qeffects_p.h b/src/widgets/qeffects_p.h index dad8fce9f..d3beb3055 100644 --- a/src/widgets/qeffects_p.h +++ b/src/widgets/qeffects_p.h @@ -47,7 +47,7 @@ // ------------- // // This file is not part of the TQt API. It exists for the convenience -// of qeffects.cpp, qcombobox.cpp, tqpopupmenu.cpp and tqtooltip.cpp. +// of qeffects.cpp, tqcombobox.cpp, tqpopupmenu.cpp and tqtooltip.cpp. // This header file may change from version to version without notice, // or even be removed. // diff --git a/src/widgets/qgroupbox.cpp b/src/widgets/qgroupbox.cpp index 5145a5698..f37b5f6d7 100644 --- a/src/widgets/qgroupbox.cpp +++ b/src/widgets/qgroupbox.cpp @@ -44,13 +44,13 @@ #include "tqpainter.h" #include "tqbitmap.h" #include "ntqaccel.h" -#include "ntqradiobutton.h" +#include "tqradiobutton.h" #include "ntqfocusdata.h" #include "tqobjectlist.h" #include "ntqdrawutil.h" #include "ntqapplication.h" #include "tqstyle.h" -#include "ntqcheckbox.h" +#include "tqcheckbox.h" #include "ntqbuttongroup.h" #if defined(QT_ACCESSIBILITY_SUPPORT) #include "ntqaccessible.h" diff --git a/src/widgets/qlcdnumber.cpp b/src/widgets/qlcdnumber.cpp deleted file mode 100644 index 246804f45..000000000 --- a/src/widgets/qlcdnumber.cpp +++ /dev/null @@ -1,1170 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQLCDNumber class -** -** Created : 940518 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqlcdnumber.h" -#ifndef TQT_NO_LCDNUMBER -#include "tqbitarray.h" -#include "tqpainter.h" - - -/*! - \class TQLCDNumber ntqlcdnumber.h - - \brief The TQLCDNumber widget displays a number with LCD-like digits. - - \ingroup basic - \mainclass - - It can display a number in just about any size. It can display - decimal, hexadecimal, octal or binary numbers. It is easy to - connect to data sources using the display() slot, which is - overloaded to take any of five argument types. - - There are also slots to change the base with setMode() and the - decimal point with setSmallDecimalPoint(). - - TQLCDNumber emits the overflow() signal when it is asked to display - something beyond its range. The range is set by setNumDigits(), - but setSmallDecimalPoint() also influences it. If the display is - set to hexadecimal, octal or binary, the integer equivalent of the - value is displayed. - - These digits and other symbols can be shown: 0/O, 1, 2, 3, 4, 5/S, - 6, 7, 8, 9/g, minus, decimal point, A, B, C, D, E, F, h, H, L, o, - P, r, u, U, Y, colon, degree sign (which is specified as single - quote in the string) and space. TQLCDNumber substitutes spaces for - illegal characters. - - It is not possible to retrieve the contents of a TQLCDNumber - object, although you can retrieve the numeric value with value(). - If you really need the text, we recommend that you connect the - signals that feed the display() slot to another slot as well and - store the value there. - - Incidentally, TQLCDNumber is the very oldest part of TQt, tracing - back to a BASIC program on the \link - http://www.nvg.ntnu.no/sinclair/computers/zxspectrum/zxspectrum.htm - Sinclair Spectrum\endlink. - - - - \sa TQLabel, TQFrame -*/ - -/*! - \enum TQLCDNumber::Mode - - This type determines how numbers are shown. - - \value Hex Hexadecimal - \value Dec Decimal - \value Oct Octal - \value Bin Binary - - If the display is set to hexadecimal, octal or binary, the integer - equivalent of the value is displayed. -*/ - -/*! - \enum TQLCDNumber::SegmentStyle - - This type determines the visual appearance of the TQLCDNumber - widget. - - \value Outline gives raised segments filled with the background brush. - \value Filled gives raised segments filled with the foreground brush. - \value Flat gives flat segments filled with the foreground brush. -*/ - - - -/*! - \fn void TQLCDNumber::overflow() - - This signal is emitted whenever the TQLCDNumber is asked to display - a too-large number or a too-long string. - - It is never emitted by setNumDigits(). -*/ - - -static TQString int2string( int num, int base, int ndigits, bool *oflow ) -{ - TQString s; - bool negative; - if ( num < 0 ) { - negative = TRUE; - num = -num; - } else { - negative = FALSE; - } - switch( base ) { - case TQLCDNumber::HEX: - s.sprintf( "%*x", ndigits, num ); - break; - case TQLCDNumber::DEC: - s.sprintf( "%*i", ndigits, num ); - break; - case TQLCDNumber::OCT: - s.sprintf( "%*o", ndigits, num ); - break; - case TQLCDNumber::BIN: - { - char buf[42]; - char *p = &buf[41]; - uint n = num; - int len = 0; - *p = '\0'; - do { - *--p = (char)((n&1)+'0'); - n >>= 1; - len++; - } while ( n != 0 ); - len = ndigits - len; - if ( len > 0 ) - s.fill( ' ', len ); - s += TQString::fromLatin1(p); - } - break; - } - if ( negative ) { - for ( int i=0; i<(int)s.length(); i++ ) { - if ( s[i] != ' ' ) { - if ( i != 0 ) { - s[i-1] = '-'; - } else { - s.insert( 0, '-' ); - } - break; - } - } - } - if ( oflow ) - *oflow = (int)s.length() > ndigits; - return s; -} - - -static TQString double2string( double num, int base, int ndigits, bool *oflow ) -{ - TQString s; - if ( base != TQLCDNumber::DEC ) { - bool of = num >= 2147483648.0 || num < -2147483648.0; - if ( of ) { // oops, integer overflow - if ( oflow ) - *oflow = TRUE; - return s; - } - s = int2string( (int)num, base, ndigits, 0 ); - } else { // decimal base - int nd = ndigits; - do { - s.sprintf( "%*.*g", ndigits, nd, num ); - int i = s.find('e'); - if ( i > 0 && s[i+1]=='+' ) { - s[i] = ' '; - s[i+1] = 'e'; - } - } while (nd-- && (int)s.length() > ndigits); - } - if ( oflow ) - *oflow = (int)s.length() > ndigits; - return s; -} - - -static const char *getSegments( char ch ) // gets list of segments for ch -{ - static const char segments[30][8] = - { { 0, 1, 2, 4, 5, 6,99, 0}, // 0 0 / O - { 2, 5,99, 0, 0, 0, 0, 0}, // 1 1 - { 0, 2, 3, 4, 6,99, 0, 0}, // 2 2 - { 0, 2, 3, 5, 6,99, 0, 0}, // 3 3 - { 1, 2, 3, 5,99, 0, 0, 0}, // 4 4 - { 0, 1, 3, 5, 6,99, 0, 0}, // 5 5 / S - { 0, 1, 3, 4, 5, 6,99, 0}, // 6 6 - { 0, 2, 5,99, 0, 0, 0, 0}, // 7 7 - { 0, 1, 2, 3, 4, 5, 6,99}, // 8 8 - { 0, 1, 2, 3, 5, 6,99, 0}, // 9 9 / g - { 3,99, 0, 0, 0, 0, 0, 0}, // 10 - - { 7,99, 0, 0, 0, 0, 0, 0}, // 11 . - { 0, 1, 2, 3, 4, 5,99, 0}, // 12 A - { 1, 3, 4, 5, 6,99, 0, 0}, // 13 B - { 0, 1, 4, 6,99, 0, 0, 0}, // 14 C - { 2, 3, 4, 5, 6,99, 0, 0}, // 15 D - { 0, 1, 3, 4, 6,99, 0, 0}, // 16 E - { 0, 1, 3, 4,99, 0, 0, 0}, // 17 F - { 1, 3, 4, 5,99, 0, 0, 0}, // 18 h - { 1, 2, 3, 4, 5,99, 0, 0}, // 19 H - { 1, 4, 6,99, 0, 0, 0, 0}, // 20 L - { 3, 4, 5, 6,99, 0, 0, 0}, // 21 o - { 0, 1, 2, 3, 4,99, 0, 0}, // 22 P - { 3, 4,99, 0, 0, 0, 0, 0}, // 23 r - { 4, 5, 6,99, 0, 0, 0, 0}, // 24 u - { 1, 2, 4, 5, 6,99, 0, 0}, // 25 U - { 1, 2, 3, 5, 6,99, 0, 0}, // 26 Y - { 8, 9,99, 0, 0, 0, 0, 0}, // 27 : - { 0, 1, 2, 3,99, 0, 0, 0}, // 28 ' - {99, 0, 0, 0, 0, 0, 0, 0} }; // 29 empty - - if (ch >= '0' && ch <= '9') - return segments[ch - '0']; - if (ch >= 'A' && ch <= 'F') - return segments[ch - 'A' + 12]; - if (ch >= 'a' && ch <= 'f') - return segments[ch - 'a' + 12]; - - int n; - switch ( ch ) { - case '-': - n = 10; break; - case 'O': - n = 0; break; - case 'g': - n = 9; break; - case '.': - n = 11; break; - case 'h': - n = 18; break; - case 'H': - n = 19; break; - case 'l': - case 'L': - n = 20; break; - case 'o': - n = 21; break; - case 'p': - case 'P': - n = 22; break; - case 'r': - case 'R': - n = 23; break; - case 's': - case 'S': - n = 5; break; - case 'u': - n = 24; break; - case 'U': - n = 25; break; - case 'y': - case 'Y': - n = 26; break; - case ':': - n = 27; break; - case '\'': - n = 28; break; - default: - n = 29; break; - } - return segments[n]; -} - - -/*! - Constructs an LCD number, sets the number of digits to 5, the base - to decimal, the decimal point mode to 'small' and the frame style - to a raised box. The segmentStyle() is set to \c Outline. - - The \a parent and \a name arguments are passed to the TQFrame - constructor. - - \sa setNumDigits(), setSmallDecimalPoint() -*/ - -TQLCDNumber::TQLCDNumber( TQWidget *parent, const char *name ) - : TQFrame( parent, name ) -{ - ndigits = 5; - init(); -} - - -/*! - Constructs an LCD number, sets the number of digits to \a - numDigits, the base to decimal, the decimal point mode to 'small' - and the frame style to a raised box. The segmentStyle() is set to - \c Outline. - - The \a parent and \a name arguments are passed to the TQFrame - constructor. - - \sa setNumDigits(), setSmallDecimalPoint() -*/ - -TQLCDNumber::TQLCDNumber( uint numDigits, TQWidget *parent, const char *name ) - : TQFrame( parent, name ) -{ - ndigits = numDigits; - init(); -} - -/*! - \internal -*/ - -void TQLCDNumber::init() -{ - setFrameStyle( TQFrame::Box | TQFrame::Raised ); - val = 0; - base = DEC; - smallPoint = FALSE; - setNumDigits( ndigits ); - setSegmentStyle( Outline ); - d = 0; - setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Minimum ) ); -} - -/*! - Destroys the LCD number. -*/ - -TQLCDNumber::~TQLCDNumber() -{ -} - - -/*! - \property TQLCDNumber::numDigits - \brief the current number of digits displayed - - Corresponds to the current number of digits. If \l - TQLCDNumber::smallDecimalPoint is FALSE, the decimal point occupies - one digit position. - - \sa numDigits, smallDecimalPoint -*/ - -void TQLCDNumber::setNumDigits( int numDigits ) -{ - if ( numDigits > 99 ) { -#if defined(QT_CHECK_RANGE) - tqWarning( "TQLCDNumber::setNumDigits: (%s) Max 99 digits allowed", - name( "unnamed" ) ); -#endif - numDigits = 99; - } - if (numDigits < 0 ) { -#if defined(QT_CHECK_RANGE) - tqWarning( "TQLCDNumber::setNumDigits: (%s) Min 0 digits allowed", - name( "unnamed" ) ); -#endif - numDigits = 0; - } - if ( digitStr.isNull() ) { // from constructor - ndigits = numDigits; - digitStr.fill( ' ', ndigits ); - points.fill( 0, ndigits ); - digitStr[ndigits - 1] = '0'; // "0" is the default number - } else { - bool doDisplay = ndigits == 0; - if ( numDigits == ndigits ) // no change - return; - int i; - int dif; - if ( numDigits > ndigits ) { // expand - dif = numDigits - ndigits; - TQString buf; - buf.fill( ' ', dif ); - digitStr.insert( 0, buf ); - points.resize( numDigits ); - for ( i=numDigits-1; i>=dif; i-- ) - points.setBit( i, points.testBit(i-dif) ); - for ( i=0; i=0; i-- ) { - buffer[ndigits - 1 - index + i] = buffer[i]; - newPoints.setBit( ndigits - 1 - index + i, - newPoints.testBit(i) ); - } - for( i=0; i xSegLen ? xSegLen : ySegLen; - int xAdvance = segLen*( 5 + digitSpace )/5; - int xOffset = ( width() - ndigits*xAdvance + segLen/5 )/2; - int yOffset = ( height() - segLen*2 )/2; - - for ( int i=0; itestBit(i) ? '.' : ' '; - if ( newString ) { - char oldPoint = points.testBit(i) ? '.' : ' '; - drawDigit( pos, p, segLen, newPoint, oldPoint ); - } else { - drawDigit( pos, p, segLen, newPoint ); - } - } - } - if ( newString ) { - digitStr = s; - if ( (int)digitStr.length() > ndigits ) - digitStr.truncate( ndigits ); - if ( newPoints ) - points = *newPoints; - } -} - - -/*! - \internal -*/ - -void TQLCDNumber::drawDigit( const TQPoint &pos, TQPainter &p, int segLen, - char newCh, char oldCh ) -{ -// Draws and/or erases segments to change display of a single digit -// from oldCh to newCh - - char updates[18][2]; // can hold 2 times number of segments, only - // first 9 used if segment table is correct - int nErases; - int nUpdates; - const char *segs; - int i,j; - - const char erase = 0; - const char draw = 1; - const char leaveAlone = 2; - - segs = getSegments(oldCh); - for ( nErases=0; segs[nErases] != 99; nErases++ ) { - updates[nErases][0] = erase; // get segments to erase to - updates[nErases][1] = segs[nErases]; // remove old char - } - nUpdates = nErases; - segs = getSegments(newCh); - for(i = 0 ; segs[i] != 99 ; i++) { - for ( j=0; j -#endif -#if defined(QT_ACCESSIBILITY_SUPPORT) -#include "ntqaccessible.h" -#endif - -#ifndef TQT_NO_ACCEL -#include "ntqkeysequence.h" -#define ACCEL_KEY(k) "\t" + TQString(TQKeySequence( TQt::CTRL | TQt::Key_ ## k )) -#else -#define ACCEL_KEY(k) "\t" + TQString("Ctrl+" #k) -#endif - -#if defined(Q_OS_LINUX) -#define LINUX_MEMLOCK_LIMIT_BYTES 16384 -#define LINUX_MEMLOCK_LIMIT_CHARACTERS LINUX_MEMLOCK_LIMIT_BYTES/sizeof(TQChar) -#endif - -#define innerMargin 1 - -struct TQLineEditPrivate : public TQt -{ - TQLineEditPrivate( TQLineEdit *q ) - : q(q), cursor(0), cursorTimer(0), tripleClickTimer(0), frame(1), - cursorVisible(0), separator(0), readOnly(0), modified(0), - direction(TQChar::DirON), dragEnabled(1), alignment(0), - echoMode(0), textDirty(0), selDirty(0), validInput(1), - ascent(0), maxLength(32767), menuId(0), - hscroll(0), validator(0), maskData(0), - undoState(0), selstart(0), selend(0), - imstart(0), imend(0), imselstart(0), imselend(0) -#ifndef TQT_NO_DRAGANDDROP - ,dndTimer(0) -#endif - {} - void init( const TQString&); - - TQLineEdit *q; - TQString text; - int cursor; - int cursorTimer; - TQPoint tripleClick; - int tripleClickTimer; - uint frame : 1; - uint cursorVisible : 1; - uint separator : 1; - uint readOnly : 1; - uint modified : 1; - uint direction : 5; - uint dragEnabled : 1; - uint alignment : 3; - uint echoMode : 2; - uint textDirty : 1; - uint selDirty : 1; - uint validInput : 1; - int ascent; - int maxLength; - int menuId; - int hscroll; - TQChar passwordChar; // obsolete - - void finishChange( int validateFromState = -1, bool setModified = TRUE ); - - const TQValidator* validator; - struct MaskInputData { - enum Casemode { NoCaseMode, Upper, Lower }; - TQChar maskChar; // either the separator char or the inputmask - bool separator; - Casemode caseMode; - }; - TQString inputMask; - TQChar blank; - MaskInputData *maskData; - inline int nextMaskBlank( int pos ) { - int c = findInMask( pos, TRUE, FALSE ); - separator |= ( c != pos ); - return ( c != -1 ? c : maxLength ); - } - inline int prevMaskBlank( int pos ) { - int c = findInMask( pos, FALSE, FALSE ); - separator |= ( c != pos ); - return ( c != -1 ? c : 0 ); - } - - void setCursorVisible( bool visible ); - - - // undo/redo handling - enum CommandType { Separator, Insert, Remove, Delete, RemoveSelection, DeleteSelection }; - struct Command { - inline Command(){} - inline Command( CommandType type, int pos, TQChar c ) - :type(type),c(c),pos(pos){} - uint type : 4; - TQChar c; - int pos; - }; - int undoState; - TQValueVector history; - void addCommand( const Command& cmd ); - void insert( const TQString& s ); - void del( bool wasBackspace = FALSE ); - void remove( int pos ); - - inline void separate() { separator = TRUE; } - inline void undo( int until = -1 ) { - if ( !isUndoAvailable() ) - return; - deselect(); - while ( undoState && undoState > until ) { - Command& cmd = history[--undoState]; - switch ( cmd.type ) { - case Insert: - text.remove( cmd.pos, 1); - cursor = cmd.pos; - break; - case Remove: - case RemoveSelection: - text.insert( cmd.pos, cmd.c ); - cursor = cmd.pos + 1; - break; - case Delete: - case DeleteSelection: - text.insert( cmd.pos, cmd.c ); - cursor = cmd.pos; - break; - case Separator: - continue; - } - if ( until < 0 && undoState ) { - Command& next = history[undoState-1]; - if ( next.type != cmd.type && next.type < RemoveSelection - && !( cmd.type >= RemoveSelection && next.type != Separator ) ) - break; - } - } - modified = ( undoState != 0 ); - textDirty = TRUE; - } - inline void redo() { - if ( !isRedoAvailable() ) - return; - deselect(); - while ( undoState < (int)history.size() ) { - Command& cmd = history[undoState++]; - switch ( cmd.type ) { - case Insert: - text.insert( cmd.pos, cmd.c ); - cursor = cmd.pos + 1; - break; - case Remove: - case Delete: - case RemoveSelection: - case DeleteSelection: - text.remove( cmd.pos, 1 ); - cursor = cmd.pos; - break; - case Separator: - continue; - } - if ( undoState < (int)history.size() ) { - Command& next = history[undoState]; - if ( next.type != cmd.type && cmd.type < RemoveSelection - && !( next.type >= RemoveSelection && cmd.type != Separator ) ) - break; - } - } - textDirty = TRUE; - } - inline bool isUndoAvailable() const { return !readOnly && undoState; } - inline bool isRedoAvailable() const { return !readOnly && undoState < (int)history.size(); } - - // bidi - inline bool isRightToLeft() const { return direction==TQChar::DirON?text.isRightToLeft():(direction==TQChar::DirR); } - - // selection - int selstart, selend; - inline bool allSelected() const { return !text.isEmpty() && selstart == 0 && selend == (int)text.length(); } - inline bool hasSelectedText() const { return !text.isEmpty() && selend > selstart; } - inline void deselect() { selDirty |= (selend > selstart); selstart = selend = 0; } - void removeSelectedText(); -#ifndef TQT_NO_CLIPBOARD - void copy( bool clipboard = TRUE ) const; -#endif - inline bool inSelection( int x ) const - { if ( selstart >= selend ) return FALSE; - int pos = xToPos( x, TQTextItem::OnCharacters ); return pos >= selstart && pos < selend; } - - // masking - void parseInputMask( const TQString &maskFields ); - bool isValidInput( TQChar key, TQChar mask ) const; - TQString maskString( uint pos, const TQString &str, bool clear = FALSE ) const; - TQString clearString( uint pos, uint len ) const; - TQString stripString( const TQString &str ) const; - int findInMask( int pos, bool forward, bool findSeparator, TQChar searchChar = TQChar() ) const; - - // input methods - int imstart, imend, imselstart, imselend; - bool composeMode() const { return preeditLength(); } - bool hasIMSelection() const { return imSelectionLength(); } - int preeditLength() const { return ( imend - imstart ); } - int imSelectionLength() const { return ( imselend - imselstart ); } - - // complex text layout - TQTextLayout textLayout; - void updateTextLayout(); - void moveCursor( int pos, bool mark = FALSE ); - void setText( const TQString& txt ); - int xToPosInternal( int x, TQTextItem::CursorPosition ) const; - int xToPos( int x, TQTextItem::CursorPosition = TQTextItem::BetweenCharacters ) const; - inline int visualAlignment() const { return alignment ? alignment : int( isRightToLeft() ? AlignRight : AlignLeft ); } - TQRect cursorRect() const; - void updateMicroFocusHint(); - -#ifndef TQT_NO_DRAGANDDROP - // drag and drop - TQPoint dndPos; - int dndTimer; - bool drag(); -#endif -}; - - -/*! - \class TQLineEdit - \brief The TQLineEdit widget is a one-line text editor. - - \ingroup basic - \mainclass - - A line edit allows the user to enter and edit a single line of - plain text with a useful collection of editing functions, - including undo and redo, cut and paste, and drag and drop. - - By changing the echoMode() of a line edit, it can also be used as - a "write-only" field, for inputs such as passwords. - - The length of the text can be constrained to maxLength(). The text - can be arbitrarily constrained using a validator() or an - inputMask(), or both. - - A related class is TQTextEdit which allows multi-line, rich-text - editing. - - You can change the text with setText() or insert(). The text is - retrieved with text(); the displayed text (which may be different, - see \l{EchoMode}) is retrieved with displayText(). Text can be - selected with setSelection() or selectAll(), and the selection can - be cut(), copy()ied and paste()d. The text can be aligned with - setAlignment(). - - When the text changes the textChanged() signal is emitted; when - the Return or Enter key is pressed the returnPressed() signal is - emitted. Note that if there is a validator set on the line edit, - the returnPressed() signal will only be emitted if the validator - returns \c Acceptable. - - By default, TQLineEdits have a frame as specified by the Windows - and Motif style guides; you can turn it off by calling - setFrame(FALSE). - - The default key bindings are described below. The line edit also - provides a context menu (usually invoked by a right mouse click) - that presents some of these editing options. - \target desc - \table - \header \i Keypress \i Action - \row \i Left Arrow \i Moves the cursor one character to the left. - \row \i Shift+Left Arrow \i Moves and selects text one character to the left. - \row \i Right Arrow \i Moves the cursor one character to the right. - \row \i Shift+Right Arrow \i Moves and selects text one character to the right. - \row \i Home \i Moves the cursor to the beginning of the line. - \row \i End \i Moves the cursor to the end of the line. - \row \i Backspace \i Deletes the character to the left of the cursor. - \row \i Ctrl+Backspace \i Deletes the word to the left of the cursor. - \row \i Delete \i Deletes the character to the right of the cursor. - \row \i Ctrl+Delete \i Deletes the word to the right of the cursor. - \row \i Ctrl+A \i Moves the cursor to the beginning of the line. - \row \i Ctrl+B \i Moves the cursor one character to the left. - \row \i Ctrl+C \i Copies the selected text to the clipboard. - (Windows also supports Ctrl+Insert for this operation.) - \row \i Ctrl+D \i Deletes the character to the right of the cursor. - \row \i Ctrl+E \i Moves the cursor to the end of the line. - \row \i Ctrl+F \i Moves the cursor one character to the right. - \row \i Ctrl+H \i Deletes the character to the left of the cursor. - \row \i Ctrl+K \i Deletes to the end of the line. - \row \i Ctrl+V \i Pastes the clipboard text into line edit. - (Windows also supports Shift+Insert for this operation.) - \row \i Ctrl+X \i Deletes the selected text and copies it to the clipboard. - (Windows also supports Shift+Delete for this operation.) - \row \i Ctrl+Z \i Undoes the last operation. - \row \i Ctrl+Y \i Redoes the last undone operation. - \endtable - - Any other key sequence that represents a valid character, will - cause the character to be inserted into the line edit. - - - - \sa TQTextEdit TQLabel TQComboBox - \link guibooks.html#fowler GUI Design Handbook: Field, Entry\endlink -*/ - - -/*! - \fn void TQLineEdit::textChanged( const TQString& ) - - This signal is emitted whenever the text changes. The argument is - the new text. -*/ - -/*! - \fn void TQLineEdit::selectionChanged() - - This signal is emitted whenever the selection changes. - - \sa hasSelectedText(), selectedText() -*/ - -/*! - \fn void TQLineEdit::lostFocus() - - This signal is emitted when the line edit has lost focus. - - \sa hasFocus(), TQWidget::focusInEvent(), TQWidget::focusOutEvent() -*/ - - - -/*! - Constructs a line edit with no text. - - The maximum text length is set to 32767 characters. - - The \a parent and \a name arguments are sent to the TQWidget constructor. - - \sa setText(), setMaxLength() -*/ - -TQLineEdit::TQLineEdit( TQWidget* parent, const char* name ) - : TQFrame( parent, name, WNoAutoErase ), d(new TQLineEditPrivate( this )) -{ - d->init( TQString::null ); -} - -/*! - Constructs a line edit containing the text \a contents. - - The cursor position is set to the end of the line and the maximum - text length to 32767 characters. - - The \a parent and \a name arguments are sent to the TQWidget - constructor. - - \sa text(), setMaxLength() -*/ - -TQLineEdit::TQLineEdit( const TQString& contents, TQWidget* parent, const char* name ) - : TQFrame( parent, name, WNoAutoErase ), d(new TQLineEditPrivate( this )) -{ - d->init( contents ); -} - -/*! - Constructs a line edit with an input \a inputMask and the text \a - contents. - - The cursor position is set to the end of the line and the maximum - text length is set to the length of the mask (the number of mask - characters and separators). - - The \a parent and \a name arguments are sent to the TQWidget - constructor. - - \sa setMask() text() -*/ -TQLineEdit::TQLineEdit( const TQString& contents, const TQString &inputMask, TQWidget* parent, const char* name ) - : TQFrame( parent, name, WNoAutoErase ), d(new TQLineEditPrivate( this )) -{ - d->parseInputMask( inputMask ); - if ( d->maskData ) { - TQString ms = d->maskString( 0, contents ); - d->init( ms + d->clearString( ms.length(), d->maxLength - ms.length() ) ); - d->cursor = d->nextMaskBlank( ms.length() ); - } else { - d->init( contents ); - } -} - -/*! - Destroys the line edit. -*/ - -TQLineEdit::~TQLineEdit() -{ - if ((d->echoMode == NoEcho) || (d->echoMode == Password) || (d->echoMode == PasswordThreeStars)) { - d->text.fill(TQChar(0)); -#if defined(Q_OS_LINUX) - munlock(d->text.d->unicode, LINUX_MEMLOCK_LIMIT_BYTES); -#endif - } - delete [] d->maskData; - delete d; -} - - -/*! - \property TQLineEdit::text - \brief the line edit's text - - Note that setting this property clears the selection, clears the - undo/redo history, moves the cursor to the end of the line and - resets the \c modified property to FALSE. The text is not - validated when inserted with setText(). - - The text is truncated to maxLength() length. - - \sa insert() -*/ -TQString TQLineEdit::text() const -{ - TQString res = d->text; - if ( d->maskData ) - res = d->stripString( d->text ); - return ( res.isNull() ? TQString::fromLatin1("") : res ); -} - -void TQLineEdit::setText( const TQString& text) -{ - resetInputContext(); - d->setText( text ); - d->modified = FALSE; - d->finishChange( -1, FALSE ); -} - - -/*! - \property TQLineEdit::displayText - \brief the displayed text - - If \c EchoMode is \c Normal this returns the same as text(); if - \c EchoMode is \c Password it returns a string of asterisks - text().length() characters long, e.g. "******"; if \c EchoMode is - \c NoEcho returns an empty string, "". - - \sa setEchoMode() text() EchoMode -*/ - -TQString TQLineEdit::displayText() const -{ - if ( d->echoMode == NoEcho ) { - return TQString::fromLatin1(""); - } - TQString res = d->text; - if ( d->echoMode == Password ) { - res.fill( passwordChar() ); - } - else if ( d->echoMode == PasswordThreeStars ) { - res.fill( passwordChar(), res.length()*3 ); - } - return ( res.isNull() ? TQString::fromLatin1("") : res ); -} - - -/*! - \property TQLineEdit::maxLength - \brief the maximum permitted length of the text - - If the text is too long, it is truncated at the limit. - - If truncation occurs any selected text will be unselected, the - cursor position is set to 0 and the first part of the string is - shown. - - If the line edit has an input mask, the mask defines the maximum - string length. - - \sa inputMask -*/ - -int TQLineEdit::maxLength() const -{ - return d->maxLength; -} - -void TQLineEdit::setMaxLength( int maxLength ) -{ - if ( d->maskData ) - return; - d->maxLength = maxLength; - setText( d->text ); -} - - - -/*! - \property TQLineEdit::frame - \brief whether the line edit draws itself with a frame - - If enabled (the default) the line edit draws itself inside a - two-pixel frame, otherwise the line edit draws itself without any - frame. -*/ -bool TQLineEdit::frame() const -{ - return frameShape() != NoFrame; -} - - -void TQLineEdit::setFrame( bool enable ) -{ - setFrameStyle( enable ? ( LineEditPanel | Sunken ) : NoFrame ); -} - - -/*! - \enum TQLineEdit::EchoMode - - This enum type describes how a line edit should display its - contents. - - \value Normal Display characters as they are entered. This is the - default. - \value NoEcho Do not display anything. This may be appropriate - for passwords where even the length of the - password should be kept secret. - \value Password Display asterisks instead of the characters - actually entered. - - \sa setEchoMode() echoMode() -*/ - - -/*! - \property TQLineEdit::echoMode - \brief the line edit's echo mode - - The initial setting is \c Normal, but TQLineEdit also supports \c - NoEcho and \c Password modes. - - The widget's display and the ability to copy or drag the text is - affected by this setting. - - \sa EchoMode displayText() -*/ - -TQLineEdit::EchoMode TQLineEdit::echoMode() const -{ - return (EchoMode) d->echoMode; -} - -void TQLineEdit::setEchoMode( EchoMode mode ) -{ - if (mode == (EchoMode)d->echoMode) { - return; - } -#if defined(Q_OS_LINUX) - if (((mode == NoEcho) || (mode == Password) || (mode == PasswordThreeStars)) && ((EchoMode)d->echoMode == Normal)) { - if ((uint)d->maxLength > (LINUX_MEMLOCK_LIMIT_CHARACTERS-1)) { - d->maxLength = LINUX_MEMLOCK_LIMIT_CHARACTERS-1; - } - d->text.reserve(LINUX_MEMLOCK_LIMIT_CHARACTERS); - mlock(d->text.d->unicode, LINUX_MEMLOCK_LIMIT_BYTES); - d->text.setSecurityUnPaged(true); - } - else { - d->text.setSecurityUnPaged(false); - munlock(d->text.d->unicode, LINUX_MEMLOCK_LIMIT_BYTES); - } -#endif - d->echoMode = mode; - d->updateTextLayout(); - setInputMethodEnabled( ( mode == Normal ) || ( mode == Password) ); - update(); -} - - - -/*! - Returns a pointer to the current input validator, or 0 if no - validator has been set. - - \sa setValidator() -*/ - -const TQValidator * TQLineEdit::validator() const -{ - return d->validator; -} - -/*! - Sets this line edit to only accept input that the validator, \a v, - will accept. This allows you to place any arbitrary constraints on - the text which may be entered. - - If \a v == 0, setValidator() removes the current input validator. - The initial setting is to have no input validator (i.e. any input - is accepted up to maxLength()). - - \sa validator() TQIntValidator TQDoubleValidator TQRegExpValidator -*/ - -void TQLineEdit::setValidator( const TQValidator *v ) -{ - if ( d->validator ) - disconnect( (TQObject*)d->validator, TQ_SIGNAL( destroyed() ), - this, TQ_SLOT( clearValidator() ) ); - d->validator = v; - if ( d->validator ) - connect( (TQObject*)d->validator, TQ_SIGNAL( destroyed() ), - this, TQ_SLOT( clearValidator() ) ); -} - - - -/*! - Returns a recommended size for the widget. - - The width returned, in pixels, is usually enough for about 15 to - 20 characters. -*/ - -TQSize TQLineEdit::sizeHint() const -{ - constPolish(); - TQFontMetrics fm( font() ); - int h = TQMAX(fm.lineSpacing(), 14) + 2*innerMargin; - int w = fm.width( 'x' ) * 17; // "some" - int m = frameWidth() * 2; - return (style().sizeFromContents(TQStyle::CT_LineEdit, this, - TQSize( w + m, h + m ). - expandedTo(TQApplication::globalStrut()))); -} - - -/*! - Returns a minimum size for the line edit. - - The width returned is enough for at least one character. -*/ - -TQSize TQLineEdit::minimumSizeHint() const -{ - constPolish(); - TQFontMetrics fm = fontMetrics(); - int h = fm.height() + TQMAX( 2*innerMargin, fm.leading() ); - int w = fm.maxWidth(); - int m = frameWidth() * 2; - return TQSize( w + m, h + m ); -} - - -/*! - \property TQLineEdit::cursorPosition - \brief the current cursor position for this line edit - - Setting the cursor position causes a repaint when appropriate. -*/ - -int TQLineEdit::cursorPosition() const -{ - return d->cursor; -} - - -void TQLineEdit::setCursorPosition( int pos ) -{ - if (pos < 0) - pos = 0; - - if ( pos <= (int) d->text.length() ) - d->moveCursor( pos ); -} - - -/*! \obsolete Use setText(), setCursorPosition() and setSelection() instead. -*/ - -bool TQLineEdit::validateAndSet( const TQString &newText, int newPos, - int newMarkAnchor, int newMarkDrag ) -{ - int priorState = d->undoState; - d->selstart = 0; - d->selend = d->text.length(); - d->removeSelectedText(); - d->insert( newText ); - d->finishChange( priorState ); - if ( d->undoState > priorState ) { - d->cursor = newPos; - d->selstart = TQMIN( newMarkAnchor, newMarkDrag ); - d->selend = TQMAX( newMarkAnchor, newMarkDrag ); - d->updateMicroFocusHint(); - update(); - return TRUE; - } - return FALSE; -} - - -/*! - \property TQLineEdit::alignment - \brief the alignment of the line edit - - Possible Values are \c TQt::AlignAuto, \c TQt::AlignLeft, \c - TQt::AlignRight and \c TQt::AlignHCenter. - - Attempting to set the alignment to an illegal flag combination - does nothing. - - \sa TQt::AlignmentFlags -*/ - -int TQLineEdit::alignment() const -{ - return d->alignment; -} - -void TQLineEdit::setAlignment( int flag ) -{ - d->alignment = flag & 0x7; - update(); -} - - -/*! - Moves the cursor forward \a steps characters. If \a mark is TRUE - each character moved over is added to the selection; if \a mark is - FALSE the selection is cleared. - - \sa cursorBackward() -*/ - -void TQLineEdit::cursorForward( bool mark, int steps ) -{ - int cursor = d->cursor; - if ( steps > 0 ) { - while( steps-- ) - cursor = d->textLayout.nextCursorPosition( cursor ); - } else if ( steps < 0 ) { - while ( steps++ ) - cursor = d->textLayout.previousCursorPosition( cursor ); - } - d->moveCursor( cursor, mark ); -} - - -/*! - Moves the cursor back \a steps characters. If \a mark is TRUE each - character moved over is added to the selection; if \a mark is - FALSE the selection is cleared. - - \sa cursorForward() -*/ -void TQLineEdit::cursorBackward( bool mark, int steps ) -{ - cursorForward( mark, -steps ); -} - -/*! - Moves the cursor one word forward. If \a mark is TRUE, the word is - also selected. - - \sa cursorWordBackward() -*/ -void TQLineEdit::cursorWordForward( bool mark ) -{ - d->moveCursor( d->textLayout.nextCursorPosition(d->cursor, TQTextLayout::SkipWords), mark ); -} - -/*! - Moves the cursor one word backward. If \a mark is TRUE, the word - is also selected. - - \sa cursorWordForward() -*/ - -void TQLineEdit::cursorWordBackward( bool mark ) -{ - d->moveCursor( d->textLayout.previousCursorPosition(d->cursor, TQTextLayout::SkipWords), mark ); -} - - -/*! - If no text is selected, deletes the character to the left of the - text cursor and moves the cursor one position to the left. If any - text is selected, the cursor is moved to the beginning of the - selected text and the selected text is deleted. - - \sa del() -*/ -void TQLineEdit::backspace() -{ - int priorState = d->undoState; - if ( d->hasSelectedText() ) { - d->removeSelectedText(); - } else if ( d->cursor ) { - --d->cursor; - if ( d->maskData ) - d->cursor = d->prevMaskBlank( d->cursor ); - d->del( TRUE ); - } - d->finishChange( priorState ); -} - -/*! - If no text is selected, deletes the character to the right of the - text cursor. If any text is selected, the cursor is moved to the - beginning of the selected text and the selected text is deleted. - - \sa backspace() -*/ - -void TQLineEdit::del() -{ - int priorState = d->undoState; - if ( d->hasSelectedText() ) { - d->removeSelectedText(); - } else { - int n = d->textLayout.nextCursorPosition( d->cursor ) - d->cursor; - while ( n-- ) - d->del(); - } - d->finishChange( priorState ); -} - -/*! - Moves the text cursor to the beginning of the line unless it is - already there. If \a mark is TRUE, text is selected towards the - first position; otherwise, any selected text is unselected if the - cursor is moved. - - \sa end() -*/ - -void TQLineEdit::home( bool mark ) -{ - d->moveCursor( 0, mark ); -} - -/*! - Moves the text cursor to the end of the line unless it is already - there. If \a mark is TRUE, text is selected towards the last - position; otherwise, any selected text is unselected if the cursor - is moved. - - \sa home() -*/ - -void TQLineEdit::end( bool mark ) -{ - d->moveCursor( d->text.length(), mark ); -} - - -/*! - \property TQLineEdit::modified - \brief whether the line edit's contents has been modified by the user - - The modified flag is never read by TQLineEdit; it has a default value - of FALSE and is changed to TRUE whenever the user changes the line - edit's contents. - - This is useful for things that need to provide a default value but - do not start out knowing what the default should be (perhaps it - depends on other fields on the form). Start the line edit without - the best default, and when the default is known, if modified() - returns FALSE (the user hasn't entered any text), insert the - default value. - - Calling clearModified() or setText() resets the modified flag to - FALSE. -*/ - -bool TQLineEdit::isModified() const -{ - return d->modified; -} - -/*! - Resets the modified flag to FALSE. - - \sa isModified() -*/ -void TQLineEdit::clearModified() -{ - d->modified = FALSE; - d->history.clear(); - d->undoState = 0; -} - -/*! - \obsolete - \property TQLineEdit::edited - \brief whether the line edit has been edited. Use modified instead. -*/ -bool TQLineEdit::edited() const { return d->modified; } -void TQLineEdit::setEdited( bool on ) { d->modified = on; } - -/*! - \property TQLineEdit::hasSelectedText - \brief whether there is any text selected - - hasSelectedText() returns TRUE if some or all of the text has been - selected by the user; otherwise returns FALSE. - - \sa selectedText() -*/ - - -bool TQLineEdit::hasSelectedText() const -{ - return d->hasSelectedText(); -} - -/*! - \property TQLineEdit::selectedText - \brief the selected text - - If there is no selected text this property's value is - TQString::null. - - \sa hasSelectedText() -*/ - -TQString TQLineEdit::selectedText() const -{ - if ( d->hasSelectedText() ) - return d->text.mid( d->selstart, d->selend - d->selstart ); - return TQString::null; -} - -/*! - selectionStart() returns the index of the first selected character in the - line edit or -1 if no text is selected. - - \sa selectedText() -*/ - -int TQLineEdit::selectionStart() const -{ - return d->hasSelectedText() ? d->selstart : -1; -} - -/*! \obsolete use selectedText(), selectionStart() */ -bool TQLineEdit::getSelection( int *start, int *end ) -{ - if ( d->hasSelectedText() && start && end ) { - *start = d->selstart; - *end = d->selend; - return TRUE; - } - return FALSE; -} - - -/*! - Selects text from position \a start and for \a length characters. - - Note that this function sets the cursor's position to the end of - the selection regardless of its current position. - - \sa deselect() selectAll() getSelection() cursorForward() cursorBackward() -*/ - -void TQLineEdit::setSelection( int start, int length ) -{ - if ( start < 0 || start > (int)d->text.length() || length < 0 ) { - d->selstart = d->selend = 0; - } else { - d->selstart = start; - d->selend = TQMIN( start + length, (int)d->text.length() ); - d->cursor = d->selend; - } - update(); -} - - -/*! - \property TQLineEdit::undoAvailable - \brief whether undo is available -*/ - -bool TQLineEdit::isUndoAvailable() const -{ - return d->isUndoAvailable(); -} - -/*! - \property TQLineEdit::redoAvailable - \brief whether redo is available -*/ - -bool TQLineEdit::isRedoAvailable() const -{ - return d->isRedoAvailable(); -} - -/*! - \property TQLineEdit::dragEnabled - \brief whether the lineedit starts a drag if the user presses and - moves the mouse on some selected text -*/ - -bool TQLineEdit::dragEnabled() const -{ - return d->dragEnabled; -} - -void TQLineEdit::setDragEnabled( bool b ) -{ - d->dragEnabled = b; -} - -/*! - \property TQLineEdit::acceptableInput - \brief whether the input satisfies the inputMask and the - validator. - - \sa setInputMask(), setValidator() -*/ -bool TQLineEdit::hasAcceptableInput() const -{ -#ifndef TQT_NO_VALIDATOR - TQString text = d->text; - int cursor = d->cursor; - if ( d->validator && d->validator->validate( text, cursor ) != TQValidator::Acceptable ) - return FALSE; -#endif - - if ( !d->maskData ) - return TRUE; - - if ( d->text.length() != (uint)d->maxLength ) - return FALSE; - - for ( uint i=0; i < (uint)d->maxLength; i++) { - if ( d->maskData[i].separator ) { - if ( d->text[(int)i] != d->maskData[i].maskChar ) - return FALSE; - } else { - if ( !d->isValidInput( d->text[(int)i], d->maskData[i].maskChar ) ) - return FALSE; - } - } - return TRUE; -} - - -/*! - \property TQLineEdit::inputMask - \brief The validation input mask - - If no mask is set, inputMask() returns TQString::null. - - Sets the TQLineEdit's validation mask. Validators can be used - instead of, or in conjunction with masks; see setValidator(). - - Unset the mask and return to normal TQLineEdit operation by passing - an empty string ("") or just calling setInputMask() with no - arguments. - - The mask format understands these mask characters: - \table - \header \i Character \i Meaning - \row \i \c A \i ASCII alphabetic character required. A-Z, a-z. - \row \i \c a \i ASCII alphabetic character permitted but not required. - \row \i \c N \i ASCII alphanumeric character required. A-Z, a-z, 0-9. - \row \i \c n \i ASCII alphanumeric character permitted but not required. - \row \i \c X \i Any character required. - \row \i \c x \i Any character permitted but not required. - \row \i \c 9 \i ASCII digit required. 0-9. - \row \i \c 0 \i ASCII digit permitted but not required. - \row \i \c D \i ASCII digit required. 1-9. - \row \i \c d \i ASCII digit permitted but not required (1-9). - \row \i \c # \i ASCII digit or plus/minus sign permitted but not required. - \row \i \c > \i All following alphabetic characters are uppercased. - \row \i \c < \i All following alphabetic characters are lowercased. - \row \i \c ! \i Switch off case conversion. - \row \i \\ \i Use \\ to escape the special - characters listed above to use them as - separators. - \endtable - - The mask consists of a string of mask characters and separators, - optionally followed by a semi-colon and the character used for - blanks: the blank characters are always removed from the text - after editing. The default blank character is space. - - Examples: - \table - \header \i Mask \i Notes - \row \i \c 000.000.000.000;_ \i IP address; blanks are \c{_}. - \row \i \c 0000-00-00 \i ISO Date; blanks are \c space - \row \i \c >AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;# \i License number; - blanks are \c - and all (alphabetic) characters are converted to - uppercase. - \endtable - - To get range control (e.g. for an IP address) use masks together - with \link setValidator() validators\endlink. - - \sa maxLength -*/ -TQString TQLineEdit::inputMask() const -{ - return ( d->maskData ? d->inputMask + ';' + d->blank : TQString::null ); -} - -void TQLineEdit::setInputMask( const TQString &inputMask ) -{ - d->parseInputMask( inputMask ); - if ( d->maskData ) - d->moveCursor( d->nextMaskBlank( 0 ) ); -} - -/*! - Selects all the text (i.e. highlights it) and moves the cursor to - the end. This is useful when a default value has been inserted - because if the user types before clicking on the widget, the - selected text will be deleted. - - \sa setSelection() deselect() -*/ - -void TQLineEdit::selectAll() -{ - d->selstart = d->selend = d->cursor = 0; - d->moveCursor( d->text.length(), TRUE ); -} - -/*! - Deselects any selected text. - - \sa setSelection() selectAll() -*/ - -void TQLineEdit::deselect() -{ - d->deselect(); - d->finishChange(); -} - - -/*! - This slot is equivalent to setValidator(0). -*/ - -void TQLineEdit::clearValidator() -{ - setValidator( 0 ); -} - -/*! - Deletes any selected text, inserts \a newText, and validates the - result. If it is valid, it sets it as the new contents of the line - edit. -*/ -void TQLineEdit::insert( const TQString &newText ) -{ -// q->resetInputContext(); //#### FIX ME IN QT - int priorState = d->undoState; - d->removeSelectedText(); - d->insert( newText ); - d->finishChange( priorState ); -} - -/*! - Clears the contents of the line edit. -*/ -void TQLineEdit::clear() -{ - int priorState = d->undoState; - resetInputContext(); - d->selstart = 0; - d->selend = d->text.length(); - d->removeSelectedText(); - d->separate(); - d->finishChange( priorState ); -} - -/*! - Undoes the last operation if undo is \link - TQLineEdit::undoAvailable available\endlink. Deselects any current - selection, and updates the selection start to the current cursor - position. -*/ -void TQLineEdit::undo() -{ - resetInputContext(); - d->undo(); - d->finishChange( -1, FALSE ); -} - -/*! - Redoes the last operation if redo is \link - TQLineEdit::redoAvailable available\endlink. -*/ -void TQLineEdit::redo() -{ - resetInputContext(); - d->redo(); - d->finishChange(); -} - - -/*! - \property TQLineEdit::readOnly - \brief whether the line edit is read only. - - In read-only mode, the user can still copy the text to the - clipboard or drag-and-drop the text (if echoMode() is \c Normal), - but cannot edit it. - - TQLineEdit does not show a cursor in read-only mode. - - \sa setEnabled() -*/ - -bool TQLineEdit::isReadOnly() const -{ - return d->readOnly; -} - -void TQLineEdit::setReadOnly( bool enable ) -{ - d->readOnly = enable; -#ifndef TQT_NO_CURSOR - setCursor( enable ? arrowCursor : ibeamCursor ); -#endif - update(); -} - - -#ifndef TQT_NO_CLIPBOARD -/*! - Copies the selected text to the clipboard and deletes it, if there - is any, and if echoMode() is \c Normal. - - If the current validator disallows deleting the selected text, - cut() will copy without deleting. - - \sa copy() paste() setValidator() -*/ - -void TQLineEdit::cut() -{ - if ( hasSelectedText() ) { - copy(); - del(); - } -} - - -/*! - Copies the selected text to the clipboard, if there is any, and if - echoMode() is \c Normal. - - \sa cut() paste() -*/ - -void TQLineEdit::copy() const -{ - d->copy(); -} - -/*! - Inserts the clipboard's text at the cursor position, deleting any - selected text, providing the line edit is not \link - TQLineEdit::readOnly read-only\endlink. - - If the end result would not be acceptable to the current - \link setValidator() validator\endlink, nothing happens. - - \sa copy() cut() -*/ - -void TQLineEdit::paste() -{ - insert( TQApplication::clipboard()->text( TQClipboard::Clipboard ) ); -} - -void TQLineEditPrivate::copy( bool clipboard ) const -{ - TQString t = q->selectedText(); - if ( !t.isEmpty() && echoMode == TQLineEdit::Normal ) { - q->disconnect( TQApplication::clipboard(), TQ_SIGNAL(selectionChanged()), q, 0); - TQApplication::clipboard()->setText( t, clipboard ? TQClipboard::Clipboard : TQClipboard::Selection ); - q->connect( TQApplication::clipboard(), TQ_SIGNAL(selectionChanged()), - q, TQ_SLOT(clipboardChanged()) ); - } -} - -#endif // !TQT_NO_CLIPBOARD - -/*!\reimp -*/ - -void TQLineEdit::resizeEvent( TQResizeEvent *e ) -{ - TQFrame::resizeEvent( e ); -} - -/*! \reimp -*/ -bool TQLineEdit::event( TQEvent * e ) -{ - if ( e->type() == TQEvent::AccelOverride && !d->readOnly ) { - TQKeyEvent* ke = (TQKeyEvent*) e; - if ( ke->state() == NoButton || ke->state() == ShiftButton - || ke->state() == Keypad ) { - if ( ke->key() < Key_Escape ) { - ke->accept(); - } else { - switch ( ke->key() ) { - case Key_Delete: - case Key_Home: - case Key_End: - case Key_Backspace: - case Key_Left: - case Key_Right: - ke->accept(); - default: - break; - } - } - } else if ( ke->state() & ControlButton ) { - switch ( ke->key() ) { -// Those are too frequently used for application functionality -/* case Key_A: - case Key_B: - case Key_D: - case Key_E: - case Key_F: - case Key_H: - case Key_K: -*/ - case Key_C: - case Key_V: - case Key_X: - case Key_Y: - case Key_Z: - case Key_Left: - case Key_Right: -#if defined (TQ_WS_WIN) - case Key_Insert: - case Key_Delete: -#endif - ke->accept(); - default: - break; - } - } - } else if ( e->type() == TQEvent::Timer ) { - // should be timerEvent, is here for binary compatibility - int timerId = ((TQTimerEvent*)e)->timerId(); - if ( timerId == d->cursorTimer ) { - if(!hasSelectedText() || style().styleHint( TQStyle::SH_BlinkCursorWhenTextSelected )) - d->setCursorVisible( !d->cursorVisible ); -#ifndef TQT_NO_DRAGANDDROP - } else if ( timerId == d->dndTimer ) { - if( !d->drag() ) - return TRUE; -#endif - } else if ( timerId == d->tripleClickTimer ) { - killTimer( d->tripleClickTimer ); - d->tripleClickTimer = 0; - } - } - return TQWidget::event( e ); -} - -/*! \reimp -*/ -void TQLineEdit::mousePressEvent( TQMouseEvent* e ) -{ - if ( sendMouseEventToInputContext( e ) ) - return; - if ( e->button() == RightButton ) - return; - if ( d->tripleClickTimer && ( e->pos() - d->tripleClick ).manhattanLength() < - TQApplication::startDragDistance() ) { - selectAll(); - return; - } - bool mark = e->state() & ShiftButton; - int cursor = d->xToPos( e->pos().x() ); -#ifndef TQT_NO_DRAGANDDROP - if ( !mark && d->dragEnabled && d->echoMode == Normal && - e->button() == LeftButton && d->inSelection( e->pos().x() ) ) { - d->cursor = cursor; - d->updateMicroFocusHint(); - update(); - d->dndPos = e->pos(); - if ( !d->dndTimer ) - d->dndTimer = startTimer( TQApplication::startDragTime() ); - } else -#endif - { - d->moveCursor( cursor, mark ); - } -} - -/*! \reimp -*/ -void TQLineEdit::mouseMoveEvent( TQMouseEvent * e ) -{ - if ( sendMouseEventToInputContext( e ) ) - return; -#ifndef TQT_NO_CURSOR - if ( ( e->state() & MouseButtonMask ) == 0 ) { - if ( !d->readOnly && d->dragEnabled -#ifndef TQT_NO_WHATSTHIS - && !TQWhatsThis::inWhatsThisMode() -#endif - ) - setCursor( ( d->inSelection( e->pos().x() ) ? arrowCursor : ibeamCursor ) ); - } -#endif - - if ( e->state() & LeftButton ) { -#ifndef TQT_NO_DRAGANDDROP - if ( d->dndTimer ) { - if ( ( d->dndPos - e->pos() ).manhattanLength() > TQApplication::startDragDistance() ) - d->drag(); - } else -#endif - { - d->moveCursor( d->xToPos( e->pos().x() ), TRUE ); - } - } -} - -/*! \reimp -*/ -void TQLineEdit::mouseReleaseEvent( TQMouseEvent* e ) -{ - if ( sendMouseEventToInputContext( e ) ) - return; -#ifndef TQT_NO_DRAGANDDROP - if ( e->button() == LeftButton ) { - if ( d->dndTimer ) { - killTimer( d->dndTimer ); - d->dndTimer = 0; - deselect(); - return; - } - } -#endif -#ifndef TQT_NO_CLIPBOARD - if (TQApplication::clipboard()->supportsSelection() ) { - if ( e->button() == LeftButton ) { - d->copy( FALSE ); - } else if ( !d->readOnly && e->button() == MidButton ) { - d->deselect(); - insert( TQApplication::clipboard()->text( TQClipboard::Selection ) ); - } - } -#endif -} - -/*! \reimp -*/ -void TQLineEdit::mouseDoubleClickEvent( TQMouseEvent* e ) -{ - if ( sendMouseEventToInputContext( e ) ) - return; - if ( e->button() == TQt::LeftButton ) { - deselect(); - d->cursor = d->xToPos( e->pos().x() ); - d->cursor = d->textLayout.previousCursorPosition( d->cursor, TQTextLayout::SkipWords ); - // ## text layout should support end of words. - int end = d->textLayout.nextCursorPosition( d->cursor, TQTextLayout::SkipWords ); - while ( end > d->cursor && d->text[end-1].isSpace() ) - --end; - d->moveCursor( end, TRUE ); - d->tripleClickTimer = startTimer( TQApplication::doubleClickInterval() ); - d->tripleClick = e->pos(); - } -} - -/*! - \fn void TQLineEdit::returnPressed() - - This signal is emitted when the Return or Enter key is pressed. - Note that if there is a validator() or inputMask() set on the line - edit, the returnPressed() signal will only be emitted if the input - follows the inputMask() and the validator() returns \c Acceptable. -*/ - -/*! - Converts key press event \a e into a line edit action. - - If Return or Enter is pressed and the current text is valid (or - can be \link TQValidator::fixup() made valid\endlink by the - validator), the signal returnPressed() is emitted. - - The default key bindings are listed in the \link #desc detailed - description.\endlink -*/ - -void TQLineEdit::keyPressEvent( TQKeyEvent * e ) -{ - d->setCursorVisible( TRUE ); - if ( e->key() == Key_Enter || e->key() == Key_Return ) { - const TQValidator * v = d->validator; - if ( hasAcceptableInput() ) { - emit returnPressed(); - } -#ifndef TQT_NO_VALIDATOR - else if ( v && v->validate( d->text, d->cursor ) != TQValidator::Acceptable ) { - TQString vstr = d->text; - v->fixup( vstr ); - if ( vstr != d->text ) { - setText( vstr ); - if ( hasAcceptableInput() ) - emit returnPressed(); - } - } -#endif - e->ignore(); - return; - } - if ( !d->readOnly ) { - TQString t = e->text(); - if ( !t.isEmpty() && (!e->ascii() || e->ascii()>=32) && - e->key() != Key_Delete && - e->key() != Key_Backspace ) { -#ifdef TQ_WS_X11 - extern bool tqt_hebrew_keyboard_hack; - if ( tqt_hebrew_keyboard_hack ) { - // the X11 keyboard layout is broken and does not reverse - // braces correctly. This is a hack to get halfway correct - // behaviour - if ( d->isRightToLeft() ) { - TQChar *c = (TQChar *)t.unicode(); - int l = t.length(); - while( l-- ) { - if ( c->mirrored() ) - *c = c->mirroredChar(); - c++; - } - } - } -#endif - insert( t ); - return; - } - } - bool unknown = FALSE; - if ( e->state() & ControlButton ) { - switch ( e->key() ) { - case Key_A: -#if defined(TQ_WS_X11) - home( e->state() & ShiftButton ); -#else - selectAll(); -#endif - break; - case Key_B: - cursorForward( e->state() & ShiftButton, -1 ); - break; -#ifndef TQT_NO_CLIPBOARD - case Key_C: - copy(); - break; -#endif - case Key_D: - if ( !d->readOnly ) { - del(); - } - break; - case Key_E: - end( e->state() & ShiftButton ); - break; - case Key_F: - cursorForward( e->state() & ShiftButton, 1 ); - break; - case Key_H: - if ( !d->readOnly ) { - backspace(); - } - break; - case Key_K: - if ( !d->readOnly ) { - int priorState = d->undoState; - d->deselect(); - while ( d->cursor < (int) d->text.length() ) - d->del(); - d->finishChange( priorState ); - } - break; -#if defined(TQ_WS_X11) - case Key_U: - if ( !d->readOnly ) - clear(); - break; -#endif -#ifndef TQT_NO_CLIPBOARD - case Key_V: - if ( !d->readOnly ) - paste(); - break; - case Key_X: - if ( !d->readOnly && d->hasSelectedText() && echoMode() == Normal ) { - copy(); - del(); - } - break; -#if defined (TQ_WS_WIN) - case Key_Insert: - copy(); - break; -#endif -#endif - case Key_Delete: - if ( !d->readOnly ) { - cursorWordForward( TRUE ); - del(); - } - break; - case Key_Backspace: - if ( !d->readOnly ) { - cursorWordBackward( TRUE ); - del(); - } - break; - case Key_Right: - case Key_Left: - if ( d->isRightToLeft() == (e->key() == Key_Right) ) { - if (( echoMode() == Normal ) || ( echoMode() == Password )) - cursorWordBackward( e->state() & ShiftButton ); - else - home( e->state() & ShiftButton ); - } else { - if (( echoMode() == Normal ) || ( echoMode() == Password )) - cursorWordForward( e->state() & ShiftButton ); - else - end( e->state() & ShiftButton ); - } - break; - case Key_Z: - if ( !d->readOnly ) { - if(e->state() & ShiftButton) - redo(); - else - undo(); - } - break; - case Key_Y: - if ( !d->readOnly ) - redo(); - break; - default: - unknown = TRUE; - } - } else { // ### check for *no* modifier - switch ( e->key() ) { - case Key_Shift: - // ### TODO - break; - case Key_Left: - case Key_Right: { - int step = (d->isRightToLeft() == (e->key() == Key_Right)) ? -1 : 1; - cursorForward( e->state() & ShiftButton, step ); - } - break; - case Key_Backspace: - if ( !d->readOnly ) { - backspace(); - } - break; - case Key_Home: -#ifdef TQ_WS_MACX - case Key_Up: -#endif - home( e->state() & ShiftButton ); - break; - case Key_End: -#ifdef TQ_WS_MACX - case Key_Down: -#endif - end( e->state() & ShiftButton ); - break; - case Key_Delete: - if ( !d->readOnly ) { -#if defined (TQ_WS_WIN) - if ( e->state() & ShiftButton ) { - cut(); - break; - } -#endif - del(); - } - break; -#if defined (TQ_WS_WIN) - case Key_Insert: - if ( !d->readOnly && e->state() & ShiftButton ) - paste(); - else - unknown = TRUE; - break; -#endif - case Key_F14: // Undo key on Sun keyboards - if ( !d->readOnly ) - undo(); - break; -#ifndef TQT_NO_CLIPBOARD - case Key_F16: // Copy key on Sun keyboards - copy(); - break; - case Key_F18: // Paste key on Sun keyboards - if ( !d->readOnly ) - paste(); - break; - case Key_F20: // Cut key on Sun keyboards - if ( !d->readOnly && hasSelectedText() && echoMode() == Normal ) { - copy(); - del(); - } - break; -#endif - default: - unknown = TRUE; - } - } - if ( e->key() == Key_Direction_L || e->key() == Key_Direction_R ) { - d->direction = (e->key() == Key_Direction_L) ? TQChar::DirL : TQChar::DirR; - d->updateTextLayout(); - update(); - } - - if ( unknown ) - e->ignore(); -} - - -/*! - This function is not intended as polymorphic usage. Just a shared code - fragment that calls TQWidget::sendMouseEventToInputContext() easily for this - class. - */ -bool TQLineEdit::sendMouseEventToInputContext( TQMouseEvent *e ) -{ -#ifndef TQT_NO_IM - if ( d->composeMode() ) { - int cursor = d->xToPosInternal( e->pos().x(), TQTextItem::OnCharacters ); - int mousePos = cursor - d->imstart; - if ( mousePos >= 0 && mousePos < d->preeditLength() ) { - TQWidget::sendMouseEventToInputContext( mousePos, e->type(), - e->button(), e->state() ); - } else if ( e->type() != TQEvent::MouseMove ) { - // send button events on out of preedit - TQWidget::sendMouseEventToInputContext( -1, e->type(), - e->button(), e->state() ); - } - return TRUE; - } -#endif - return FALSE; -} - - -/*! \reimp - */ -void TQLineEdit::imStartEvent( TQIMEvent *e ) -{ - if ( d->readOnly ) { - e->ignore(); - return; - } - d->removeSelectedText(); - d->updateMicroFocusHint(); - d->imstart = d->imend = d->imselstart = d->imselend = d->cursor; -} - -/*! \reimp - */ -void TQLineEdit::imComposeEvent( TQIMEvent *e ) -{ - if ( d->readOnly ) { - e->ignore(); - return; - } - d->text.replace( d->imstart, d->imend - d->imstart, e->text() ); - d->imend = d->imstart + e->text().length(); - d->imselstart = d->imstart + e->cursorPos(); - d->imselend = d->imselstart + e->selectionLength(); - d->cursor = d->imstart + e->cursorPos(); - d->updateTextLayout(); - d->updateMicroFocusHint(); - update(); -} - -/*! \reimp - */ -void TQLineEdit::imEndEvent( TQIMEvent *e ) -{ - if ( d->readOnly) { - e->ignore(); - return; - } - d->text.remove( d->imstart, d->imend - d->imstart ); - d->cursor = d->imselstart = d->imselend = d->imend = d->imstart; - d->textDirty = TRUE; - insert( e->text() ); -} - -/*!\reimp -*/ - -void TQLineEdit::focusInEvent( TQFocusEvent* ) -{ - if ( TQFocusEvent::reason() == TQFocusEvent::Tab || - TQFocusEvent::reason() == TQFocusEvent::Backtab || - TQFocusEvent::reason() == TQFocusEvent::Shortcut ) - d->maskData ? d->moveCursor( d->nextMaskBlank( 0 ) ) : selectAll(); - if ( !d->cursorTimer ) { - int cft = TQApplication::cursorFlashTime(); - d->cursorTimer = cft ? startTimer( cft/2 ) : -1; - } - if( !hasSelectedText() || style().styleHint( TQStyle::SH_BlinkCursorWhenTextSelected ) ) - d->setCursorVisible( TRUE ); - if ( d->hasIMSelection() ) - d->cursor = d->imselstart; - d->updateMicroFocusHint(); -} - -/*!\reimp -*/ - -void TQLineEdit::focusOutEvent( TQFocusEvent* ) -{ - if ( TQFocusEvent::reason() != TQFocusEvent::ActiveWindow && - TQFocusEvent::reason() != TQFocusEvent::Popup ) - deselect(); - d->setCursorVisible( FALSE ); - if ( d->cursorTimer > 0 ) - killTimer( d->cursorTimer ); - d->cursorTimer = 0; - if (TQFocusEvent::reason() != TQFocusEvent::Popup) - emit lostFocus(); -} - -/*!\reimp -*/ -void TQLineEdit::drawContents( TQPainter *p ) -{ - const TQColorGroup& cg = colorGroup(); - TQRect cr = contentsRect(); - TQFontMetrics fm = fontMetrics(); - TQRect lineRect( cr.x() + innerMargin, cr.y() + (cr.height() - fm.height() + 1) / 2, - cr.width() - 2*innerMargin, fm.height() ); - TQBrush bg = TQBrush( paletteBackgroundColor() ); - if ( paletteBackgroundPixmap() ) - bg = TQBrush( cg.background(), *paletteBackgroundPixmap() ); - else if ( !isEnabled() ) - bg = cg.brush( TQColorGroup::Background ); - TQPoint brushOrigin = p->brushOrigin(); - p->save(); - p->setClipRegion( TQRegion(cr) - lineRect ); - p->setBrushOrigin(brushOrigin - backgroundOffset()); - p->fillRect( cr, bg ); - p->restore(); - TQSharedDoubleBuffer buffer( p, lineRect.x(), lineRect.y(), - lineRect.width(), lineRect.height(), - hasFocus() ? TQSharedDoubleBuffer::Force : 0 ); - p = buffer.painter(); - brushOrigin = p->brushOrigin(); - p->setBrushOrigin(brushOrigin - backgroundOffset()); - p->fillRect( lineRect, bg ); - p->setBrushOrigin(brushOrigin); - - // locate cursor position - int cix = 0; - TQTextItem ci = d->textLayout.findItem( d->cursor ); - if ( ci.isValid() ) { - if ( d->cursor != (int)d->text.length() && d->cursor == ci.from() + ci.length() - && ci.isRightToLeft() != d->isRightToLeft() ) - ci = d->textLayout.findItem( d->cursor + 1 ); - cix = ci.x() + ci.cursorToX( d->cursor - ci.from() ); - } - - // horizontal scrolling - int minLB = TQMAX( 0, -fm.minLeftBearing() ); - int minRB = TQMAX( 0, -fm.minRightBearing() ); - int widthUsed = d->textLayout.widthUsed() + 1 + minRB; - if ( (minLB + widthUsed) <= lineRect.width() ) { - switch ( d->visualAlignment() ) { - case AlignRight: - d->hscroll = widthUsed - lineRect.width() + 1; - break; - case AlignHCenter: - d->hscroll = ( widthUsed - lineRect.width() ) / 2; - break; - default: - d->hscroll = 0; - break; - } - d->hscroll -= minLB; - } else if ( cix - d->hscroll >= lineRect.width() ) { - d->hscroll = cix - lineRect.width() + 1; - } else if ( cix - d->hscroll < 0 ) { - d->hscroll = cix; - } else if ( widthUsed - d->hscroll < lineRect.width() ) { - d->hscroll = widthUsed - lineRect.width() + 1; - } else if (d->hscroll < 0) { - d->hscroll = 0; - } - // This updateMicroFocusHint() is corresponding to update() at - // IMCompose event. Although the function is invoked from various - // other points, some situations such as "candidate selection on - // AlignHCenter'ed text" need this invocation because - // updateMicroFocusHint() requires updated contentsRect(), and - // there are no other chances in such situation that invoke the - // function. - d->updateMicroFocusHint(); - // the y offset is there to keep the baseline constant in case we have script changes in the text. - TQPoint topLeft = lineRect.topLeft() - TQPoint(d->hscroll, d->ascent-fm.ascent()); - - // draw text, selections and cursors - p->setPen( cg.text() ); - bool supressCursor = d->readOnly, hasRightToLeft = d->isRightToLeft(); - int textflags = 0; - if ( font().underline() ) - textflags |= TQt::Underline; - if ( font().strikeOut() ) - textflags |= TQt::StrikeOut; - if ( font().overline() ) - textflags |= TQt::Overline; - - for ( int i = 0; i < d->textLayout.numItems(); i++ ) { - TQTextItem ti = d->textLayout.itemAt( i ); - hasRightToLeft |= ti.isRightToLeft(); - int tix = topLeft.x() + ti.x(); - int first = ti.from(); - int last = ti.from() + ti.length() - 1; - - // text and selection - if ( d->selstart < d->selend && (last >= d->selstart && first < d->selend ) ) { - TQRect highlight = TQRect( TQPoint( tix + ti.cursorToX( TQMAX( d->selstart - first, 0 ) ), - lineRect.top() ), - TQPoint( tix + ti.cursorToX( TQMIN( d->selend - first, last - first + 1 ) ) - 1, - lineRect.bottom() ) ).normalize(); - p->save(); - p->setClipRegion( TQRegion( lineRect ) - highlight, TQPainter::CoordPainter ); - p->drawTextItem( topLeft, ti, textflags ); - p->setClipRect( lineRect & highlight, TQPainter::CoordPainter ); - p->fillRect( highlight, cg.highlight() ); - p->setPen( cg.highlightedText() ); - p->drawTextItem( topLeft, ti, textflags ); - p->restore(); - } else { - p->drawTextItem( topLeft, ti, textflags ); - } - - // input method edit area - if ( d->composeMode() && (last >= d->imstart && first < d->imend ) ) { - TQRect highlight = TQRect( TQPoint( tix + ti.cursorToX( TQMAX( d->imstart - first, 0 ) ), lineRect.top() ), - TQPoint( tix + ti.cursorToX( TQMIN( d->imend - first, last - first + 1 ) )-1, lineRect.bottom() ) ).normalize(); - p->save(); - p->setClipRect( lineRect & highlight, TQPainter::CoordPainter ); - - int h1, s1, v1, h2, s2, v2; - cg.color( TQColorGroup::Base ).hsv( &h1, &s1, &v1 ); - cg.color( TQColorGroup::Background ).hsv( &h2, &s2, &v2 ); - TQColor imCol; - imCol.setHsv( h1, s1, ( v1 + v2 ) / 2 ); - p->fillRect( highlight, imCol ); - p->drawTextItem( topLeft, ti, textflags ); - // draw preedit's underline - if (d->imend - d->imstart > 0) { - p->setPen( cg.text() ); - p->drawLine( highlight.bottomLeft(), highlight.bottomRight() ); - } - p->restore(); - } - - // input method selection - if ( d->hasIMSelection() && (last >= d->imselstart && first < d->imselend ) ) { - TQRect highlight = TQRect( TQPoint( tix + ti.cursorToX( TQMAX( d->imselstart - first, 0 ) ), lineRect.top() ), - TQPoint( tix + ti.cursorToX( TQMIN( d->imselend - first, last - first + 1 ) )-1, lineRect.bottom() ) ).normalize(); - p->save(); - p->setClipRect( lineRect & highlight, TQPainter::CoordPainter ); - p->fillRect( highlight, cg.text() ); - p->setPen( paletteBackgroundColor() ); - p->drawTextItem( topLeft, ti, textflags ); - p->restore(); - supressCursor = TRUE; - } - - // overwrite cursor - if ( d->cursorVisible && d->maskData && - d->selend <= d->selstart && (last >= d->cursor && first <= d->cursor ) ) { - TQRect highlight = TQRect( TQPoint( tix + ti.cursorToX( TQMAX( d->cursor - first, 0 ) ), lineRect.top() ), - TQPoint( tix + ti.cursorToX( TQMIN( d->cursor + 1 - first, last - first + 1 ) )-1, lineRect.bottom() ) ).normalize(); - p->save(); - p->setClipRect( lineRect & highlight, TQPainter::CoordPainter ); - p->fillRect( highlight, cg.text() ); - p->setPen( paletteBackgroundColor() ); - p->drawTextItem( topLeft, ti, textflags ); - p->restore(); - supressCursor = TRUE; - } - } - - // draw cursor - // - // Asian users regard IM selection text as cursor on candidate - // selection phase of input method, so ordinary cursor should be - // invisible if IM selection text exists. - if ( d->cursorVisible && !supressCursor && !d->hasIMSelection() && (d->echoMode != PasswordThreeStars) ) { - TQPoint from( topLeft.x() + cix, lineRect.top() ); - TQPoint to = from + TQPoint( 0, lineRect.height() ); - p->drawLine( from, to ); - if ( hasRightToLeft ) { - bool rtl = ci.isValid() ? ci.isRightToLeft() : TRUE; - to = from + TQPoint( (rtl ? -2 : 2), 2 ); - p->drawLine( from, to ); - from.ry() += 4; - p->drawLine( from, to ); - } - } - buffer.end(); -} - - -#ifndef TQT_NO_DRAGANDDROP -/*!\reimp -*/ -void TQLineEdit::dragMoveEvent( TQDragMoveEvent *e ) -{ - if ( !d->readOnly && TQTextDrag::canDecode(e) ) { - e->acceptAction(); - d->cursor = d->xToPos( e->pos().x() ); - d->cursorVisible = TRUE; - update(); - } -} - -/*!\reimp */ -void TQLineEdit::dragEnterEvent( TQDragEnterEvent * e ) -{ - TQLineEdit::dragMoveEvent( e ); -} - -/*!\reimp */ -void TQLineEdit::dragLeaveEvent( TQDragLeaveEvent *) -{ - if ( d->cursorVisible ) { - d->cursorVisible = FALSE; - update(); - } -} - -/*!\reimp */ -void TQLineEdit::dropEvent( TQDropEvent* e ) -{ - TQString str; - // try text/plain - TQCString plain = "plain"; - bool decoded = TQTextDrag::decode(e, str, plain); - // otherwise we'll accept any kind of text (like text/uri-list) - if (! decoded) - decoded = TQTextDrag::decode(e, str); - - if ( decoded && !d->readOnly ) { - if ( e->source() == this && e->action() == TQDropEvent::Copy ) - deselect(); - d->cursor =d->xToPos( e->pos().x() ); - int selStart = d->cursor; - int oldSelStart = d->selstart; - int oldSelEnd = d->selend; - d->cursorVisible = FALSE; - e->acceptAction(); - insert( str ); - if ( e->source() == this ) { - if ( e->action() == TQDropEvent::Move ) { - if ( selStart > oldSelStart && selStart <= oldSelEnd ) - setSelection( oldSelStart, str.length() ); - else if ( selStart > oldSelEnd ) - setSelection( selStart - str.length(), str.length() ); - else - setSelection( selStart, str.length() ); - } else { - setSelection( selStart, str.length() ); - } - } - } else { - e->ignore(); - update(); - } -} - -bool TQLineEditPrivate::drag() -{ - q->killTimer( dndTimer ); - dndTimer = 0; - TQTextDrag *tdo = new TQTextDrag( q->selectedText(), q ); - - TQGuardedPtr gptr = q; - bool r = tdo->drag(); - if ( !gptr ) - return FALSE; - - // ### fix the check TQDragObject::target() != q in TQt4 (should not be needed) - if ( r && !readOnly && TQDragObject::target() != q ) { - int priorState = undoState; - removeSelectedText(); - finishChange( priorState ); - } -#ifndef TQT_NO_CURSOR - q->setCursor( readOnly ? arrowCursor : ibeamCursor ); -#endif - return TRUE; -} - -#endif // TQT_NO_DRAGANDDROP - -enum { IdUndo, IdRedo, IdSep1, IdCut, IdCopy, IdPaste, IdClear, IdSep2, IdSelectAll }; - -/*!\reimp -*/ -void TQLineEdit::contextMenuEvent( TQContextMenuEvent * e ) -{ -#ifndef TQT_NO_POPUPMENU -#ifndef TQT_NO_IM - if ( d->composeMode() ) - return; -#endif - d->separate(); - TQPopupMenu *menu = createPopupMenu(); - if (!menu) - return; - TQGuardedPtr popup = menu; - TQGuardedPtr that = this; - TQPoint pos = e->reason() == TQContextMenuEvent::Mouse ? e->globalPos() : - mapToGlobal( TQPoint(e->pos().x(), 0) ) + TQPoint( width() / 2, height() / 2 ); - int r = popup->exec( pos ); - delete (TQPopupMenu*)popup; - if ( that && d->menuId ) { - switch ( d->menuId - r ) { - case IdClear: clear(); break; - case IdSelectAll: selectAll(); break; - case IdUndo: undo(); break; - case IdRedo: redo(); break; -#ifndef TQT_NO_CLIPBOARD - case IdCut: cut(); break; - case IdCopy: copy(); break; - case IdPaste: paste(); break; -#endif - default: - ; // nothing selected or lineedit destroyed. Be careful. - } - } -#endif //TQT_NO_POPUPMENU -} - -/*! - This function is called to create the popup menu which is shown - when the user clicks on the line edit with the right mouse button. - If you want to create a custom popup menu, reimplement this - function and return the popup menu you create. The popup menu's - ownership is transferred to the caller. -*/ - -TQPopupMenu *TQLineEdit::createPopupMenu() -{ -#ifndef TQT_NO_POPUPMENU - TQPopupMenu *popup = new TQPopupMenu( this, "qt_edit_menu" ); - int id = d->menuId = popup->insertItem( tr( "&Undo" ) + ACCEL_KEY( Z ) ); - popup->insertItem( tr( "&Redo" ) + ACCEL_KEY( Y ) ); - popup->insertSeparator(); - popup->insertItem( tr( "Cu&t" ) + ACCEL_KEY( X ) ); - popup->insertItem( tr( "&Copy" ) + ACCEL_KEY( C ) ); - popup->insertItem( tr( "&Paste" ) + ACCEL_KEY( V ) ); - popup->insertItem( tr( "Clear" ) ); - popup->insertSeparator(); - popup->insertItem( tr( "Select All" ) -#ifndef TQ_WS_X11 - + ACCEL_KEY( A ) -#endif - ); - -#ifndef TQT_NO_IM - TQInputContext *qic = getInputContext(); - if ( qic ) - qic->addMenusTo( popup ); -#endif - - popup->setItemEnabled( id - IdUndo, d->isUndoAvailable() ); - popup->setItemEnabled( id - IdRedo, d->isRedoAvailable() ); -#ifndef TQT_NO_CLIPBOARD - popup->setItemEnabled( id - IdCut, !d->readOnly && d->hasSelectedText() ); - popup->setItemEnabled( id - IdCopy, d->hasSelectedText() ); - popup->setItemEnabled( id - IdPaste, !d->readOnly && !TQApplication::clipboard()->text().isEmpty() ); -#else - popup->setItemVisible( id - IdCut, FALSE ); - popup->setItemVisible( id - IdCopy, FALSE ); - popup->setItemVisible( id - IdPaste, FALSE ); -#endif - popup->setItemEnabled( id - IdClear, !d->readOnly && !d->text.isEmpty() ); - popup->setItemEnabled( id - IdSelectAll, !d->text.isEmpty() && !d->allSelected() ); - return popup; -#else - return 0; -#endif -} - -/*! \reimp */ -void TQLineEdit::windowActivationChange( bool b ) -{ - //### remove me with WHighlightSelection attribute - if ( palette().active() != palette().inactive() ) - update(); - TQWidget::windowActivationChange( b ); -} - -/*! \reimp */ - -void TQLineEdit::setPalette( const TQPalette & p ) -{ - //### remove me with WHighlightSelection attribute - TQWidget::setPalette( p ); - update(); -} - -/*! \reimp */ -void TQLineEdit::setFont( const TQFont & f ) -{ - TQWidget::setFont( f ); - d->updateTextLayout(); -} - -/*! \obsolete -*/ -int TQLineEdit::characterAt( int xpos, TQChar *chr ) const -{ - int pos = d->xToPos( xpos + contentsRect().x() - d->hscroll + innerMargin ); - if ( chr && pos < (int) d->text.length() ) - *chr = d->text.at( pos ); - return pos; -} - -/*! - \internal - - Sets the password character to \a c. - - \sa passwordChar() -*/ - -void TQLineEdit::setPasswordChar( TQChar c ) -{ - d->passwordChar = c; -} - -/*! - \internal - - Returns the password character. - - \sa setPasswordChar() -*/ -TQChar TQLineEdit::passwordChar() const -{ - return ( d->passwordChar.isNull() ? TQChar( style().styleHint( TQStyle::SH_LineEdit_PasswordCharacter, this ) ) : d->passwordChar ); -} - -void TQLineEdit::clipboardChanged() -{ -} - -void TQLineEditPrivate::init( const TQString& txt ) -{ -#ifndef TQT_NO_CURSOR - q->setCursor( readOnly ? arrowCursor : ibeamCursor ); -#endif - q->setFocusPolicy( TQWidget::StrongFocus ); - q->setInputMethodEnabled( TRUE ); - // Specifies that this widget can use more, but is able to survive on - // less, horizontal space; and is fixed vertically. - q->setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed ) ); - q->setBackgroundMode( PaletteBase ); - q->setKeyCompression( TRUE ); - q->setMouseTracking( TRUE ); - q->setAcceptDrops( TRUE ); - q->setFrame( TRUE ); - text = txt; - updateTextLayout(); - cursor = text.length(); -} - -void TQLineEditPrivate::updateTextLayout() -{ - // replace all non-printable characters with spaces (to avoid - // drawing boxes when using fonts that don't have glyphs for such - // characters) - const TQString &displayText = q->displayText(); - TQString str(displayText.unicode(), displayText.length()); - TQChar* uc = (TQChar*)str.unicode(); - for (int i = 0; i < (int)str.length(); ++i) { - if (! uc[i].isPrint()) - uc[i] = TQChar(0x0020); - } - textLayout.setText( str, q->font() ); - textLayout.setDirection((TQChar::Direction)direction); - textLayout.beginLayout(TQTextLayout::SingleLine); - textLayout.beginLine( INT_MAX ); - while ( !textLayout.atEnd() ) - textLayout.addCurrentItem(); - ascent = 0; - textLayout.endLine(0, 0, TQt::AlignLeft|TQt::SingleLine, &ascent); -} - -int TQLineEditPrivate::xToPosInternal( int x, TQTextItem::CursorPosition betweenOrOn ) const -{ - x-= q->contentsRect().x() - hscroll + innerMargin; - for ( int i = 0; i < textLayout.numItems(); ++i ) { - TQTextItem ti = textLayout.itemAt( i ); - TQRect tir = ti.rect(); - if ( x >= tir.left() && x <= tir.right() ) - return ti.xToCursor( x - tir.x(), betweenOrOn ) + ti.from(); - } - return x < 0 ? -1 : text.length(); -} - -int TQLineEditPrivate::xToPos( int x, TQTextItem::CursorPosition betweenOrOn ) const -{ - int pos = xToPosInternal( x, betweenOrOn ); - return ( pos < 0 ) ? 0 : pos; -} - - -TQRect TQLineEditPrivate::cursorRect() const -{ - TQRect cr = q->contentsRect(); - int cix = cr.x() - hscroll + innerMargin; - TQTextItem ci = textLayout.findItem( cursor ); - if ( ci.isValid() ) { - if ( cursor != (int)text.length() && cursor == ci.from() + ci.length() - && ci.isRightToLeft() != isRightToLeft() ) - ci = textLayout.findItem( cursor + 1 ); - cix += ci.x() + ci.cursorToX( cursor - ci.from() ); - } - int ch = q->fontMetrics().height(); - return TQRect( cix-4, cr.y() + ( cr.height() - ch + 1) / 2, 8, ch + 1 ); -} - -void TQLineEditPrivate::updateMicroFocusHint() -{ - // To reduce redundant microfocus update notification, we remember - // the old rect and update the microfocus if actual update is - // required. The rect o is intentionally static because some - // notifyee requires the microfocus information as global update - // rather than per notifyee update to place shared widget around - // microfocus. - static TQRect o; - if ( q->hasFocus() ) { - TQRect r = cursorRect(); - if ( o != r ) { - o = r; - q->setMicroFocusHint( r.x(), r.y(), r.width(), r.height() ); - } - } -} - -void TQLineEditPrivate::moveCursor( int pos, bool mark ) -{ - if ( pos != cursor ) - separate(); - if ( maskData && pos > cursor ) - pos = nextMaskBlank( pos ); - else if ( maskData && pos < cursor ) - pos = prevMaskBlank( pos ); - bool fullUpdate = mark || hasSelectedText(); - if ( mark ) { - int anchor; - if ( selend > selstart && cursor == selstart ) - anchor = selend; - else if ( selend > selstart && cursor == selend ) - anchor = selstart; - else - anchor = cursor; - selstart = TQMIN( anchor, pos ); - selend = TQMAX( anchor, pos ); - } else { - deselect(); - } - if ( fullUpdate ) { - cursor = pos; - q->update(); - } else { - setCursorVisible( FALSE ); - cursor = pos; - setCursorVisible( TRUE ); - } - updateMicroFocusHint(); - if ( mark && !q->style().styleHint( TQStyle::SH_BlinkCursorWhenTextSelected ) ) - setCursorVisible( FALSE ); - if ( mark || selDirty ) { - selDirty = FALSE; - emit q->selectionChanged(); - } -} - -void TQLineEditPrivate::finishChange( int validateFromState, bool setModified ) -{ - bool lineDirty = selDirty; - if ( textDirty ) { - // do validation - bool wasValidInput = validInput; - validInput = TRUE; -#ifndef TQT_NO_VALIDATOR - if ( validator && validateFromState >= 0 ) { - TQString textCopy = text; - int cursorCopy = cursor; - validInput = ( validator->validate( textCopy, cursorCopy ) != TQValidator::Invalid ); - if ( validInput ) { - if ( text != textCopy ) { - q->setText( textCopy ); - cursor = cursorCopy; - return; - } - cursor = cursorCopy; - } - } -#endif - if ( validateFromState >= 0 && wasValidInput && !validInput ) { - undo( validateFromState ); - history.resize( undoState ); - validInput = TRUE; - textDirty = setModified = FALSE; - } - updateTextLayout(); - updateMicroFocusHint(); - lineDirty |= textDirty; - if ( setModified ) - modified = TRUE; - if ( textDirty ) { - textDirty = FALSE; - emit q->textChanged( maskData ? stripString(text) : text ); - } -#if defined(QT_ACCESSIBILITY_SUPPORT) - TQAccessible::updateAccessibility( q, 0, TQAccessible::ValueChanged ); -#endif - } - if ( selDirty ) { - selDirty = FALSE; - emit q->selectionChanged(); - } - if ( lineDirty || !setModified ) - q->update(); -} - -void TQLineEditPrivate::setText( const TQString& txt ) -{ - deselect(); - TQString oldText = text; - if ( maskData ) { - text = maskString( 0, txt, TRUE ); - text += clearString( text.length(), maxLength - text.length() ); - } else { - text = txt.isEmpty() ? txt : txt.left( maxLength ); - } - history.clear(); - undoState = 0; - cursor = text.length(); - textDirty = ( oldText != text ); -} - - -void TQLineEditPrivate::setCursorVisible( bool visible ) -{ - if ( (bool)cursorVisible == visible ) - return; - if ( cursorTimer ) - cursorVisible = visible; - TQRect r = cursorRect(); - if ( maskData || !q->contentsRect().contains( r ) ) - q->update(); - else - q->update( r ); -} - -void TQLineEditPrivate::addCommand( const Command& cmd ) -{ - if ( separator && undoState && history[undoState-1].type != Separator ) { - history.resize( undoState + 2 ); - history[undoState++] = Command( Separator, 0, 0 ); - } else { - history.resize( undoState + 1); - } - separator = FALSE; - history[ undoState++ ] = cmd; -} - -void TQLineEditPrivate::insert( const TQString& s ) -{ - if ( maskData ) { - TQString ms = maskString( cursor, s ); - for ( int i = 0; i < (int) ms.length(); ++i ) { - addCommand ( Command( DeleteSelection, cursor+i, text.at(cursor+i) ) ); - addCommand( Command( Insert, cursor+i, ms.at(i) ) ); - } - text.replace( cursor, ms.length(), ms ); - cursor += ms.length(); - cursor = nextMaskBlank( cursor ); - } else { - int remaining = maxLength - text.length(); - text.insert( cursor, s.left(remaining) ); - for ( int i = 0; i < (int) s.left(remaining).length(); ++i ) - addCommand( Command( Insert, cursor++, s.at(i) ) ); - } - textDirty = TRUE; -} - -void TQLineEditPrivate::del( bool wasBackspace ) -{ - if ( cursor < (int) text.length() ) { - addCommand ( Command( (CommandType)((maskData?2:0)+(wasBackspace?Remove:Delete)), cursor, text.at(cursor) ) ); - if ( maskData ) { - text.replace( cursor, 1, clearString( cursor, 1 ) ); - addCommand( Command( Insert, cursor, text.at( cursor ) ) ); - } else { - text.remove( cursor, 1 ); - } - textDirty = TRUE; - } -} - -void TQLineEditPrivate::removeSelectedText() -{ - if ( selstart < selend && selend <= (int) text.length() ) { - separate(); - int i ; - if ( selstart <= cursor && cursor < selend ) { - // cursor is within the selection. Split up the commands - // to be able to restore the correct cursor position - for ( i = cursor; i >= selstart; --i ) - addCommand ( Command( DeleteSelection, i, text.at(i) ) ); - for ( i = selend - 1; i > cursor; --i ) - addCommand ( Command( DeleteSelection, i - cursor + selstart - 1, text.at(i) ) ); - } else { - for ( i = selend-1; i >= selstart; --i ) - addCommand ( Command( RemoveSelection, i, text.at(i) ) ); - } - if ( maskData ) { - text.replace( selstart, selend - selstart, clearString( selstart, selend - selstart ) ); - for ( int i = 0; i < selend - selstart; ++i ) - addCommand( Command( Insert, selstart + i, text.at( selstart + i ) ) ); - } else { - text.remove( selstart, selend - selstart ); - } - if ( cursor > selstart ) - cursor -= TQMIN( cursor, selend ) - selstart; - deselect(); - textDirty = TRUE; - } -} - -void TQLineEditPrivate::parseInputMask( const TQString &maskFields ) -{ - if ( maskFields.isEmpty() || maskFields.section( ';', 0, 0 ).isEmpty() ) { - if ( maskData ) { - delete [] maskData; - maskData = 0; - maxLength = 32767; - q->setText( TQString::null ); - } - return; - } - - inputMask = maskFields.section( ';', 0, 0 ); - blank = maskFields.section( ';', 1, 1 ).at(0); - if ( blank.isNull() ) - blank = ' '; - - // calculate maxLength / maskData length - maxLength = 0; - TQChar c = 0; - uint i; - for ( i=0; i 0 && inputMask.at( i-1 ) == '\\' ) { - maxLength++; - continue; - } - if ( c != '\\' && c != '!' && - c != '<' && c != '>' && - c != '{' && c != '}' && - c != '[' && c != ']' ) - maxLength++; - } - - delete [] maskData; - maskData = new MaskInputData[ maxLength ]; - - MaskInputData::Casemode m = MaskInputData::NoCaseMode; - c = 0; - bool s; - bool escape = FALSE; - int index = 0; - for ( i = 0; i < inputMask.length(); i++ ) { - c = inputMask.at(i); - if ( escape ) { - s = TRUE; - maskData[ index ].maskChar = c; - maskData[ index ].separator = s; - maskData[ index ].caseMode = m; - index++; - escape = FALSE; - } else if ( c == '<' || c == '>' || c == '!') { - switch ( c ) { - case '<': - m = MaskInputData::Lower; - break; - case '>': - m = MaskInputData::Upper; - break; - case '!': - m = MaskInputData::NoCaseMode; - break; - } - } else if ( c != '{' && c != '}' && c != '[' && c != ']' ) { - switch ( c ) { - case 'A': - case 'a': - case 'N': - case 'n': - case 'X': - case 'x': - case '9': - case '0': - case 'D': - case 'd': - case '#': - s = FALSE; - break; - case '\\': - escape = TRUE; - default: - s = TRUE; - break; - } - - if ( !escape ) { - maskData[ index ].maskChar = c; - maskData[ index ].separator = s; - maskData[ index ].caseMode = m; - index++; - } - } - } - q->setText( TQString::null ); -} - - -/* checks if the key is valid compared to the inputMask */ -bool TQLineEditPrivate::isValidInput( TQChar key, TQChar mask ) const -{ - switch ( mask ) { - case 'A': - if ( key.isLetter() && key != blank ) - return TRUE; - break; - case 'a': - if ( key.isLetter() || key == blank ) - return TRUE; - break; - case 'N': - if ( key.isLetterOrNumber() && key != blank ) - return TRUE; - break; - case 'n': - if ( key.isLetterOrNumber() || key == blank ) - return TRUE; - break; - case 'X': - if ( key.isPrint() && key != blank ) - return TRUE; - break; - case 'x': - if ( key.isPrint() || key == blank ) - return TRUE; - break; - case '9': - if ( key.isNumber() && key != blank ) - return TRUE; - break; - case '0': - if ( key.isNumber() || key == blank ) - return TRUE; - break; - case 'D': - if ( key.isNumber() && key.digitValue() > 0 && key != blank ) - return TRUE; - break; - case 'd': - if ( (key.isNumber() && key.digitValue() > 0) || key == blank ) - return TRUE; - break; - case '#': - if ( key.isNumber() || key == '+' || key == '-' || key == blank ) - return TRUE; - break; - default: - break; - } - return FALSE; -} - -/* - Applies the inputMask on \a str starting from position \a pos in the mask. \a clear - specifies from where characters should be gotten when a separator is met in \a str - TRUE means - that blanks will be used, FALSE that previous input is used. - Calling this when no inputMask is set is undefined. -*/ -TQString TQLineEditPrivate::maskString( uint pos, const TQString &str, bool clear) const -{ - if ( pos >= (uint)maxLength ) - return TQString::fromLatin1(""); - - TQString fill; - fill = clear ? clearString( 0, maxLength ) : text; - - uint strIndex = 0; - TQString s = TQString::fromLatin1(""); - int i = pos; - while ( i < maxLength ) { - if ( strIndex < str.length() ) { - if ( maskData[ i ].separator ) { - s += maskData[ i ].maskChar; - if ( str[(int)strIndex] == maskData[ i ].maskChar ) - strIndex++; - ++i; - } else { - if ( isValidInput( str[(int)strIndex], maskData[ i ].maskChar ) ) { - switch ( maskData[ i ].caseMode ) { - case MaskInputData::Upper: - s += str[(int)strIndex].upper(); - break; - case MaskInputData::Lower: - s += str[(int)strIndex].lower(); - break; - default: - s += str[(int)strIndex]; - } - ++i; - } else { - // search for separator first - int n = findInMask( i, TRUE, TRUE, str[(int)strIndex] ); - if ( n != -1 ) { - if ( str.length() != 1 || i == 0 || (i > 0 && (!maskData[i-1].separator || maskData[i-1].maskChar != str[(int)strIndex])) ) { - s += fill.mid( i, n-i+1 ); - i = n + 1; // update i to find + 1 - } - } else { - // search for valid blank if not - n = findInMask( i, TRUE, FALSE, str[(int)strIndex] ); - if ( n != -1 ) { - s += fill.mid( i, n-i ); - switch ( maskData[ n ].caseMode ) { - case MaskInputData::Upper: - s += str[(int)strIndex].upper(); - break; - case MaskInputData::Lower: - s += str[(int)strIndex].lower(); - break; - default: - s += str[(int)strIndex]; - } - i = n + 1; // updates i to find + 1 - } - } - } - strIndex++; - } - } else - break; - } - - return s; -} - - - -/* - Returns a "cleared" string with only separators and blank chars. - Calling this when no inputMask is set is undefined. -*/ -TQString TQLineEditPrivate::clearString( uint pos, uint len ) const -{ - if ( pos >= (uint)maxLength ) - return TQString::null; - - TQString s; - int end = TQMIN( (uint)maxLength, pos + len ); - for ( int i=pos; i= maxLength || pos < 0 ) - return -1; - - int end = forward ? maxLength : -1; - int step = forward ? 1 : -1; - int i = pos; - - while ( i != end ) { - if ( findSeparator ) { - if ( maskData[ i ].separator && maskData[ i ].maskChar == searchChar ) - return i; - } else { - if ( !maskData[ i ].separator ) { - if ( searchChar.isNull() ) - return i; - else if ( isValidInput( searchChar, maskData[ i ].maskChar ) ) - return i; - } - } - i += step; - } - return -1; -} - - -#endif // TQT_NO_LINEEDIT diff --git a/src/widgets/qlistview.cpp b/src/widgets/qlistview.cpp index 5ee18d929..5c00bca11 100644 --- a/src/widgets/qlistview.cpp +++ b/src/widgets/qlistview.cpp @@ -58,7 +58,7 @@ #include "tqpopupmenu.h" #include "ntqtl.h" #include "tqdragobject.h" -#include "ntqlineedit.h" +#include "tqlineedit.h" #include "ntqvbox.h" #include "tqtooltip.h" #include "tqstyle.h" diff --git a/src/widgets/qmultilineedit.cpp b/src/widgets/qmultilineedit.cpp index 85254a314..bd8ffd8cd 100644 --- a/src/widgets/qmultilineedit.cpp +++ b/src/widgets/qmultilineedit.cpp @@ -41,7 +41,7 @@ #include "ntqmultilineedit.h" #ifndef TQT_NO_MULTILINEEDIT #include "tqpainter.h" -#include "ntqscrollbar.h" +#include "tqscrollbar.h" #include "ntqcursor.h" #include "tqclipboard.h" #include "tqpixmap.h" diff --git a/src/widgets/qpushbutton.cpp b/src/widgets/qpushbutton.cpp deleted file mode 100644 index 37cbccd9d..000000000 --- a/src/widgets/qpushbutton.cpp +++ /dev/null @@ -1,762 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQPushButton class -** -** Created : 940221 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqpushbutton.h" -#ifndef TQT_NO_PUSHBUTTON -#include "ntqdialog.h" -#include "tqfontmetrics.h" -#include "tqpainter.h" -#include "ntqdrawutil.h" -#include "tqpixmap.h" -#include "tqbitmap.h" -#include "tqpopupmenu.h" -#include "ntqguardedptr.h" -#include "ntqapplication.h" -#include "tqtoolbar.h" -#include "tqstyle.h" -#if defined(QT_ACCESSIBILITY_SUPPORT) -#include "ntqaccessible.h" -#endif - -/*! - \class TQPushButton ntqpushbutton.h - \brief The TQPushButton widget provides a command button. - - \ingroup basic - \mainclass - - The push button, or command button, is perhaps the most commonly - used widget in any graphical user interface. Push (click) a button - to command the computer to perform some action, or to answer a - question. Typical buttons are OK, Apply, Cancel, Close, Yes, No - and Help. - - A command button is rectangular and typically displays a text - label describing its action. An underlined character in the label - (signified by preceding it with an ampersand in the text) - indicates an accelerator key, e.g. - \code - TQPushButton *pb = new TQPushButton( "&Download", this ); - \endcode - In this example the accelerator is \e{Alt+D}, and the label text - will be displayed as Download. - - Push buttons can display a textual label or a pixmap, and - optionally a small icon. These can be set using the constructors - and changed later using setText(), setPixmap() and setIconSet(). - If the button is disabled the appearance of the text or pixmap and - iconset will be manipulated with respect to the GUI style to make - the button look "disabled". - - A push button emits the signal clicked() when it is activated by - the mouse, the Spacebar or by a keyboard accelerator. Connect to - this signal to perform the button's action. Push buttons also - provide less commonly used signals, for example, pressed() and - released(). - - Command buttons in dialogs are by default auto-default buttons, - i.e. they become the default push button automatically when they - receive the keyboard input focus. A default button is a push - button that is activated when the user presses the Enter or Return - key in a dialog. You can change this with setAutoDefault(). Note - that auto-default buttons reserve a little extra space which is - necessary to draw a default-button indicator. If you do not want - this space around your buttons, call setAutoDefault(FALSE). - - Being so central, the button widget has grown to accommodate a - great many variations in the past decade. The Microsoft style - guide now shows about ten different states of Windows push buttons - and the text implies that there are dozens more when all the - combinations of features are taken into consideration. - - The most important modes or states are: - \list - \i Available or not (grayed out, disabled). - \i Standard push button, toggling push button or menu button. - \i On or off (only for toggling push buttons). - \i Default or normal. The default button in a dialog can generally - be "clicked" using the Enter or Return key. - \i Auto-repeat or not. - \i Pressed down or not. - \endlist - - As a general rule, use a push button when the application or - dialog window performs an action when the user clicks on it (such - as Apply, Cancel, Close and Help) \e and when the widget is - supposed to have a wide, rectangular shape with a text label. - Small, typically square buttons that change the state of the - window rather than performing an action (such as the buttons in - the top-right corner of the TQFileDialog) are not command buttons, - but tool buttons. TQt provides a special class (TQToolButton) for - these buttons. - - If you need toggle behavior (see setToggleButton()) or a button - that auto-repeats the activation signal when being pushed down - like the arrows in a scroll bar (see setAutoRepeat()), a command - button is probably not what you want. When in doubt, use a tool - button. - - A variation of a command button is a menu button. These provide - not just one command, but several, since when they are clicked - they pop up a menu of options. Use the method setPopup() to - associate a popup menu with a push button. - - Other classes of buttons are option buttons (see TQRadioButton) and - check boxes (see TQCheckBox). - - - - In TQt, the TQButton abstract base class provides most of the modes - and other API, and TQPushButton provides GUI logic. See TQButton for - more information about the API. - - \important text, setText, text, pixmap, setPixmap, accel, setAccel, - isToggleButton, setDown, isDown, isOn, state, autoRepeat, - isExclusiveToggle, group, setAutoRepeat, toggle, pressed, released, - clicked, toggled, state stateChanged - - \sa TQToolButton, TQRadioButton TQCheckBox - \link guibooks.html#fowler GUI Design Handbook: Push Button\endlink -*/ - -/*! - \property TQPushButton::autoDefault - \brief whether the push button is the auto default button - - If this property is set to TRUE then the push button is the auto - default button in a dialog. - - In some GUI styles a default button is drawn with an extra frame - around it, up to 3 pixels or more. TQt automatically keeps this - space free around auto-default buttons, i.e. auto-default buttons - may have a slightly larger size hint. - - This property's default is TRUE for buttons that have a TQDialog - parent; otherwise it defaults to FALSE. - - See the \l default property for details of how \l default and - auto-default interact. -*/ - -/*! - \property TQPushButton::autoMask - \brief whether the button is automatically masked - - \sa TQWidget::setAutoMask() -*/ - -/*! - \property TQPushButton::default - \brief whether the push button is the default button - - If this property is set to TRUE then the push button will be - pressed if the user presses the Enter (or Return) key in a dialog. - - Regardless of focus, if the user presses Enter: If there is a - default button the default button is pressed; otherwise, if - there are one or more \l autoDefault buttons the first \l autoDefault - button that is next in the tab order is pressed. If there are no - default or \l autoDefault buttons only pressing Space on a button - with focus, mouse clicking, or using an accelerator will press a - button. - - In a dialog, only one push button at a time can be the default - button. This button is then displayed with an additional frame - (depending on the GUI style). - - The default button behavior is provided only in dialogs. Buttons - can always be clicked from the keyboard by pressing Enter (or - Return) or the Spacebar when the button has focus. - - This property's default is FALSE. -*/ - -/*! - \property TQPushButton::flat - \brief whether the border is disabled - - This property's default is FALSE. -*/ - -/*! - \property TQPushButton::iconSet - \brief the icon set on the push button - - This property will return 0 if the push button has no iconset. -*/ - -/*! - \property TQPushButton::on - \brief whether the push button is toggled - - This property should only be set for toggle push buttons. The - default value is FALSE. - - \sa isOn(), toggle(), toggled(), isToggleButton() -*/ - -/*! - \property TQPushButton::toggleButton - \brief whether the button is a toggle button - - Toggle buttons have an on/off state similar to \link TQCheckBox - check boxes. \endlink A push button is initially not a toggle - button. - - \sa setOn(), toggle(), isToggleButton() toggled() -*/ - -/*! \property TQPushButton::menuButton - \brief whether the push button has a menu button on it - \obsolete - - If this property is set to TRUE, then a down arrow is drawn on the push - button to indicate that a menu will pop up if the user clicks on the - arrow. -*/ - -class TQPushButtonPrivate -{ -public: - TQPushButtonPrivate() - :iconset( 0 ) - {} - ~TQPushButtonPrivate() - { -#ifndef TQT_NO_ICONSET - delete iconset; -#endif - } -#ifndef TQT_NO_POPUPMENU - TQGuardedPtr popup; -#endif - TQIconSet* iconset; -}; - - -/*! - Constructs a push button with no text. - - The \a parent and \a name arguments are sent on to the TQWidget - constructor. -*/ - -TQPushButton::TQPushButton( TQWidget *parent, const char *name ) - : TQButton( parent, name ) -{ - init(); -} - -/*! - Constructs a push button called \a name with the parent \a parent - and the text \a text. -*/ - -TQPushButton::TQPushButton( const TQString &text, TQWidget *parent, - const char *name ) - : TQButton( parent, name ) -{ - init(); - setText( text ); -} - - -/*! - Constructs a push button with an \a icon and a \a text. - - Note that you can also pass a TQPixmap object as an icon (thanks to - the implicit type conversion provided by C++). - - The \a parent and \a name arguments are sent to the TQWidget - constructor. -*/ -#ifndef TQT_NO_ICONSET -TQPushButton::TQPushButton( const TQIconSet& icon, const TQString &text, - TQWidget *parent, const char *name ) - : TQButton( parent, name ) -{ - init(); - setText( text ); - setIconSet( icon ); -} -#endif - - -/*! - Destroys the push button. -*/ -TQPushButton::~TQPushButton() -{ - delete d; -} - -void TQPushButton::init() -{ - d = 0; - defButton = FALSE; - lastEnabled = FALSE; - hasMenuArrow = FALSE; - flt = FALSE; -#ifndef TQT_NO_DIALOG - autoDefButton = ::tqt_cast(topLevelWidget()) != 0; -#else - autoDefButton = FALSE; -#endif - setBackgroundMode( PaletteButton ); - setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) ); -} - - -/* - Makes the push button a toggle button if \a enable is TRUE or a normal - push button if \a enable is FALSE. - - Toggle buttons have an on/off state similar to \link TQCheckBox check - boxes. \endlink A push button is initially not a toggle button. - - \sa setOn(), toggle(), isToggleButton() toggled() -*/ - -void TQPushButton::setToggleButton( bool enable ) -{ - TQButton::setToggleButton( enable ); -} - - -/* - Switches a toggle button on if \a enable is TRUE or off if \a enable is - FALSE. - \sa isOn(), toggle(), toggled(), isToggleButton() -*/ - -void TQPushButton::setOn( bool enable ) -{ - if ( !isToggleButton() ) - return; - TQButton::setOn( enable ); -} - -void TQPushButton::setAutoDefault( bool enable ) -{ - if ( (bool)autoDefButton == enable ) - return; - autoDefButton = enable; - update(); - updateGeometry(); -} - - -void TQPushButton::setDefault( bool enable ) -{ - if ( (bool)defButton == enable ) - return; // no change - defButton = enable; -#ifndef TQT_NO_DIALOG - if ( defButton && ::tqt_cast(topLevelWidget()) ) - ((TQDialog*)topLevelWidget())->setMainDefault( this ); -#endif - update(); -#if defined(QT_ACCESSIBILITY_SUPPORT) - TQAccessible::updateAccessibility( this, 0, TQAccessible::StateChanged ); -#endif -} - - -/*! - \reimp -*/ -TQSize TQPushButton::sizeHint() const -{ - constPolish(); - - int w = 0, h = 0; - - // calculate contents size... -#ifndef TQT_NO_ICONSET - if ( iconSet() && !iconSet()->isNull() ) { - int iw = iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ).width() + 4; - int ih = iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ).height(); - w += iw; - h = TQMAX( h, ih ); - } -#endif - if ( isMenuButton() ) - w += style().pixelMetric(TQStyle::PM_MenuButtonIndicator, this); - - if ( pixmap() ) { - TQPixmap *pm = (TQPixmap *)pixmap(); - w += pm->width(); - h += pm->height(); - } else { - TQString s( text() ); - bool empty = s.isEmpty(); - if ( empty ) - s = TQString::fromLatin1("XXXX"); - TQFontMetrics fm = fontMetrics(); - TQSize sz = fm.size( ShowPrefix, s ); - if(!empty || !w) - w += sz.width(); - if(!empty || !h) - h = TQMAX(h, sz.height()); - } - - return (style().sizeFromContents(TQStyle::CT_PushButton, this, TQSize(w, h)). - expandedTo(TQApplication::globalStrut())); -} - - -/*! - \reimp -*/ -void TQPushButton::move( int x, int y ) -{ - TQWidget::move( x, y ); -} - -/*! - \reimp -*/ -void TQPushButton::move( const TQPoint &p ) -{ - move( p.x(), p.y() ); -} - -/*! - \reimp -*/ -void TQPushButton::resize( int w, int h ) -{ - TQWidget::resize( w, h ); -} - -/*! - \reimp -*/ -void TQPushButton::resize( const TQSize &s ) -{ - resize( s.width(), s.height() ); -} - -/*! - \reimp -*/ -void TQPushButton::setGeometry( int x, int y, int w, int h ) -{ - TQWidget::setGeometry( x, y, w, h ); -} - -/*! - \reimp -*/ -void TQPushButton::setGeometry( const TQRect &r ) -{ - TQWidget::setGeometry( r ); -} - -/*! - \reimp - */ -void TQPushButton::resizeEvent( TQResizeEvent * ) -{ - if ( autoMask() ) - updateMask(); -} - -/*! - \reimp -*/ -void TQPushButton::drawButton( TQPainter *paint ) -{ - int diw = 0; - if ( isDefault() || autoDefault() ) { - diw = style().pixelMetric(TQStyle::PM_ButtonDefaultIndicator, this); - - if ( diw > 0 ) { - if (backgroundMode() == X11ParentRelative) { - erase( 0, 0, width(), diw ); - erase( 0, 0, diw, height() ); - erase( 0, height() - diw, width(), diw ); - erase( width() - diw, 0, diw, height() ); - } else if ( parentWidget() && parentWidget()->backgroundPixmap() ){ - // pseudo tranparency - paint->drawTiledPixmap( 0, 0, width(), diw, - *parentWidget()->backgroundPixmap(), - x(), y() ); - paint->drawTiledPixmap( 0, 0, diw, height(), - *parentWidget()->backgroundPixmap(), - x(), y() ); - paint->drawTiledPixmap( 0, height()-diw, width(), diw, - *parentWidget()->backgroundPixmap(), - x(), y()+height() ); - paint->drawTiledPixmap( width()-diw, 0, diw, height(), - *parentWidget()->backgroundPixmap(), - x()+width(), y() ); - } else { - paint->fillRect( 0, 0, width(), diw, - colorGroup().brush(TQColorGroup::Background) ); - paint->fillRect( 0, 0, diw, height(), - colorGroup().brush(TQColorGroup::Background) ); - paint->fillRect( 0, height()-diw, width(), diw, - colorGroup().brush(TQColorGroup::Background) ); - paint->fillRect( width()-diw, 0, diw, height(), - colorGroup().brush(TQColorGroup::Background) ); - } - - } - } - - TQStyle::SFlags flags = TQStyle::Style_Default; - if (isEnabled()) - flags |= TQStyle::Style_Enabled; - if (hasFocus()) - flags |= TQStyle::Style_HasFocus; - if (isDown()) - flags |= TQStyle::Style_Down; - if (isOn()) - flags |= TQStyle::Style_On; - if (! isFlat() && ! isDown()) - flags |= TQStyle::Style_Raised; - if (isDefault()) - flags |= TQStyle::Style_ButtonDefault; - if (hasMouse()) - flags |= TQStyle::Style_MouseOver; - - style().drawControl(TQStyle::CE_PushButton, paint, this, rect(), colorGroup(), flags); - drawButtonLabel( paint ); - - lastEnabled = isEnabled(); -} - - -/*! - \reimp -*/ -void TQPushButton::drawButtonLabel( TQPainter *paint ) -{ - - TQStyle::SFlags flags = TQStyle::Style_Default; - if (isEnabled()) - flags |= TQStyle::Style_Enabled; - if (hasFocus()) - flags |= TQStyle::Style_HasFocus; - if (isDown()) - flags |= TQStyle::Style_Down; - if (isOn()) - flags |= TQStyle::Style_On; - if (! isFlat() && ! isDown()) - flags |= TQStyle::Style_Raised; - if (isDefault()) - flags |= TQStyle::Style_ButtonDefault; - - style().drawControl(TQStyle::CE_PushButtonLabel, paint, this, - style().subRect(TQStyle::SR_PushButtonContents, this), - colorGroup(), flags); -} - - -/*! - \reimp - */ -void TQPushButton::updateMask() -{ - TQBitmap bm( size() ); - bm.fill( color0 ); - - { - TQPainter p( &bm, this ); - style().drawControlMask(TQStyle::CE_PushButton, &p, this, rect()); - } - - setMask( bm ); -} - -/*! - \reimp -*/ -void TQPushButton::focusInEvent( TQFocusEvent *e ) -{ - if (autoDefButton && !defButton) { - defButton = TRUE; -#ifndef TQT_NO_DIALOG - if ( defButton && ::tqt_cast(topLevelWidget()) ) - ((TQDialog*)topLevelWidget())->setDefault( this ); -#endif - } - TQButton::focusInEvent( e ); -} - -/*! - \reimp -*/ -void TQPushButton::focusOutEvent( TQFocusEvent *e ) -{ -#ifndef TQT_NO_DIALOG - if ( defButton && autoDefButton ) { - if ( ::tqt_cast(topLevelWidget()) ) - ((TQDialog*)topLevelWidget())->setDefault( 0 ); - } -#endif - - TQButton::focusOutEvent( e ); -#ifndef TQT_NO_POPUPMENU - if ( popup() && popup()->isVisible() ) // restore pressed status - setDown( TRUE ); -#endif -} - - -#ifndef TQT_NO_POPUPMENU -/*! - Associates the popup menu \a popup with this push button. This - turns the button into a menu button. - - Ownership of the popup menu is \e not transferred to the push - button. - - \sa popup() -*/ -void TQPushButton::setPopup( TQPopupMenu* popup ) -{ - if ( !d ) - d = new TQPushButtonPrivate; - if ( popup && !d->popup ) - connect( this, TQ_SIGNAL( pressed() ), this, TQ_SLOT( popupPressed() ) ); - - d->popup = popup; - setIsMenuButton( popup != 0 ); -} -#endif //TQT_NO_POPUPMENU -#ifndef TQT_NO_ICONSET -void TQPushButton::setIconSet( const TQIconSet& icon ) -{ - if ( !d ) - d = new TQPushButtonPrivate; - if ( !icon.isNull() ) { - if ( d->iconset ) - *d->iconset = icon; - else - d->iconset = new TQIconSet( icon ); - } else if ( d->iconset) { - delete d->iconset; - d->iconset = 0; - } - - update(); - updateGeometry(); -} - - -TQIconSet* TQPushButton::iconSet() const -{ - return d ? d->iconset : 0; -} -#endif // TQT_NO_ICONSET -#ifndef TQT_NO_POPUPMENU -/*! - Returns the button's associated popup menu or 0 if no popup menu - has been set. - - \sa setPopup() -*/ -TQPopupMenu* TQPushButton::popup() const -{ - return d ? (TQPopupMenu*)d->popup : 0; -} - -void TQPushButton::popupPressed() -{ - TQPopupMenu* popup = d ? (TQPopupMenu*) d->popup : 0; - TQGuardedPtr that = this; - if ( isDown() && popup ) { - bool horizontal = TRUE; - bool topLeft = TRUE; // ### always TRUE -#ifndef TQT_NO_TOOLBAR - TQToolBar *tb = ::tqt_cast(parentWidget()); - if ( tb && tb->orientation() == Vertical ) - horizontal = FALSE; -#endif - if ( horizontal ) { - if ( topLeft ) { - if ( mapToGlobal( TQPoint( 0, rect().bottom() ) ).y() + popup->sizeHint().height() <= tqApp->desktop()->height() ) - popup->exec( mapToGlobal( rect().bottomLeft() ) ); - else - popup->exec( mapToGlobal( rect().topLeft() - TQPoint( 0, popup->sizeHint().height() ) ) ); - } else { - TQSize sz( popup->sizeHint() ); - TQPoint p = mapToGlobal( rect().topLeft() ); - p.ry() -= sz.height(); - popup->exec( p ); - } - } else { - if ( topLeft ) { - if ( mapToGlobal( TQPoint( rect().right(), 0 ) ).x() + popup->sizeHint().width() <= tqApp->desktop()->width() ) - popup->exec( mapToGlobal( rect().topRight() ) ); - else - popup->exec( mapToGlobal( rect().topLeft() - TQPoint( popup->sizeHint().width(), 0 ) ) ); - } else { - TQSize sz( popup->sizeHint() ); - TQPoint p = mapToGlobal( rect().topLeft() ); - p.rx() -= sz.width(); - popup->exec( p ); - } - } - if (that) - setDown( FALSE ); - } -} -#endif - -void TQPushButton::setFlat( bool f ) -{ - flt = f; - update(); -} - -bool TQPushButton::isFlat() const -{ - return flt; -} - -/*! - \obsolete - \fn virtual void TQPushButton::setIsMenuButton( bool enable ) -*/ - -#endif diff --git a/src/widgets/qradiobutton.cpp b/src/widgets/qradiobutton.cpp deleted file mode 100644 index dead844e5..000000000 --- a/src/widgets/qradiobutton.cpp +++ /dev/null @@ -1,358 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQRadioButton class -** -** Created : 940222 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqradiobutton.h" -#ifndef TQT_NO_RADIOBUTTON -#include "ntqbuttongroup.h" -#include "tqpainter.h" -#include "ntqdrawutil.h" -#include "tqpixmap.h" -#include "tqpixmapcache.h" -#include "tqbitmap.h" -#include "tqtextstream.h" -#include "ntqapplication.h" -#include "tqstyle.h" - -/*! - \class TQRadioButton ntqradiobutton.h - \brief The TQRadioButton widget provides a radio button with a text or pixmap label. - - \ingroup basic - \mainclass - - TQRadioButton and TQCheckBox are both option buttons. That is, they - can be switched on (checked) or off (unchecked). The classes - differ in how the choices for the user are restricted. Check boxes - define "many of many" choices, whereas radio buttons provide a - "one of many" choice. In a group of radio buttons only one radio - button at a time can be checked; if the user selects another - button, the previously selected button is switched off. - - The easiest way to implement a "one of many" choice is simply to - put the radio buttons into TQButtonGroup. - - Whenever a button is switched on or off it emits the signal - toggled(). Connect to this signal if you want to trigger an action - each time the button changes state. Otherwise, use isChecked() to - see if a particular button is selected. - - Just like TQPushButton, a radio button can display text or a - pixmap. The text can be set in the constructor or with setText(); - the pixmap is set with setPixmap(). - - - - \important text, setText, text, pixmap, setPixmap, accel, setAccel, isToggleButton, setDown, isDown, isOn, state, autoRepeat, isExclusiveToggle, group, setAutoRepeat, toggle, pressed, released, clicked, toggled, state stateChanged - - \sa TQPushButton TQToolButton - \link guibooks.html#fowler GUI Design Handbook: Radio Button\endlink -*/ - -/*! - \property TQRadioButton::checked \brief Whether the radio button is - checked - - This property will not effect any other radio buttons unless they - have been placed in the same TQButtonGroup. The default value is - FALSE (unchecked). -*/ - -/*! - \property TQRadioButton::autoMask \brief whether the radio button - is automatically masked - - \sa TQWidget::setAutoMask() -*/ - -/*! - Constructs a radio button with no text. - - The \a parent and \a name arguments are sent on to the TQWidget - constructor. -*/ - -TQRadioButton::TQRadioButton( TQWidget *parent, const char *name ) - : TQButton( parent, name, WNoAutoErase | WMouseNoMask ) -{ - init(); -} - -/*! - Constructs a radio button with the text \a text. - - The \a parent and \a name arguments are sent on to the TQWidget - constructor. -*/ - -TQRadioButton::TQRadioButton( const TQString &text, TQWidget *parent, - const char *name ) - : TQButton( parent, name, WNoAutoErase | WMouseNoMask ) -{ - init(); - setText( text ); -} - - -/* - Initializes the radio button. -*/ - -void TQRadioButton::init() -{ - setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) ); - setToggleButton( TRUE ); -#ifndef TQT_NO_BUTTONGROUP - TQButtonGroup *bgrp = ::tqt_cast(parentWidget()); - if ( bgrp ) - bgrp->setRadioButtonExclusive( TRUE ); -#endif -} - -void TQRadioButton::setChecked( bool check ) -{ - setOn( check ); -} - - - - -/*! - \reimp -*/ -TQSize TQRadioButton::sizeHint() const -{ - // Any more complex, and we will use style().itemRect() - // NB: TQCheckBox::sizeHint() is similar - constPolish(); - - TQPainter p(this); - TQSize sz = style().itemRect(&p, TQRect(0, 0, 1, 1), ShowPrefix, FALSE, - pixmap(), text()).size(); - - return (style().sizeFromContents(TQStyle::CT_RadioButton, this, sz). - expandedTo(TQApplication::globalStrut())); -} - - -/*! - \reimp -*/ -bool TQRadioButton::hitButton( const TQPoint &pos ) const -{ - TQRect r = - TQStyle::visualRect( style().subRect( TQStyle::SR_RadioButtonFocusRect, - this ), this ); - if ( tqApp->reverseLayout() ) { - r.setRight( width() ); - } else { - r.setLeft( 0 ); - } - return r.contains( pos ); -} - - -/*! - \reimp -*/ -void TQRadioButton::drawButton( TQPainter *paint ) -{ - TQPainter *p = paint; - TQRect irect = TQStyle::visualRect( style().subRect(TQStyle::SR_RadioButtonIndicator, this), this ); - const TQColorGroup &cg = colorGroup(); - -#if !defined( TQT_NO_TEXTSTREAM ) && !defined( TQ_WS_MACX ) -# define SAVE_RADIOBUTTON_PIXMAPS -#endif -#if defined(SAVE_RADIOBUTTON_PIXMAPS) - TQString pmkey; // pixmap key - int kf = 0; - if ( isDown() ) - kf |= 1; - if ( isOn() ) - kf |= 2; - if ( isEnabled() ) - kf |= 4; - if( isActiveWindow() ) - kf |= 8; - if ( hasMouse() ) - kf |= 16; - if ( hasFocus() ) - kf |= 32; - - TQTextOStream os(&pmkey); - os << "$qt_radio_" << style().className() << "_" - << palette().serialNumber() << "_" << irect.width() << "x" << irect.height() << "_" << kf; - TQPixmap *pm = TQPixmapCache::find( pmkey ); - if ( pm ) { // pixmap exists - drawButtonLabel( p ); - p->drawPixmap( irect.topLeft(), *pm ); - return; - } - bool use_pm = TRUE; - TQPainter pmpaint; - int wx, wy; - if ( use_pm ) { - pm = new TQPixmap( irect.size() ); // create new pixmap - TQ_CHECK_PTR( pm ); - pm->fill(paletteBackgroundColor()); - TQPainter::redirect(this, pm); - pmpaint.begin(this); - p = &pmpaint; // draw in pixmap - wx = irect.x(); // save x,y coords - wy = irect.y(); - irect.moveTopLeft(TQPoint(0, 0)); - p->setBackgroundColor(paletteBackgroundColor()); - } -#endif - - TQStyle::SFlags flags = TQStyle::Style_Default; - if ( isEnabled() ) - flags |= TQStyle::Style_Enabled; - if ( hasFocus() ) - flags |= TQStyle::Style_HasFocus; - if ( isDown() ) - flags |= TQStyle::Style_Down; - if ( hasMouse() ) - flags |= TQStyle::Style_MouseOver; - if ( state() == TQButton::On ) - flags |= TQStyle::Style_On; - else if ( state() == TQButton::Off ) - flags |= TQStyle::Style_Off; - - style().drawControl(TQStyle::CE_RadioButton, p, this, irect, cg, flags); - -#if defined(SAVE_RADIOBUTTON_PIXMAPS) - if ( use_pm ) { - pmpaint.end(); - TQPainter::redirect(this, NULL); - if ( backgroundPixmap() || backgroundMode() == X11ParentRelative ) { - TQBitmap bm( pm->size() ); - bm.fill( color0 ); - pmpaint.begin( &bm ); - style().drawControlMask(TQStyle::CE_RadioButton, &pmpaint, this, irect); - pmpaint.end(); - pm->setMask( bm ); - } - p = paint; // draw in default device - p->drawPixmap( wx, wy, *pm ); - if (!TQPixmapCache::insert(pmkey, pm) ) // save in cache - delete pm; - } -#endif - - drawButtonLabel( p ); -} - - - -/*! - \reimp -*/ -void TQRadioButton::drawButtonLabel( TQPainter *p ) -{ - TQRect r = - TQStyle::visualRect( style().subRect(TQStyle::SR_RadioButtonContents, - this), this ); - - TQStyle::SFlags flags = TQStyle::Style_Default; - if (isEnabled()) - flags |= TQStyle::Style_Enabled; - if (hasFocus()) - flags |= TQStyle::Style_HasFocus; - if (isDown()) - flags |= TQStyle::Style_Down; - if (state() == TQButton::On) - flags |= TQStyle::Style_On; - else if (state() == TQButton::Off) - flags |= TQStyle::Style_Off; - - style().drawControl(TQStyle::CE_RadioButtonLabel, p, this, r, colorGroup(), flags); -} - - -/*! - \reimp -*/ -void TQRadioButton::resizeEvent( TQResizeEvent* e ) -{ - TQButton::resizeEvent(e); - if ( isVisible() ) { - TQPainter p(this); - TQSize isz = style().itemRect(&p, TQRect(0, 0, 1, 1), ShowPrefix, FALSE, - pixmap(), text()).size(); - TQSize wsz = (style().sizeFromContents(TQStyle::CT_RadioButton, this, isz). - expandedTo(TQApplication::globalStrut())); - - update(wsz.width(), isz.width(), 0, wsz.height()); - } - if (autoMask()) - updateMask(); -} - -/*! - \reimp -*/ -void TQRadioButton::updateMask() -{ - TQRect irect = - TQStyle::visualRect( style().subRect( TQStyle::SR_RadioButtonIndicator, - this ), this ); - - TQBitmap bm(width(), height()); - bm.fill(color0); - - TQPainter p( &bm, this ); - style().drawControlMask(TQStyle::CE_RadioButton, &p, this, irect); - if ( ! text().isNull() || ( pixmap() && ! pixmap()->isNull() ) ) { - TQRect crect = - TQStyle::visualRect( style().subRect( TQStyle::SR_RadioButtonContents, - this ), this ); - TQRect frect = - TQStyle::visualRect( style().subRect( TQStyle::SR_RadioButtonFocusRect, - this ), this ); - TQRect label(crect.unite(frect)); - p.fillRect(label, color1); - } - p.end(); - - setMask(bm); -} - -#endif diff --git a/src/widgets/qscrollbar.cpp b/src/widgets/qscrollbar.cpp deleted file mode 100644 index 2b350c30a..000000000 --- a/src/widgets/qscrollbar.cpp +++ /dev/null @@ -1,1074 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQScrollBar class -** -** Created : 940427 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqscrollbar.h" -#ifndef TQT_NO_SCROLLBAR -#include "tqpainter.h" -#include "tqbitmap.h" -#include "ntqapplication.h" -#include "tqtimer.h" -#include "tqstyle.h" -#ifndef TQT_NO_CURSOR -#include -#endif -#if defined(QT_ACCESSIBILITY_SUPPORT) -#include "ntqaccessible.h" -#endif -#include - -/*! - \class TQScrollBar - \brief The TQScrollBar widget provides a vertical or horizontal scroll bar. - - \ingroup basic - - A scroll bar allows the user to control a value within a - program-definable range and gives users a visible indication of - the current value of a \link TQRangeControl range control \endlink. - - Scroll bars include four separate controls: - - \list - - \i The \e line-up and \e line-down controls are little buttons - which the user can use to move one "line" up or down. The meaning - of line is configurable. In editors and list boxes it means one - line of text; in an image viewer it might mean 20 pixels. - - \i The \e slider is the handle that indicates the current value of - the scroll bar, which the user can drag to change the value. This - part of the scroll bar is sometimes called the "thumb". - - \i The \e page-up/page-down control is the area on which the - slider slides (the scroll bar's background). Clicking here moves - the scroll bar towards the click. The meaning of "page" is also - configurable: in editors and list boxes it means as many lines as - there is space for in the widget. - - \endlist - - TQScrollBar has very few of its own functions; it mostly relies on - TQRangeControl. The most useful functions are setValue() to set the - scroll bar directly to some value; addPage(), addLine(), - subtractPage(), and subtractLine() to simulate the effects of - clicking (useful for accelerator keys); setSteps() to define the - values of pageStep() and lineStep(); and setRange() to set the - minValue() and maxValue() of the scroll bar. TQScrollBar has a - convenience constructor with which you can set most of these - properties. - - Some GUI styles (for example, the Windows and Motif styles - provided with TQt), also use the pageStep() value to calculate the - size of the slider. - - In addition to the access functions from TQRangeControl, TQScrollBar - provides a comprehensive set of signals: - \table - \header \i Signal \i Emitted when - \row \i \l valueChanged() - \i the scroll bar's value has changed. The tracking() - determines whether this signal is emitted during user - interaction. - \row \i \l sliderPressed() - \i the user starts to drag the slider. - \row \i \l sliderMoved() - \i the user drags the slider. - \row \i \l sliderReleased() - \i the user releases the slider. - \row \i \l nextLine() - \i the scroll bar has moved one line down or right. Line is - defined in TQRangeControl. - \row \i \l prevLine() - \i the scroll bar has moved one line up or left. - \row \i \l nextPage() - \i the scroll bar has moved one page down or right. - \row \i \l prevPage() - \i the scroll bar has moved one page up or left. - \endtable - - TQScrollBar only provides integer ranges. Note that although - TQScrollBar handles very large numbers, scroll bars on current - screens cannot usefully control ranges above about 100,000 pixels. - Beyond that, it becomes difficult for the user to control the - scroll bar using either the keyboard or the mouse. - - A scroll bar can be controlled by the keyboard, but it has a - default focusPolicy() of \c NoFocus. Use setFocusPolicy() to - enable keyboard focus. See keyPressEvent() for a list of key - bindings. - - If you need to add scroll bars to an interface, consider using the - TQScrollView class, which encapsulates the common uses for scroll - bars. - - - - \sa TQSlider TQSpinBox TQScrollView - \link guibooks.html#fowler GUI Design Handbook: Scroll Bar\endlink -*/ - - -/*! - \fn void TQScrollBar::valueChanged( int value ) - - This signal is emitted when the scroll bar value has changed, with - the new scroll bar \a value as an argument. -*/ - -/*! - \fn void TQScrollBar::sliderPressed() - - This signal is emitted when the user presses the slider with the - mouse. -*/ - -/*! - \fn void TQScrollBar::sliderMoved( int value ) - - This signal is emitted when the slider is dragged by the user, with - the new scroll bar \a value as an argument. - - This signal is emitted even when tracking is turned off. - - \sa tracking() valueChanged() nextLine() prevLine() nextPage() - prevPage() -*/ - -/*! - \fn void TQScrollBar::sliderReleased() - - This signal is emitted when the user releases the slider with the - mouse. -*/ - -/*! - \fn void TQScrollBar::nextLine() - - This signal is emitted when the scroll bar scrolls one line down - or right. -*/ - -/*! - \fn void TQScrollBar::prevLine() - - This signal is emitted when the scroll bar scrolls one line up or - left. -*/ - -/*! - \fn void TQScrollBar::nextPage() - - This signal is emitted when the scroll bar scrolls one page down - or right. -*/ - -/*! - \fn void TQScrollBar::prevPage() - - This signal is emitted when the scroll bar scrolls one page up or - left. -*/ - - - -static const int thresholdTime = 500; -static const int repeatTime = 50; - -#define HORIZONTAL (orientation() == Horizontal) -#define VERTICAL !HORIZONTAL -#define MOTIF_BORDER 2 -#define SLIDER_MIN 9 - - -/*! - Constructs a vertical scroll bar. - - The \a parent and \a name arguments are sent on to the TQWidget - constructor. - - The \c minValue defaults to 0, the \c maxValue to 99, with a \c - lineStep size of 1 and a \c pageStep size of 10, and an initial - \c value of 0. -*/ - -TQScrollBar::TQScrollBar( TQWidget *parent, const char *name ) - : TQWidget( parent, name ), orient( Vertical ) -{ - init(); -} - -/*! - Constructs a scroll bar. - - The \a orientation must be \c TQt::Vertical or \c TQt::Horizontal. - - The \a parent and \a name arguments are sent on to the TQWidget - constructor. - - The \c minValue defaults to 0, the \c maxValue to 99, with a \c - lineStep size of 1 and a \c pageStep size of 10, and an initial - \c value of 0. -*/ - -TQScrollBar::TQScrollBar( Orientation orientation, TQWidget *parent, - const char *name ) - : TQWidget( parent, name ), orient( orientation ) -{ - init(); -} - -/*! - Constructs a scroll bar whose value can never be smaller than \a - minValue or greater than \a maxValue, whose line step size is \a - lineStep and page step size is \a pageStep and whose value is - initially \a value (which is guaranteed to be in range using - bound()). - - If \a orientation is \c Vertical the scroll bar is vertical and if - it is \c Horizontal the scroll bar is horizontal. - - The \a parent and \a name arguments are sent on to the TQWidget - constructor. -*/ - -TQScrollBar::TQScrollBar( int minValue, int maxValue, int lineStep, int pageStep, - int value, Orientation orientation, - TQWidget *parent, const char *name ) - : TQWidget( parent, name ), - TQRangeControl( minValue, maxValue, lineStep, pageStep, value ), - orient( orientation ) -{ - init(); -} - -/*! - Destructor. -*/ -TQScrollBar::~TQScrollBar() -{ -} - -void TQScrollBar::init() -{ - track = TRUE; - sliderPos = 0; - pressedControl = TQStyle::SC_None; - clickedAt = FALSE; - setFocusPolicy( NoFocus ); - - repeater = 0; - - setBackgroundMode((TQt::BackgroundMode) - style().styleHint(TQStyle::SH_ScrollBar_BackgroundMode)); - - TQSizePolicy sp( TQSizePolicy::Minimum, TQSizePolicy::Fixed ); - if ( orient == Vertical ) - sp.transpose(); - setSizePolicy( sp ); - clearWState( WState_OwnSizePolicy ); -} - - -/*! - \property TQScrollBar::orientation - \brief the orientation of the scroll bar - - The orientation must be \l TQt::Vertical (the default) or \l - TQt::Horizontal. -*/ - -void TQScrollBar::setOrientation( Orientation orientation ) -{ - if ( orientation == orient ) - return; - if ( !testWState( WState_OwnSizePolicy ) ) { - TQSizePolicy sp = sizePolicy(); - sp.transpose(); - setSizePolicy( sp ); - clearWState( WState_OwnSizePolicy ); - } - - orient = orientation; - - positionSliderFromValue(); - update(); - updateGeometry(); -} - -/*! - \property TQScrollBar::tracking - \brief whether scroll bar tracking is enabled - - If tracking is enabled (the default), the scroll bar emits the - valueChanged() signal while the slider is being dragged. If - tracking is disabled, the scroll bar emits the valueChanged() - signal only when the user releases the mouse button after moving - the slider. -*/ - - -/*! - \property TQScrollBar::draggingSlider - \brief whether the user has clicked the mouse on the slider and is currently dragging it -*/ - -bool TQScrollBar::draggingSlider() const -{ - return pressedControl == TQStyle::SC_ScrollBarSlider; -} - - -/*! - Reimplements the virtual function TQWidget::setPalette(). - - Sets the background color to the mid color for Motif style scroll - bars using palette \a p. -*/ - -void TQScrollBar::setPalette( const TQPalette &p ) -{ - TQWidget::setPalette( p ); - setBackgroundMode((TQt::BackgroundMode) - style().styleHint(TQStyle::SH_ScrollBar_BackgroundMode)); -} - - -/*! \reimp */ -TQSize TQScrollBar::sizeHint() const -{ - constPolish(); - int sbextent = style().pixelMetric(TQStyle::PM_ScrollBarExtent, this); - - if ( orient == Horizontal ) { - return TQSize( 30, sbextent ); - } else { - return TQSize( sbextent, 30 ); - } -} - -/*! \fn void TQScrollBar::setSizePolicy( TQSizePolicy::SizeType, TQSizePolicy::SizeType, bool ) - \reimp -*/ - -/*! \reimp */ -void TQScrollBar::setSizePolicy( TQSizePolicy sp ) -{ - //## remove 4.0 - TQWidget::setSizePolicy( sp ); -} - -/*! - \internal - Implements the virtual TQRangeControl function. -*/ - -void TQScrollBar::valueChange() -{ - int tmp = sliderPos; - positionSliderFromValue(); - if ( tmp != sliderPos && isVisible() ) - drawControls(TQStyle::SC_ScrollBarAddPage | - TQStyle::SC_ScrollBarSubPage | - TQStyle::SC_ScrollBarSlider, - pressedControl ); - emit valueChanged(value()); -#if defined(QT_ACCESSIBILITY_SUPPORT) - TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); -#endif -} - -/*! - \internal - Implements the virtual TQRangeControl function. -*/ - -void TQScrollBar::stepChange() -{ - rangeChange(); -} - -/*! - \internal - Implements the virtual TQRangeControl function. -*/ - -void TQScrollBar::rangeChange() -{ - positionSliderFromValue(); - - if ( isVisible() ) - drawControls(TQStyle::SC_ScrollBarAddLine | - TQStyle::SC_ScrollBarSubLine | - TQStyle::SC_ScrollBarAddPage | - TQStyle::SC_ScrollBarSubPage | - TQStyle::SC_ScrollBarFirst | - TQStyle::SC_ScrollBarLast | - TQStyle::SC_ScrollBarSlider, - pressedControl ); -} - - -/*! - Handles timer events for the scroll bar. -*/ - -void TQScrollBar::doAutoRepeat() -{ - bool sendRepeat = clickedAt; -#if !defined( TQT_NO_CURSOR ) && !defined( TQT_NO_STYLE ) - if(sendRepeat && (pressedControl == TQStyle::SC_ScrollBarAddPage || - pressedControl == TQStyle::SC_ScrollBarSubPage) && - style().styleHint(TQStyle::SH_ScrollBar_StopMouseOverSlider, this) && - style().querySubControl(TQStyle::CC_ScrollBar, this, - mapFromGlobal(TQCursor::pos()) ) == TQStyle::SC_ScrollBarSlider) - sendRepeat = FALSE; -#endif - if ( sendRepeat ){ - if ( repeater ) - repeater->changeInterval( repeatTime ); - action( (TQStyle::SubControl) pressedControl ); - TQApplication::syncX(); - } else { - stopAutoRepeat(); - } -} - - -/*! - Starts the auto-repeat logic. Some time after this function is - called, the auto-repeat starts taking effect and from then on - repeats until stopAutoRepeat() is called. -*/ - -void TQScrollBar::startAutoRepeat() -{ - if ( !repeater ) { - repeater = new TQTimer( this, "auto-repeat timer" ); - connect( repeater, TQ_SIGNAL(timeout()), - this, TQ_SLOT(doAutoRepeat()) ); - } - repeater->start( thresholdTime, FALSE ); -} - - -/*! - Stops the auto-repeat logic. -*/ - -void TQScrollBar::stopAutoRepeat() -{ - delete repeater; - repeater = 0; -} - - -/*! - \reimp -*/ -#ifndef TQT_NO_WHEELEVENT -void TQScrollBar::wheelEvent( TQWheelEvent *e ) -{ - static float offset = 0; - static TQScrollBar* offset_owner = 0; - if (offset_owner != this){ - offset_owner = this; - offset = 0; - } - if ( e->orientation() != orient && !rect().contains(e->pos()) ) - return; - e->accept(); - int step = TQMIN( TQApplication::wheelScrollLines()*lineStep(), - pageStep() ); - if ( ( e->state() & ControlButton ) || ( e->state() & ShiftButton ) ) - step = pageStep(); - offset += -e->delta()*step/120; - if (TQABS(offset)<1) - return; - setValue( value() + int(offset) ); - offset -= int(offset); -} -#endif - -/*! - \reimp -*/ -void TQScrollBar::keyPressEvent( TQKeyEvent *e ) -{ - // \list - // \i Left/Right move a horizontal scrollbar by one line. - // \i Up/Down move a vertical scrollbar by one line. - // \i PageUp moves up one page. - // \i PageDown moves down one page. - // \i Home moves to the start (minValue()). - // \i End moves to the end (maxValue()). - // \endlist - - // Note that unless you call setFocusPolicy(), the default NoFocus - // will apply and the user will not be able to use the keyboard to - // interact with the scrollbar. - switch ( e->key() ) { - case Key_Left: - if ( orient == Horizontal ) - subtractLine(); - break; - case Key_Right: - if ( orient == Horizontal ) - addLine(); - break; - case Key_Up: - if ( orient == Vertical ) - subtractLine(); - break; - case Key_Down: - if ( orient == Vertical ) - addLine(); - break; - case Key_PageUp: - subtractPage(); - break; - case Key_PageDown: - addPage(); - break; - case Key_Home: - setValue( minValue() ); - break; - case Key_End: - setValue( maxValue() ); - break; - default: - e->ignore(); - break; - } -} - - -/*! - \reimp -*/ -void TQScrollBar::resizeEvent( TQResizeEvent * ) -{ - positionSliderFromValue(); -} - - -/*! - \reimp -*/ -void TQScrollBar::paintEvent( TQPaintEvent * ) -{ - TQPainter p( this ); - drawControls(TQStyle::SC_ScrollBarAddLine | - TQStyle::SC_ScrollBarSubLine | - TQStyle::SC_ScrollBarAddPage | - TQStyle::SC_ScrollBarSubPage | - TQStyle::SC_ScrollBarFirst | - TQStyle::SC_ScrollBarLast | - TQStyle::SC_ScrollBarSlider, - pressedControl, &p ); -} - -static TQCOORD sliderStartPos = 0; - -/*! - \reimp - */ -void TQScrollBar::contextMenuEvent( TQContextMenuEvent *e ) -{ - if(clickedAt) - e->consume(); - else - e->ignore(); -} - -/*! - \reimp -*/ -void TQScrollBar::mousePressEvent( TQMouseEvent *e ) -{ - bool midButtonAbsPos = - style().styleHint(TQStyle::SH_ScrollBar_MiddleClickAbsolutePosition, - this); - - if ( !(e->button() == LeftButton || - (midButtonAbsPos && e->button() == MidButton) ) ) - return; - - if ( maxValue() == minValue() ) // nothing to be done - return; - - if ( e->state() & MouseButtonMask ) // another button was already pressed - return; - - clickedAt = TRUE; - pressedControl = style().querySubControl(TQStyle::CC_ScrollBar, this, e->pos() ); - - if ( (pressedControl == TQStyle::SC_ScrollBarAddPage || - pressedControl == TQStyle::SC_ScrollBarSubPage || - pressedControl == TQStyle::SC_ScrollBarSlider ) && - ((midButtonAbsPos && e->button() == MidButton) || - (style().styleHint(TQStyle::SH_ScrollBar_LeftClickAbsolutePosition) && e->button() == LeftButton)) ) { - - TQRect sr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, - TQStyle::SC_ScrollBarSlider ), - gr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, - TQStyle::SC_ScrollBarGroove ); - int sliderMin, sliderMax, sliderLength; - sliderMin = sliderMax = sliderLength = 0; - if (HORIZONTAL) { - sliderMin = gr.x(); - sliderMax = sliderMin + gr.width(); - sliderLength = sr.width(); - } else { - sliderMin = gr.y(); - sliderMax = sliderMin + gr.height(); - sliderLength = sr.height(); - } - - int newSliderPos = (HORIZONTAL ? e->pos().x() : e->pos().y()) - - sliderLength/2; - newSliderPos = TQMIN( newSliderPos, sliderMax - sliderLength ); - newSliderPos = TQMAX( newSliderPos, sliderMin ); - setValue( sliderPosToRangeValue(newSliderPos) ); - sliderPos = newSliderPos; - pressedControl = TQStyle::SC_ScrollBarSlider; - } - - if ( pressedControl == TQStyle::SC_ScrollBarSlider ) { - clickOffset = (TQCOORD)( (HORIZONTAL ? e->pos().x() : e->pos().y()) - - sliderPos ); - slidePrevVal = value(); - sliderStartPos = sliderPos; - drawControls( pressedControl, pressedControl ); - emit sliderPressed(); -#if defined(QT_ACCESSIBILITY_SUPPORT) - TQAccessible::updateAccessibility( this, 0, TQAccessible::ScrollingStart ); -#endif - } else if ( pressedControl != TQStyle::SC_None ) { - drawControls( pressedControl, pressedControl ); - action( (TQStyle::SubControl) pressedControl ); - startAutoRepeat(); - } -} - - -/*! - \reimp -*/ -void TQScrollBar::mouseReleaseEvent( TQMouseEvent *e ) -{ - if ( !clickedAt ) - return; - - if ( e->stateAfter() & MouseButtonMask ) // some other button is still pressed - return; - - TQStyle::SubControl tmp = (TQStyle::SubControl) pressedControl; - clickedAt = FALSE; - stopAutoRepeat(); - mouseMoveEvent( e ); // Might have moved since last mouse move event. - pressedControl = TQStyle::SC_None; - - if (tmp == TQStyle::SC_ScrollBarSlider) { - directSetValue( calculateValueFromSlider() ); - emit sliderReleased(); - if ( value() != prevValue() ) { - emit valueChanged( value() ); -#if defined(QT_ACCESSIBILITY_SUPPORT) - TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); -#endif - } -#if defined(QT_ACCESSIBILITY_SUPPORT) - TQAccessible::updateAccessibility( this, 0, TQAccessible::ScrollingEnd ); -#endif - } - drawControls( tmp, pressedControl ); - if ( e->button() == MidButton ) - repaint( FALSE ); -} - - -/*! - \reimp -*/ -void TQScrollBar::mouseMoveEvent( TQMouseEvent *e ) -{ - if ( !isVisible() ) { - clickedAt = FALSE; - return; - } - - bool mcab = style().styleHint(TQStyle::SH_ScrollBar_MiddleClickAbsolutePosition, - this); - if ( ! clickedAt || ! (e->state() & LeftButton || - ((e->state() & MidButton) && mcab))) - return; - - int newSliderPos; - if ( pressedControl == TQStyle::SC_ScrollBarSlider ) { - TQRect gr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, - TQStyle::SC_ScrollBarGroove ), - sr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, - TQStyle::SC_ScrollBarSlider ); - int sliderMin, sliderMax, sliderLength; - - if (HORIZONTAL) { - sliderLength = sr.width(); - sliderMin = gr.x(); - sliderMax = gr.right() - sliderLength + 1; - } else { - sliderLength = sr.height(); - sliderMin = gr.y(); - sliderMax = gr.bottom() - sliderLength + 1; - } - - TQRect r = rect(); - int m = style().pixelMetric(TQStyle::PM_MaximumDragDistance, this); - if ( m >= 0 ) { - if ( orientation() == Horizontal ) - r.setRect( r.x() - m, r.y() - 2*m, r.width() + 2*m, r.height() + 4*m ); - else - r.setRect( r.x() - 2*m, r.y() - m, r.width() + 4*m, r.height() + 2*m ); - if (! r.contains( e->pos())) - newSliderPos = sliderStartPos; - else - newSliderPos = (HORIZONTAL ? e->pos().x() : - e->pos().y()) -clickOffset; - } else - newSliderPos = (HORIZONTAL ? e->pos().x() : - e->pos().y()) -clickOffset; - - if ( newSliderPos < sliderMin ) - newSliderPos = sliderMin; - else if ( newSliderPos > sliderMax ) - newSliderPos = sliderMax; - int newVal = sliderPosToRangeValue(newSliderPos); - if ( newVal != slidePrevVal ) - emit sliderMoved( newVal ); - if ( track && newVal != value() ) { - directSetValue( newVal ); // Set directly, painting done below - emit valueChanged( value() ); -#if defined(QT_ACCESSIBILITY_SUPPORT) - TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); -#endif - } - slidePrevVal = newVal; - sliderPos = (TQCOORD)newSliderPos; - drawControls( TQStyle::SC_ScrollBarAddPage | - TQStyle::SC_ScrollBarSlider | - TQStyle::SC_ScrollBarSubPage, - pressedControl ); - } else if (! style().styleHint(TQStyle::SH_ScrollBar_ScrollWhenPointerLeavesControl)) { - // stop scrolling when the mouse pointer leaves a control - // similar to push buttons - if ( pressedControl != (uint)style().querySubControl(TQStyle::CC_ScrollBar, this, e->pos() ) ) { - drawControls( pressedControl, TQStyle::SC_None ); - stopAutoRepeat(); - } else if ( !repeater ) { - drawControls( pressedControl, pressedControl ); - action( (TQStyle::SubControl) pressedControl ); - startAutoRepeat(); - } - } -} - - -/*! - \fn int TQScrollBar::sliderStart() const - - Returns the pixel position where the scroll bar slider starts. - - This is equivalent to sliderRect().y() for vertical scroll bars or - sliderRect().x() for horizontal scroll bars. -*/ - -/*! - Returns the scroll bar slider rectangle. - - \sa sliderStart() -*/ - -TQRect TQScrollBar::sliderRect() const -{ - return style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, - TQStyle::SC_ScrollBarSlider ); -} - -void TQScrollBar::positionSliderFromValue() -{ - sliderPos = (TQCOORD)rangeValueToSliderPos( value() ); -} - -int TQScrollBar::calculateValueFromSlider() const -{ - return sliderPosToRangeValue( sliderPos ); -} - -int TQScrollBar::rangeValueToSliderPos( int v ) const -{ - TQRect gr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, - TQStyle::SC_ScrollBarGroove ); - TQRect sr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, - TQStyle::SC_ScrollBarSlider ); - int sliderMin, sliderMax, sliderLength; - - if (HORIZONTAL) { - sliderLength = sr.width(); - sliderMin = gr.x(); - sliderMax = gr.right() - sliderLength + 1; - } else { - sliderLength = sr.height(); - sliderMin = gr.y(); - sliderMax = gr.bottom() - sliderLength + 1; - } - - return positionFromValue( v, sliderMax-sliderMin ) + sliderMin; -} - -int TQScrollBar::sliderPosToRangeValue( int pos ) const -{ - TQRect gr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, - TQStyle::SC_ScrollBarGroove ); - TQRect sr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, - TQStyle::SC_ScrollBarSlider ); - int sliderMin, sliderMax, sliderLength; - - if (HORIZONTAL) { - sliderLength = sr.width(); - sliderMin = gr.x(); - sliderMax = gr.right() - sliderLength + 1; - } else { - sliderLength = sr.height(); - sliderMin = gr.y(); - sliderMax = gr.bottom() - sliderLength + 1; - } - - return valueFromPosition( pos - sliderMin, sliderMax - sliderMin ); -} - - -void TQScrollBar::action( int control ) -{ - switch( control ) { - case TQStyle::SC_ScrollBarAddLine: - addLine(); - emit nextLine(); - break; - case TQStyle::SC_ScrollBarSubLine: - subtractLine(); - emit prevLine(); - break; - case TQStyle::SC_ScrollBarAddPage: - addPage(); - emit nextPage(); - break; - case TQStyle::SC_ScrollBarSubPage: - subtractPage(); - emit prevPage(); - break; - case TQStyle::SC_ScrollBarFirst: - setValue( minValue() ); -#if defined(QT_ACCESSIBILITY_SUPPORT) - TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); -#endif - emit valueChanged( minValue() ); - break; - case TQStyle::SC_ScrollBarLast: - setValue( maxValue() ); -#if defined(QT_ACCESSIBILITY_SUPPORT) - TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); -#endif - emit valueChanged( maxValue() ); - break; - default: - break; - } -} - - -void TQScrollBar::drawControls( uint controls, uint activeControl ) const -{ - TQPainter p ( this ); - drawControls( controls, activeControl, &p ); -} - - -void TQScrollBar::drawControls( uint controls, uint activeControl, - TQPainter *p ) const -{ - if ( !isUpdatesEnabled() ) - return; - - TQStyle::SFlags flags = TQStyle::Style_Default; - if (isEnabled()) - flags |= TQStyle::Style_Enabled; - if (hasFocus()) - flags |= TQStyle::Style_HasFocus; - if (hasMouse()) - flags |= TQStyle::Style_MouseOver; - if ( orientation() == Horizontal ) - flags |= TQStyle::Style_Horizontal; - - style().drawComplexControl(TQStyle::CC_ScrollBar, p, this, rect(), colorGroup(), - flags, (TQStyle::SubControl) controls, - (TQStyle::SubControl) activeControl ); -} - -/*! - \reimp -*/ -void TQScrollBar::styleChange( TQStyle& old ) -{ - positionSliderFromValue(); - setBackgroundMode((TQt::BackgroundMode) - style().styleHint(TQStyle::SH_ScrollBar_BackgroundMode)); - TQWidget::styleChange( old ); -} - -/*! - \property TQScrollBar::minValue - \brief the scroll bar's minimum value - - When setting this property, the \l TQScrollBar::maxValue is - adjusted if necessary to ensure that the range remains valid. - - \sa setRange() -*/ -int TQScrollBar::minValue() const -{ - return TQRangeControl::minValue(); -} - -void TQScrollBar::setMinValue( int minVal ) -{ - TQRangeControl::setMinValue( minVal ); -} - -/*! - \property TQScrollBar::maxValue - \brief the scroll bar's maximum value - - When setting this property, the \l TQScrollBar::minValue is - adjusted if necessary to ensure that the range remains valid. - - \sa setRange() -*/ -int TQScrollBar::maxValue() const -{ - return TQRangeControl::maxValue(); -} - -void TQScrollBar::setMaxValue( int maxVal ) -{ - TQRangeControl::setMaxValue( maxVal ); -} - -/*! - \property TQScrollBar::lineStep - \brief the line step - - When setting lineStep, the virtual stepChange() function will be - called if the new line step is different from the previous - setting. - - \sa setSteps() TQRangeControl::pageStep() setRange() -*/ - -int TQScrollBar::lineStep() const -{ - return TQRangeControl::lineStep(); -} - -/*! - \property TQScrollBar::pageStep - \brief the page step - - When setting pageStep, the virtual stepChange() function will be - called if the new page step is different from the previous - setting. - - \sa TQRangeControl::setSteps() setLineStep() setRange() -*/ - -int TQScrollBar::pageStep() const -{ - return TQRangeControl::pageStep(); -} - -void TQScrollBar::setLineStep( int i ) -{ - setSteps( i, pageStep() ); -} - -void TQScrollBar::setPageStep( int i ) -{ - setSteps( lineStep(), i ); -} - -/*! - \property TQScrollBar::value - \brief the scroll bar's value - - \sa TQRangeControl::value() prevValue() -*/ - -int TQScrollBar::value() const -{ - return TQRangeControl::value(); -} - -void TQScrollBar::setValue( int i ) -{ - TQRangeControl::setValue( i ); -} - - -/*! - This function is called when the scrollbar is hidden. -*/ -void TQScrollBar::hideEvent( TQHideEvent* ) -{ - pressedControl = TQStyle::SC_None; - clickedAt = FALSE; -} - - -#undef ADD_LINE_ACTIVE -#undef SUB_LINE_ACTIVE -#endif diff --git a/src/widgets/qscrollview.cpp b/src/widgets/qscrollview.cpp deleted file mode 100644 index 9c3bc060b..000000000 --- a/src/widgets/qscrollview.cpp +++ /dev/null @@ -1,2847 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQScrollView class -** -** Created : 950524 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "tqwidget.h" -#ifndef TQT_NO_SCROLLVIEW -#include "ntqscrollbar.h" -#include "tqobjectlist.h" -#include "tqpainter.h" -#include "tqpixmap.h" -#include "ntqcursor.h" -#include "ntqfocusdata.h" -#include "ntqscrollview.h" -#include "tqptrdict.h" -#include "ntqapplication.h" -#include "tqtimer.h" -#include "tqstyle.h" -#include "ntqlistview.h" -#ifdef TQ_WS_MAC -# include "qt_mac.h" -#endif - -static const int coord_limit = 4000; -static const int autoscroll_margin = 16; -static const int initialScrollTime = 30; -static const int initialScrollAccel = 5; - -struct TQSVChildRec { - TQSVChildRec(TQWidget* c, int xx, int yy) : - child(c), - x(xx), y(yy) - { - } - - void hideOrShow(TQScrollView* sv, TQWidget* clipped_viewport); - void moveTo(TQScrollView* sv, int xx, int yy, TQWidget* clipped_viewport) - { - if ( x != xx || y != yy ) { - x = xx; - y = yy; - hideOrShow(sv,clipped_viewport); - } - } - TQWidget* child; - int x, y; -}; - -void TQSVChildRec::hideOrShow(TQScrollView* sv, TQWidget* clipped_viewport) -{ - if ( clipped_viewport ) { - if ( x+child->width() < sv->contentsX()+clipped_viewport->x() - || x > sv->contentsX()+clipped_viewport->width() - || y+child->height() < sv->contentsY()+clipped_viewport->y() - || y > sv->contentsY()+clipped_viewport->height() ) { - child->move(clipped_viewport->width(), - clipped_viewport->height()); - } else { - child->move(x-sv->contentsX()-clipped_viewport->x(), - y-sv->contentsY()-clipped_viewport->y()); - } - } else { - child->move(x-sv->contentsX(), y-sv->contentsY()); - } -} - -class TQViewportWidget : public TQWidget -{ - TQ_OBJECT - -public: - TQViewportWidget( TQScrollView* parent=0, const char* name=0, WFlags f = 0 ) - : TQWidget( parent, name, f ) {} -}; - -class TQClipperWidget : public TQWidget -{ - TQ_OBJECT - -public: - TQClipperWidget( TQWidget * parent=0, const char * name=0, WFlags f=0 ) - : TQWidget ( parent,name,f) {} -}; - -#include "qscrollview.moc" - -class TQScrollViewData { -public: - TQScrollViewData(TQScrollView* parent, int vpwflags) : - hbar( new TQScrollBar( TQScrollBar::Horizontal, parent, "qt_hbar" ) ), - vbar( new TQScrollBar( TQScrollBar::Vertical, parent, "qt_vbar" ) ), - viewport( new TQViewportWidget( parent, "qt_viewport", vpwflags ) ), - clipped_viewport( 0 ), - flags( vpwflags ), - vx( 0 ), vy( 0 ), vwidth( 1 ), vheight( 1 ), -#ifndef TQT_NO_DRAGANDDROP - autoscroll_timer( parent, "scrollview autoscroll timer" ), - drag_autoscroll( TRUE ), -#endif - scrollbar_timer( parent, "scrollview scrollbar timer" ), - inresize( FALSE ), use_cached_size_hint( TRUE ) - { - l_marg = r_marg = t_marg = b_marg = 0; - viewport->polish(); - viewport->setBackgroundMode( TQWidget::PaletteDark ); - viewport->setBackgroundOrigin( TQWidget::WidgetOrigin ); - vMode = TQScrollView::Auto; - hMode = TQScrollView::Auto; - corner = 0; - defaultCorner = new TQWidget( parent, "qt_default_corner" ); - defaultCorner->hide(); - vbar->setSteps( 20, 1/*set later*/ ); - hbar->setSteps( 20, 1/*set later*/ ); - policy = TQScrollView::Default; - signal_choke = FALSE; - static_bg = FALSE; - fake_scroll = FALSE; - hbarPressed = FALSE; - vbarPressed = FALSE; - } - ~TQScrollViewData(); - - TQSVChildRec* rec(TQWidget* w) { return childDict.find(w); } - TQSVChildRec* ancestorRec(TQWidget* w); - TQSVChildRec* addChildRec(TQWidget* w, int x, int y ) - { - TQSVChildRec *r = new TQSVChildRec(w,x,y); - children.append(r); - childDict.insert(w, r); - return r; - } - void deleteChildRec(TQSVChildRec* r) - { - childDict.remove(r->child); - children.removeRef(r); - delete r; - } - - void hideOrShowAll(TQScrollView* sv, bool isScroll = FALSE ); - void moveAllBy(int dx, int dy); - bool anyVisibleChildren(); - void autoMove(TQScrollView* sv); - void autoResize(TQScrollView* sv); - void autoResizeHint(TQScrollView* sv); - void viewportResized( int w, int h ); - - TQScrollBar* hbar; - TQScrollBar* vbar; - bool hbarPressed; - bool vbarPressed; - TQViewportWidget* viewport; - TQClipperWidget* clipped_viewport; - int flags; - TQPtrList children; - TQPtrDict childDict; - TQWidget* corner, *defaultCorner; - int vx, vy, vwidth, vheight; // for drawContents-style usage - int l_marg, r_marg, t_marg, b_marg; - TQScrollView::ResizePolicy policy; - TQScrollView::ScrollBarMode vMode; - TQScrollView::ScrollBarMode hMode; -#ifndef TQT_NO_DRAGANDDROP - TQPoint cpDragStart; - TQTimer autoscroll_timer; - int autoscroll_time; - int autoscroll_accel; - bool drag_autoscroll; -#endif - TQTimer scrollbar_timer; - - uint static_bg : 1; - uint fake_scroll : 1; - - // This variable allows ensureVisible to move the contents then - // update both the sliders. Otherwise, updating the sliders would - // cause two image scrolls, creating ugly flashing. - // - uint signal_choke : 1; - - // This variables indicates in updateScrollBars() that we are - // in a resizeEvent() and thus don't want to flash scrollbars - uint inresize : 1; - uint use_cached_size_hint : 1; - TQSize cachedSizeHint; - - inline int contentsX() const { return -vx; } - inline int contentsY() const { return -vy; } - inline int contentsWidth() const { return vwidth; } -}; - -inline TQScrollViewData::~TQScrollViewData() -{ - children.setAutoDelete( TRUE ); -} - -TQSVChildRec* TQScrollViewData::ancestorRec(TQWidget* w) -{ - if ( clipped_viewport ) { - while (w->parentWidget() != clipped_viewport) { - w = w->parentWidget(); - if (!w) return 0; - } - } else { - while (w->parentWidget() != viewport) { - w = w->parentWidget(); - if (!w) return 0; - } - } - return rec(w); -} - -void TQScrollViewData::hideOrShowAll(TQScrollView* sv, bool isScroll ) -{ - if ( !clipped_viewport ) - return; - if ( clipped_viewport->x() <= 0 - && clipped_viewport->y() <= 0 - && clipped_viewport->width()+clipped_viewport->x() >= - viewport->width() - && clipped_viewport->height()+clipped_viewport->y() >= - viewport->height() ) { - // clipped_viewport still covers viewport - if( static_bg ) - clipped_viewport->repaint( TRUE ); - else if ( ( !isScroll && !clipped_viewport->testWFlags( TQt::WStaticContents) ) - || static_bg ) - TQApplication::postEvent( clipped_viewport, - new TQPaintEvent( clipped_viewport->clipRegion(), - !clipped_viewport->testWFlags(TQt::WResizeNoErase) ) ); - } else { - // Re-center - int nx = ( viewport->width() - clipped_viewport->width() ) / 2; - int ny = ( viewport->height() - clipped_viewport->height() ) / 2; - clipped_viewport->move(nx,ny); - clipped_viewport->update(); - } - for (TQSVChildRec *r = children.first(); r; r=children.next()) { - r->hideOrShow(sv, clipped_viewport); - } -} - -void TQScrollViewData::moveAllBy(int dx, int dy) -{ - if ( clipped_viewport && !static_bg ) { - clipped_viewport->move( clipped_viewport->x()+dx, - clipped_viewport->y()+dy ); - } else { - for (TQSVChildRec *r = children.first(); r; r=children.next()) { - r->child->move(r->child->x()+dx,r->child->y()+dy); - } - if ( static_bg ) - viewport->repaint( TRUE ); - } -} - -bool TQScrollViewData::anyVisibleChildren() -{ - for (TQSVChildRec *r = children.first(); r; r=children.next()) { - if (r->child->isVisible()) return TRUE; - } - return FALSE; -} - -void TQScrollViewData::autoMove(TQScrollView* sv) -{ - if ( policy == TQScrollView::AutoOne ) { - TQSVChildRec* r = children.first(); - if (r) - sv->setContentsPos(-r->child->x(),-r->child->y()); - } -} - -void TQScrollViewData::autoResize(TQScrollView* sv) -{ - if ( policy == TQScrollView::AutoOne ) { - TQSVChildRec* r = children.first(); - if (r) - sv->resizeContents(r->child->width(),r->child->height()); - } -} - -void TQScrollViewData::autoResizeHint(TQScrollView* sv) -{ - if ( policy == TQScrollView::AutoOne ) { - TQSVChildRec* r = children.first(); - if (r) { - TQSize s = r->child->sizeHint(); - if ( s.isValid() ) - r->child->resize(s); - } - } else if ( policy == TQScrollView::AutoOneFit ) { - TQSVChildRec* r = children.first(); - if (r) { - TQSize sh = r->child->sizeHint(); - sh = sh.boundedTo( r->child->maximumSize() ); - sv->resizeContents( sh.width(), sh.height() ); - } - } -} - -void TQScrollViewData::viewportResized( int w, int h ) -{ - if ( policy == TQScrollView::AutoOneFit ) { - TQSVChildRec* r = children.first(); - if (r) { - TQSize sh = r->child->sizeHint(); - sh = sh.boundedTo( r->child->maximumSize() ); - r->child->resize( TQMAX(w,sh.width()), TQMAX(h,sh.height()) ); - } - - } -} - - -/*! - \class TQScrollView ntqscrollview.h - \brief The TQScrollView widget provides a scrolling area with on-demand scroll bars. - - \ingroup abstractwidgets - \mainclass - - The TQScrollView is a large canvas - potentially larger than the - coordinate system normally supported by the underlying window - system. This is important because it is quite easy to go beyond - these limitations (e.g. many web pages are more than 32000 pixels - high). Additionally, the TQScrollView can have TQWidgets positioned - on it that scroll around with the drawn content. These sub-widgets - can also have positions outside the normal coordinate range (but - they are still limited in size). - - To provide content for the widget, inherit from TQScrollView, - reimplement drawContents() and use resizeContents() to set the - size of the viewed area. Use addChild() and moveChild() to - position widgets on the view. - - To use TQScrollView effectively it is important to understand its - widget structure in the three styles of use: a single large child - widget, a large panning area with some widgets and a large panning - area with many widgets. - - \section1 Using One Big Widget - - \img qscrollview-vp2.png - - The first, simplest usage of TQScrollView (depicted above), is - appropriate for scrolling areas that are never more than about - 4000 pixels in either dimension (this is about the maximum - reliable size on X11 servers). In this usage, you just make one - large child in the TQScrollView. The child should be a child of the - viewport() of the scrollview and be added with addChild(): - \code - TQScrollView* sv = new TQScrollView(...); - TQVBox* big_box = new TQVBox(sv->viewport()); - sv->addChild(big_box); - \endcode - You can go on to add arbitrary child widgets to the single child - in the scrollview as you would with any widget: - \code - TQLabel* child1 = new TQLabel("CHILD", big_box); - TQLabel* child2 = new TQLabel("CHILD", big_box); - TQLabel* child3 = new TQLabel("CHILD", big_box); - ... - \endcode - - Here the TQScrollView has four children: the viewport(), the - verticalScrollBar(), the horizontalScrollBar() and a small - cornerWidget(). The viewport() has one child: the big TQVBox. The - TQVBox has the three TQLabel objects as child widgets. When the view - is scrolled, the TQVBox is moved; its children move with it as - child widgets normally do. - - \section1 Using a Very Big View with Some Widgets - - \img qscrollview-vp.png - - The second usage of TQScrollView (depicted above) is appropriate - when few, if any, widgets are on a very large scrolling area that - is potentially larger than 4000 pixels in either dimension. In - this usage you call resizeContents() to set the size of the area - and reimplement drawContents() to paint the contents. You may also - add some widgets by making them children of the viewport() and - adding them with addChild() (this is the same as the process for - the single large widget in the previous example): - \code - TQScrollView* sv = new TQScrollView(...); - TQLabel* child1 = new TQLabel("CHILD", sv->viewport()); - sv->addChild(child1); - TQLabel* child2 = new TQLabel("CHILD", sv->viewport()); - sv->addChild(child2); - TQLabel* child3 = new TQLabel("CHILD", sv->viewport()); - sv->addChild(child3); - \endcode - Here, the TQScrollView has the same four children: the viewport(), - the verticalScrollBar(), the horizontalScrollBar() and a small - cornerWidget(). The viewport() has the three TQLabel objects as - child widgets. When the view is scrolled, the scrollview moves the - child widgets individually. - - \section1 Using a Very Big View with Many Widgets - - \target enableclipper - \img qscrollview-cl.png - - The final usage of TQScrollView (depicted above) is appropriate - when many widgets are on a very large scrolling area that is - potentially larger than 4000 pixels in either dimension. In this - usage you call resizeContents() to set the size of the area and - reimplement drawContents() to paint the contents. You then call - enableClipper(TRUE) and add widgets, again by making them children - of the viewport(), and adding them with addChild(): - \code - TQScrollView* sv = new TQScrollView(...); - sv->enableClipper(TRUE); - TQLabel* child1 = new TQLabel("CHILD", sv->viewport()); - sv->addChild(child1); - TQLabel* child2 = new TQLabel("CHILD", sv->viewport()); - sv->addChild(child2); - TQLabel* child3 = new TQLabel("CHILD", sv->viewport()); - sv->addChild(child3); - \endcode - - Here, the TQScrollView has four children: the clipper() (not the - viewport() this time), the verticalScrollBar(), the - horizontalScrollBar() and a small cornerWidget(). The clipper() - has one child: the viewport(). The viewport() has the same three - labels as child widgets. When the view is scrolled the viewport() - is moved; its children move with it as child widgets normally do. - - \target allviews - \section1 Details Relevant for All Views - - Normally you will use the first or third method if you want any - child widgets in the view. - - Note that the widget you see in the scrolled area is the - viewport() widget, not the TQScrollView itself. So to turn mouse - tracking on, for example, use viewport()->setMouseTracking(TRUE). - - To enable drag-and-drop, you would setAcceptDrops(TRUE) on the - TQScrollView (because drag-and-drop events propagate to the - parent). But to work out the logical position in the view, you - would need to map the drop co-ordinate from being relative to the - TQScrollView to being relative to the contents; use the function - viewportToContents() for this. - - To handle mouse events on the scrolling area, subclass scrollview - as you would subclass other widgets, but rather than - reimplementing mousePressEvent(), reimplement - contentsMousePressEvent() instead. The contents specific event - handlers provide translated events in the coordinate system of the - scrollview. If you reimplement mousePressEvent(), you'll get - called only when part of the TQScrollView is clicked: and the only - such part is the "corner" (if you don't set a cornerWidget()) and - the frame; everything else is covered up by the viewport, clipper - or scroll bars. - - When you construct a TQScrollView, some of the widget flags apply - to the viewport() instead of being sent to the TQWidget constructor - for the TQScrollView. This applies to \c WNoAutoErase, \c - WStaticContents, and \c WPaintClever. See \l TQt::WidgetFlags for - documentation about these flags. Here are some examples: - - \list - - \i An image-manipulation widget would use \c - WNoAutoErase|WStaticContents because the widget draws all pixels - itself, and when its size increases, it only needs a paint event - for the new part because the old part remains unchanged. - - \i A scrolling game widget in which the background scrolls as the - characters move might use \c WNoAutoErase (in addition to \c - WStaticContents) so that the window system background does not - flash in and out during scrolling. - - \i A word processing widget might use \c WNoAutoErase and repaint - itself line by line to get a less-flickery resizing. If the widget - is in a mode in which no text justification can take place, it - might use \c WStaticContents too, so that it would only get a - repaint for the newly visible parts. - - \endlist - - Child widgets may be moved using addChild() or moveChild(). Use - childX() and childY() to get the position of a child widget. - - A widget may be placed in the corner between the vertical and - horizontal scrollbars with setCornerWidget(). You can get access - to the scrollbars using horizontalScrollBar() and - verticalScrollBar(), and to the viewport with viewport(). The - scroll view can be scrolled using scrollBy(), ensureVisible(), - setContentsPos() or center(). - - The visible area is given by visibleWidth() and visibleHeight(), - and the contents area by contentsWidth() and contentsHeight(). The - contents may be repainted using one of the repaintContents() or - updateContents() functions. - - Coordinate conversion is provided by contentsToViewport() and - viewportToContents(). - - The contentsMoving() signal is emitted just before the contents - are moved to a new position. - - \warning TQScrollView currently does not erase the background when - resized, i.e. you must always clear the background manually in - scrollview subclasses. This will change in a future version of TQt - and we recommend specifying the WNoAutoErase flag explicitly. - - -*/ - - -/*! - \enum TQScrollView::ResizePolicy - - This enum type is used to control a TQScrollView's reaction to - resize events. - - \value Default the TQScrollView selects one of the other settings - automatically when it has to. In this version of TQt, TQScrollView - changes to \c Manual if you resize the contents with - resizeContents() and to \c AutoOne if a child is added. - - \value Manual the contents stays the size set by resizeContents(). - - \value AutoOne if there is only one child widget the contents stays - the size of that widget. Otherwise the behavior is undefined. - - \value AutoOneFit if there is only one child widget the contents stays - the size of that widget's sizeHint(). If the scrollview is resized - larger than the child's sizeHint(), the child will be resized to - fit. If there is more than one child, the behavior is undefined. - -*/ -//#### The widget will be resized to its sizeHint() when a LayoutHint event -//#### is received - -/*! - Constructs a TQScrollView called \a name with parent \a parent and - widget flags \a f. - - The widget flags \c WStaticContents, \c WNoAutoErase and \c - WPaintClever are propagated to the viewport() widget. The other - widget flags are propagated to the parent constructor as usual. -*/ - -TQScrollView::TQScrollView( TQWidget *parent, const char *name, WFlags f ) : - TQFrame( parent, name, f & (~WStaticContents) & (~WResizeNoErase) ) -{ - WFlags flags = WResizeNoErase | (f&WPaintClever) | (f&WRepaintNoErase) | (f&WStaticContents); - d = new TQScrollViewData( this, flags ); - -#ifndef TQT_NO_DRAGANDDROP - connect( &d->autoscroll_timer, TQ_SIGNAL( timeout() ), - this, TQ_SLOT( doDragAutoScroll() ) ); -#endif - - connect( d->hbar, TQ_SIGNAL( valueChanged(int) ), - this, TQ_SLOT( hslide(int) ) ); - connect( d->vbar, TQ_SIGNAL( valueChanged(int) ), - this, TQ_SLOT( vslide(int) ) ); - - connect( d->hbar, TQ_SIGNAL(sliderPressed()), this, TQ_SLOT(hbarIsPressed()) ); - connect( d->hbar, TQ_SIGNAL(sliderReleased()), this, TQ_SLOT(hbarIsReleased()) ); - connect( d->vbar, TQ_SIGNAL(sliderPressed()), this, TQ_SLOT(vbarIsPressed()) ); - connect( d->vbar, TQ_SIGNAL(sliderReleased()), this, TQ_SLOT(vbarIsReleased()) ); - - - d->viewport->installEventFilter( this ); - - connect( &d->scrollbar_timer, TQ_SIGNAL( timeout() ), - this, TQ_SLOT( updateScrollBars() ) ); - - setFrameStyle( TQFrame::StyledPanel | TQFrame::Sunken ); - setLineWidth( style().pixelMetric(TQStyle::PM_DefaultFrameWidth, this) ); - setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding ) ); -} - - -/*! - Destroys the TQScrollView. Any children added with addChild() will - be deleted. -*/ -TQScrollView::~TQScrollView() -{ - // Be careful not to get all those useless events... - if ( d->clipped_viewport ) - d->clipped_viewport->removeEventFilter( this ); - else - d->viewport->removeEventFilter( this ); - - // order is important - // ~TQWidget may cause a WM_ERASEBKGND on Windows - delete d->vbar; - d->vbar = 0; - delete d->hbar; - d->hbar = 0; - delete d->viewport; - d->viewport = 0; - delete d; - d = 0; -} - -/*! - \fn void TQScrollView::horizontalSliderPressed() - - This signal is emitted whenever the user presses the horizontal slider. -*/ -/*! - \fn void TQScrollView::horizontalSliderReleased() - - This signal is emitted whenever the user releases the horizontal slider. -*/ -/*! - \fn void TQScrollView::verticalSliderPressed() - - This signal is emitted whenever the user presses the vertical slider. -*/ -/*! - \fn void TQScrollView::verticalSliderReleased() - - This signal is emitted whenever the user releases the vertical slider. -*/ -void TQScrollView::hbarIsPressed() -{ - d->hbarPressed = TRUE; - emit( horizontalSliderPressed() ); -} - -void TQScrollView::hbarIsReleased() -{ - d->hbarPressed = FALSE; - emit( horizontalSliderReleased() ); -} - -/*! - Returns TRUE if horizontal slider is pressed by user; otherwise returns FALSE. -*/ -bool TQScrollView::isHorizontalSliderPressed() -{ - return d->hbarPressed; -} - -void TQScrollView::vbarIsPressed() -{ - d->vbarPressed = TRUE; - emit( verticalSliderPressed() ); -} - -void TQScrollView::vbarIsReleased() -{ - d->vbarPressed = FALSE; - emit( verticalSliderReleased() ); -} - -/*! - Returns TRUE if vertical slider is pressed by user; otherwise returns FALSE. -*/ -bool TQScrollView::isVerticalSliderPressed() -{ - return d->vbarPressed; -} - -/*! - \reimp -*/ -void TQScrollView::styleChange( TQStyle& old ) -{ - TQWidget::styleChange( old ); - updateScrollBars(); - d->cachedSizeHint = TQSize(); -} - -/*! - \reimp -*/ -void TQScrollView::fontChange( const TQFont &old ) -{ - TQWidget::fontChange( old ); - updateScrollBars(); - d->cachedSizeHint = TQSize(); -} - -void TQScrollView::hslide( int pos ) -{ - if ( !d->signal_choke ) { - moveContents( -pos, -d->contentsY() ); - TQApplication::syncX(); - } -} - -void TQScrollView::vslide( int pos ) -{ - if ( !d->signal_choke ) { - moveContents( -d->contentsX(), -pos ); - TQApplication::syncX(); - } -} - -/*! - Called when the horizontal scroll bar geometry changes. This is - provided as a protected function so that subclasses can do - interesting things such as providing extra buttons in some of the - space normally used by the scroll bars. - - The default implementation simply gives all the space to \a hbar. - The new geometry is given by \a x, \a y, \a w and \a h. - - \sa setVBarGeometry() -*/ -void TQScrollView::setHBarGeometry(TQScrollBar& hbar, - int x, int y, int w, int h) -{ - hbar.setGeometry( x, y, w, h ); -} - -/*! - Called when the vertical scroll bar geometry changes. This is - provided as a protected function so that subclasses can do - interesting things such as providing extra buttons in some of the - space normally used by the scroll bars. - - The default implementation simply gives all the space to \a vbar. - The new geometry is given by \a x, \a y, \a w and \a h. - - \sa setHBarGeometry() -*/ -void TQScrollView::setVBarGeometry( TQScrollBar& vbar, - int x, int y, int w, int h) -{ - vbar.setGeometry( x, y, w, h ); -} - - -/*! - Returns the viewport size for size (\a x, \a y). - - The viewport size depends on \a (x, y) (the size of the contents), - the size of this widget and the modes of the horizontal and - vertical scroll bars. - - This function permits widgets that can trade vertical and - horizontal space for each other to control scroll bar appearance - better. For example, a word processor or web browser can control - the width of the right margin accurately, whether or not there - needs to be a vertical scroll bar. -*/ - -TQSize TQScrollView::viewportSize( int x, int y ) const -{ - int fw = frameWidth(); - int lmarg = fw+d->l_marg; - int rmarg = fw+d->r_marg; - int tmarg = fw+d->t_marg; - int bmarg = fw+d->b_marg; - - int w = width(); - int h = height(); - - bool needh, needv; - bool showh, showv; - int hsbExt = horizontalScrollBar()->sizeHint().height(); - int vsbExt = verticalScrollBar()->sizeHint().width(); - - if ( d->policy != AutoOne || d->anyVisibleChildren() ) { - // Do we definitely need the scrollbar? - needh = w-lmarg-rmarg < x; - needv = h-tmarg-bmarg < y; - - // Do we intend to show the scrollbar? - if (d->hMode == AlwaysOn) - showh = TRUE; - else if (d->hMode == AlwaysOff) - showh = FALSE; - else - showh = needh; - - if (d->vMode == AlwaysOn) - showv = TRUE; - else if (d->vMode == AlwaysOff) - showv = FALSE; - else - showv = needv; - - // Given other scrollbar will be shown, NOW do we need one? - if ( showh && h-vsbExt-tmarg-bmarg < y ) { - if (d->vMode == Auto) - showv=TRUE; - } - if ( showv && w-hsbExt-lmarg-rmarg < x ) { - if (d->hMode == Auto) - showh=TRUE; - } - } else { - // Scrollbars not needed, only show scrollbar that are always on. - showh = d->hMode == AlwaysOn; - showv = d->vMode == AlwaysOn; - } - - return TQSize( w-lmarg-rmarg - (showv ? vsbExt : 0), - h-tmarg-bmarg - (showh ? hsbExt : 0) ); -} - - -/*! - Updates scroll bars: all possibilities are considered. You should - never need to call this in your code. -*/ -void TQScrollView::updateScrollBars() -{ - if(!horizontalScrollBar() && !verticalScrollBar()) - return; - - // I support this should use viewportSize()... but it needs - // so many of the temporary variables from viewportSize. hm. - int fw = frameWidth(); - int lmarg = fw+d->l_marg; - int rmarg = fw+d->r_marg; - int tmarg = fw+d->t_marg; - int bmarg = fw+d->b_marg; - - int w = width(); - int h = height(); - - int portw, porth; - - bool needh; - bool needv; - bool showh; - bool showv; - bool showc = FALSE; - - int hsbExt = horizontalScrollBar()->sizeHint().height(); - int vsbExt = verticalScrollBar()->sizeHint().width(); - - TQSize oldVisibleSize( visibleWidth(), visibleHeight() ); - - if ( d->policy != AutoOne || d->anyVisibleChildren() ) { - // Do we definitely need the scrollbar? - needh = w-lmarg-rmarg < d->contentsWidth(); - if ( d->inresize ) - needh = !horizontalScrollBar()->isHidden(); - needv = h-tmarg-bmarg < contentsHeight(); - - // Do we intend to show the scrollbar? - if (d->hMode == AlwaysOn) - showh = TRUE; - else if (d->hMode == AlwaysOff) - showh = FALSE; - else - showh = needh; - - if (d->vMode == AlwaysOn) - showv = TRUE; - else if (d->vMode == AlwaysOff) - showv = FALSE; - else - showv = needv; - -#ifdef TQ_WS_MAC - bool mac_need_scroll = FALSE; - if(!parentWidget()) { - mac_need_scroll = TRUE; - } else { - TQWidget *tlw = topLevelWidget(); - TQPoint tlw_br = TQPoint(tlw->width(), tlw->height()), - my_br = posInWindow(this) + TQPoint(w, h); - if(my_br.x() >= tlw_br.x() - 3 && my_br.y() >= tlw_br.y() - 3) - mac_need_scroll = TRUE; - } - if(mac_need_scroll) { - WindowAttributes attr; - GetWindowAttributes((WindowPtr)handle(), &attr); - mac_need_scroll = (attr & kWindowResizableAttribute); - } - if(mac_need_scroll) { - showc = TRUE; - if(d->vMode == Auto) - showv = TRUE; - if(d->hMode == Auto) - showh = TRUE; - } -#endif - - // Given other scrollbar will be shown, NOW do we need one? - if ( showh && h-vsbExt-tmarg-bmarg < contentsHeight() ) { - needv=TRUE; - if (d->vMode == Auto) - showv=TRUE; - } - if ( showv && !d->inresize && w-hsbExt-lmarg-rmarg < d->contentsWidth() ) { - needh=TRUE; - if (d->hMode == Auto) - showh=TRUE; - } - } else { - // Scrollbars not needed, only show scrollbar that are always on. - needh = needv = FALSE; - showh = d->hMode == AlwaysOn; - showv = d->vMode == AlwaysOn; - } - - bool sc = d->signal_choke; - d->signal_choke=TRUE; - - // Hide unneeded scrollbar, calculate viewport size - if ( showh ) { - porth=h-hsbExt-tmarg-bmarg; - } else { - if (!needh) - d->hbar->setValue(0); - d->hbar->hide(); - porth=h-tmarg-bmarg; - } - if ( showv ) { - portw=w-vsbExt-lmarg-rmarg; - } else { - if (!needv) - d->vbar->setValue(0); - d->vbar->hide(); - portw=w-lmarg-rmarg; - } - - // Configure scrollbars that we will show - if ( needv ) { - d->vbar->setRange( 0, contentsHeight()-porth ); - d->vbar->setSteps( TQScrollView::d->vbar->lineStep(), porth ); - } else { - d->vbar->setRange( 0, 0 ); - } - if ( needh ) { - d->hbar->setRange( 0, TQMAX(0, d->contentsWidth()-portw) ); - d->hbar->setSteps( TQScrollView::d->hbar->lineStep(), portw ); - } else { - d->hbar->setRange( 0, 0 ); - } - - // Position the scrollbars, viewport and corner widget. - int bottom; - bool reverse = TQApplication::reverseLayout(); - int xoffset = ( reverse && (showv || cornerWidget() )) ? vsbExt : 0; - int xpos = reverse ? 0 : w - vsbExt; - bool frameContentsOnly = - style().styleHint(TQStyle::SH_ScrollView_FrameOnlyAroundContents); - - if( ! frameContentsOnly ) { - if ( reverse ) - xpos += fw; - else - xpos -= fw; - } - if ( showh ) { - int right = ( showc || showv || cornerWidget() ) ? w-vsbExt : w; - if ( ! frameContentsOnly ) - setHBarGeometry( *d->hbar, fw + xoffset, h-hsbExt-fw, - right-fw-fw, hsbExt ); - else - setHBarGeometry( *d->hbar, 0 + xoffset, h-hsbExt, right, - hsbExt ); - bottom=h-hsbExt; - } else { - bottom=h; - } - if ( showv ) { - clipper()->setGeometry( lmarg + xoffset, tmarg, - w-vsbExt-lmarg-rmarg, - bottom-tmarg-bmarg ); - d->viewportResized( w-vsbExt-lmarg-rmarg, bottom-tmarg-bmarg ); - if ( ! frameContentsOnly ) - changeFrameRect(TQRect(0, 0, w, h) ); - else - changeFrameRect(TQRect(xoffset, 0, w-vsbExt, bottom)); - if (showc || cornerWidget()) { - if ( ! frameContentsOnly ) - setVBarGeometry( *d->vbar, xpos, - fw, vsbExt, - h-hsbExt-fw-fw ); - else - setVBarGeometry( *d->vbar, xpos, 0, - vsbExt, - h-hsbExt ); - } - else { - if ( ! frameContentsOnly ) - setVBarGeometry( *d->vbar, xpos, - fw, vsbExt, - bottom-fw-fw ); - else - setVBarGeometry( *d->vbar, xpos, 0, - vsbExt, bottom ); - } - } else { - if ( ! frameContentsOnly ) - changeFrameRect(TQRect(0, 0, w, h)); - else - changeFrameRect(TQRect(0, 0, w, bottom)); - clipper()->setGeometry( lmarg, tmarg, - w-lmarg-rmarg, bottom-tmarg-bmarg ); - d->viewportResized( w-lmarg-rmarg, bottom-tmarg-bmarg ); - } - - TQWidget *corner = d->corner; - if ( !d->corner ) - corner = d->defaultCorner; - if ( ! frameContentsOnly ) - corner->setGeometry( xpos, - h-hsbExt-fw, - vsbExt, - hsbExt ); - else - corner->setGeometry( xpos, - h-hsbExt, - vsbExt, - hsbExt ); - - d->signal_choke=sc; - - if ( d->contentsX()+visibleWidth() > d->contentsWidth() ) { - int x; -#if 0 - if ( reverse ) - x =TQMIN(0,d->contentsWidth()-visibleWidth()); - else -#endif - x =TQMAX(0,d->contentsWidth()-visibleWidth()); - d->hbar->setValue(x); - // Do it even if it is recursive - moveContents( -x, -d->contentsY() ); - } - if ( d->contentsY()+visibleHeight() > contentsHeight() ) { - int y=TQMAX(0,contentsHeight()-visibleHeight()); - d->vbar->setValue(y); - // Do it even if it is recursive - moveContents( -d->contentsX(), -y ); - } - - // Finally, show the scroll bars - if ( showh && ( d->hbar->isHidden() || !d->hbar->isVisible() ) ) - d->hbar->show(); - if ( showv && ( d->vbar->isHidden() || !d->vbar->isVisible() ) ) - d->vbar->show(); - - d->signal_choke=TRUE; - d->vbar->setValue( d->contentsY() ); - d->hbar->setValue( d->contentsX() ); - d->signal_choke=FALSE; - - TQSize newVisibleSize( visibleWidth(), visibleHeight() ); - if ( d->clipped_viewport && oldVisibleSize != newVisibleSize ) { - TQResizeEvent e( newVisibleSize, oldVisibleSize ); - viewportResizeEvent( &e ); - } -} - - -/*! - \reimp -*/ -void TQScrollView::show() -{ - if ( isVisible() ) - return; - TQWidget::show(); - updateScrollBars(); - d->hideOrShowAll(this); -} - -/*! - \reimp - */ -void TQScrollView::resize( int w, int h ) -{ - TQWidget::resize( w, h ); -} - -/*! - \reimp -*/ -void TQScrollView::resize( const TQSize& s ) -{ - resize( s.width(), s.height() ); -} - -/*! - \reimp -*/ -void TQScrollView::resizeEvent( TQResizeEvent* event ) -{ - TQFrame::resizeEvent( event ); - -#if 0 - if ( TQApplication::reverseLayout() ) { - d->fake_scroll = TRUE; - scrollBy( -event->size().width() + event->oldSize().width(), 0 ); - d->fake_scroll = FALSE; - } -#endif - - bool inresize = d->inresize; - d->inresize = TRUE; - updateScrollBars(); - d->inresize = inresize; - d->scrollbar_timer.start( 0, TRUE ); - - d->hideOrShowAll(this); -} - - - -/*! - \reimp -*/ -void TQScrollView::mousePressEvent( TQMouseEvent * e) //#### remove for 4.0 -{ - e->ignore(); -} - -/*! - \reimp -*/ -void TQScrollView::mouseReleaseEvent( TQMouseEvent *e ) //#### remove for 4.0 -{ - e->ignore(); -} - - -/*! - \reimp -*/ -void TQScrollView::mouseDoubleClickEvent( TQMouseEvent *e ) //#### remove for 4.0 -{ - e->ignore(); -} - -/*! - \reimp -*/ -void TQScrollView::mouseMoveEvent( TQMouseEvent *e ) //#### remove for 4.0 -{ - e->ignore(); -} - -/*! - \reimp -*/ -#ifndef TQT_NO_WHEELEVENT -void TQScrollView::wheelEvent( TQWheelEvent *e ) -{ - TQWheelEvent ce( viewport()->mapFromGlobal( e->globalPos() ), - e->globalPos(), e->delta(), e->state(), e->orientation()); - viewportWheelEvent(&ce); - if ( !ce.isAccepted() ) { - if ( e->orientation() == Horizontal && horizontalScrollBar() && horizontalScrollBar()->isEnabled() ) - TQApplication::sendEvent( horizontalScrollBar(), e); - else if (e->orientation() == Vertical && verticalScrollBar() && verticalScrollBar()->isEnabled() ) - TQApplication::sendEvent( verticalScrollBar(), e); - } else { - e->accept(); - } -} -#endif - -/*! - \reimp -*/ -void TQScrollView::contextMenuEvent( TQContextMenuEvent *e ) -{ - if ( e->reason() != TQContextMenuEvent::Keyboard ) { - e->ignore(); - return; - } - - TQContextMenuEvent ce( e->reason(), viewport()->mapFromGlobal( e->globalPos() ), - e->globalPos(), e->state() ); - viewportContextMenuEvent( &ce ); - if ( ce.isAccepted() ) - e->accept(); - else - e->ignore(); -} - -TQScrollView::ScrollBarMode TQScrollView::vScrollBarMode() const -{ - return d->vMode; -} - - -/*! - \enum TQScrollView::ScrollBarMode - - This enum type describes the various modes of TQScrollView's scroll - bars. - - \value Auto TQScrollView shows a scroll bar when the content is - too large to fit and not otherwise. This is the default. - - \value AlwaysOff TQScrollView never shows a scroll bar. - - \value AlwaysOn TQScrollView always shows a scroll bar. - - (The modes for the horizontal and vertical scroll bars are - independent.) -*/ - - -/*! - \property TQScrollView::vScrollBarMode - \brief the mode for the vertical scroll bar - - The default mode is \c TQScrollView::Auto. - - \sa hScrollBarMode -*/ -void TQScrollView::setVScrollBarMode( ScrollBarMode mode ) -{ - if (d->vMode != mode) { - d->vMode = mode; - updateScrollBars(); - } -} - - -/*! - \property TQScrollView::hScrollBarMode - \brief the mode for the horizontal scroll bar - - The default mode is \c TQScrollView::Auto. - - \sa vScrollBarMode -*/ -TQScrollView::ScrollBarMode TQScrollView::hScrollBarMode() const -{ - return d->hMode; -} - -void TQScrollView::setHScrollBarMode( ScrollBarMode mode ) -{ - if (d->hMode != mode) { - d->hMode = mode; - updateScrollBars(); - } -} - - -/*! - Returns the widget in the corner between the two scroll bars. - - By default, no corner widget is present. -*/ -TQWidget* TQScrollView::cornerWidget() const -{ - return d->corner; -} - -/*! - Sets the widget in the \a corner between the two scroll bars. - - You will probably also want to set at least one of the scroll bar - modes to \c AlwaysOn. - - Passing 0 shows no widget in the corner. - - Any previous \a corner widget is hidden. - - You may call setCornerWidget() with the same widget at different - times. - - All widgets set here will be deleted by the TQScrollView when it is - destroyed unless you separately reparent the widget after setting - some other corner widget (or 0). - - Any \e newly set widget should have no current parent. - - By default, no corner widget is present. - - \sa setVScrollBarMode(), setHScrollBarMode() -*/ -void TQScrollView::setCornerWidget(TQWidget* corner) -{ - TQWidget* oldcorner = d->corner; - if (oldcorner != corner) { - if (oldcorner) oldcorner->hide(); - d->corner = corner; - - if ( corner && corner->parentWidget() != this ) { - // #### No clean way to get current WFlags - corner->reparent( this, (((TQScrollView*)corner))->getWFlags(), - TQPoint(0,0), FALSE ); - } - - updateScrollBars(); - if ( corner ) corner->show(); - } -} - - -void TQScrollView::setResizePolicy( ResizePolicy r ) -{ - d->policy = r; -} - -/*! - \property TQScrollView::resizePolicy - \brief the resize policy - - The default is \c Default. - - \sa ResizePolicy -*/ -TQScrollView::ResizePolicy TQScrollView::resizePolicy() const -{ - return d->policy; -} - -/*! - \reimp -*/ -void TQScrollView::setEnabled( bool enable ) -{ - TQFrame::setEnabled( enable ); -} - -/*! - Removes the \a child widget from the scrolled area. Note that this - happens automatically if the \a child is deleted. -*/ -void TQScrollView::removeChild(TQWidget* child) -{ - if ( !d || !child ) // First check in case we are destructing - return; - - TQSVChildRec *r = d->rec(child); - if ( r ) d->deleteChildRec( r ); -} - -/*! - \reimp -*/ -void TQScrollView::removeChild(TQObject* child) -{ - TQFrame::removeChild(child); -} - -/*! - Inserts the widget, \a child, into the scrolled area positioned at - (\a x, \a y). The position defaults to (0, 0). If the child is - already in the view, it is just moved. - - You may want to call enableClipper(TRUE) if you add a large number - of widgets. -*/ -void TQScrollView::addChild(TQWidget* child, int x, int y) -{ - if ( !child ) { -#if defined(QT_CHECK_NULL) - tqWarning( "TQScrollView::addChild(): Cannot add null child" ); -#endif - return; - } - child->polish(); - child->setBackgroundOrigin(WidgetOrigin); - - if ( child->parentWidget() == viewport() ) { - // May already be there - TQSVChildRec *r = d->rec(child); - if (r) { - r->moveTo(this,x,y,d->clipped_viewport); - if ( d->policy > Manual ) { - d->autoResizeHint(this); - d->autoResize(this); // #### better to just deal with this one widget! - } - return; - } - } - - if ( d->children.isEmpty() && d->policy != Manual ) { - if ( d->policy == Default ) - setResizePolicy( AutoOne ); - child->installEventFilter( this ); - } else if ( d->policy == AutoOne ) { - child->removeEventFilter( this ); //#### ????? - setResizePolicy( Manual ); - } - if ( child->parentWidget() != viewport() ) { - child->reparent( viewport(), 0, TQPoint(0,0), FALSE ); - } - d->addChildRec(child,x,y)->hideOrShow(this, d->clipped_viewport); - - if ( d->policy > Manual ) { - d->autoResizeHint(this); - d->autoResize(this); // #### better to just deal with this one widget! - } -} - -/*! - Repositions the \a child widget to (\a x, \a y). This function is - the same as addChild(). -*/ -void TQScrollView::moveChild(TQWidget* child, int x, int y) -{ - addChild(child,x,y); -} - -/*! - Returns the X position of the given \a child widget. Use this - rather than TQWidget::x() for widgets added to the view. - - This function returns 0 if \a child has not been added to the view. -*/ -int TQScrollView::childX(TQWidget* child) -{ - TQSVChildRec *r = d->rec(child); - return r ? r->x : 0; -} - -/*! - Returns the Y position of the given \a child widget. Use this - rather than TQWidget::y() for widgets added to the view. - - This function returns 0 if \a child has not been added to the view. -*/ -int TQScrollView::childY(TQWidget* child) -{ - TQSVChildRec *r = d->rec(child); - return r ? r->y : 0; -} - -/*! \fn bool TQScrollView::childIsVisible(TQWidget*) - \obsolete - - Returns TRUE if \a child is visible. This is equivalent - to child->isVisible(). -*/ - -/*! \fn void TQScrollView::showChild(TQWidget* child, bool y) - \obsolete - - Sets the visibility of \a child. Equivalent to - TQWidget::show() or TQWidget::hide(). -*/ - -/*! - This event filter ensures the scroll bars are updated when a - single contents widget is resized, shown, hidden or destroyed; it - passes mouse events to the TQScrollView. The event is in \a e and - the object is in \a obj. -*/ - -bool TQScrollView::eventFilter( TQObject *obj, TQEvent *e ) -{ - if ( !d ) - return FALSE; // we are destructing - if ( obj == d->viewport || obj == d->clipped_viewport ) { - switch ( e->type() ) { - /* Forward many events to viewport...() functions */ - case TQEvent::Paint: - viewportPaintEvent( (TQPaintEvent*)e ); - break; - case TQEvent::Resize: - if ( !d->clipped_viewport ) - viewportResizeEvent( (TQResizeEvent *)e ); - break; - case TQEvent::MouseButtonPress: - viewportMousePressEvent( (TQMouseEvent*)e ); - if ( ((TQMouseEvent*)e)->isAccepted() ) - return TRUE; - break; - case TQEvent::MouseButtonRelease: - viewportMouseReleaseEvent( (TQMouseEvent*)e ); - if ( ((TQMouseEvent*)e)->isAccepted() ) - return TRUE; - break; - case TQEvent::MouseButtonDblClick: - viewportMouseDoubleClickEvent( (TQMouseEvent*)e ); - if ( ((TQMouseEvent*)e)->isAccepted() ) - return TRUE; - break; - case TQEvent::MouseMove: - viewportMouseMoveEvent( (TQMouseEvent*)e ); - if ( ((TQMouseEvent*)e)->isAccepted() ) - return TRUE; - break; -#ifndef TQT_NO_DRAGANDDROP - case TQEvent::DragEnter: - viewportDragEnterEvent( (TQDragEnterEvent*)e ); - break; - case TQEvent::DragMove: { - if ( d->drag_autoscroll ) { - TQPoint vp = ((TQDragMoveEvent*) e)->pos(); - TQRect inside_margin( autoscroll_margin, autoscroll_margin, - visibleWidth() - autoscroll_margin * 2, - visibleHeight() - autoscroll_margin * 2 ); - if ( !inside_margin.contains( vp ) ) { - startDragAutoScroll(); - // Keep sending move events - ( (TQDragMoveEvent*)e )->accept( TQRect(0,0,0,0) ); - } - } - viewportDragMoveEvent( (TQDragMoveEvent*)e ); - } break; - case TQEvent::DragLeave: - stopDragAutoScroll(); - viewportDragLeaveEvent( (TQDragLeaveEvent*)e ); - break; - case TQEvent::Drop: - stopDragAutoScroll(); - viewportDropEvent( (TQDropEvent*)e ); - break; -#endif // TQT_NO_DRAGANDDROP - case TQEvent::ContextMenu: - viewportContextMenuEvent( (TQContextMenuEvent*)e ); - if ( ((TQContextMenuEvent*)e)->isAccepted() ) - return TRUE; - break; - case TQEvent::ChildRemoved: - removeChild((TQWidget*)((TQChildEvent*)e)->child()); - break; - case TQEvent::LayoutHint: - d->autoResizeHint(this); - break; - case TQEvent::WindowActivate: - case TQEvent::WindowDeactivate: - return TRUE; - default: - break; - } - } else if ( d && d->rec((TQWidget*)obj) ) { // must be a child - if ( e->type() == TQEvent::Resize ) - d->autoResize(this); - else if ( e->type() == TQEvent::Move ) - d->autoMove(this); - } - return TQFrame::eventFilter( obj, e ); // always continue with standard event processing -} - -/*! - This event handler is called whenever the TQScrollView receives a - mousePressEvent(): the press position in \a e is translated to be a point - on the contents. -*/ -void TQScrollView::contentsMousePressEvent( TQMouseEvent* e ) -{ - e->ignore(); -} - -/*! - This event handler is called whenever the TQScrollView receives a - mouseReleaseEvent(): the release position in \a e is translated to be a - point on the contents. -*/ -void TQScrollView::contentsMouseReleaseEvent( TQMouseEvent* e ) -{ - e->ignore(); -} - -/*! - This event handler is called whenever the TQScrollView receives a - mouseDoubleClickEvent(): the click position in \a e is translated to be a - point on the contents. - - The default implementation generates a normal mouse press event. -*/ -void TQScrollView::contentsMouseDoubleClickEvent( TQMouseEvent* e ) -{ - contentsMousePressEvent(e); // try mouse press event -} - -/*! - This event handler is called whenever the TQScrollView receives a - mouseMoveEvent(): the mouse position in \a e is translated to be a point - on the contents. -*/ -void TQScrollView::contentsMouseMoveEvent( TQMouseEvent* e ) -{ - e->ignore(); -} - -#ifndef TQT_NO_DRAGANDDROP - -/*! - This event handler is called whenever the TQScrollView receives a - dragEnterEvent(): the drag position is translated to be a point - on the contents. -*/ -void TQScrollView::contentsDragEnterEvent( TQDragEnterEvent * ) -{ -} - -/*! - This event handler is called whenever the TQScrollView receives a - dragMoveEvent(): the drag position is translated to be a point on - the contents. -*/ -void TQScrollView::contentsDragMoveEvent( TQDragMoveEvent * ) -{ -} - -/*! - This event handler is called whenever the TQScrollView receives a - dragLeaveEvent(): the drag position is translated to be a point - on the contents. -*/ -void TQScrollView::contentsDragLeaveEvent( TQDragLeaveEvent * ) -{ -} - -/*! - This event handler is called whenever the TQScrollView receives a - dropEvent(): the drop position is translated to be a point on the - contents. -*/ -void TQScrollView::contentsDropEvent( TQDropEvent * ) -{ -} - -#endif // TQT_NO_DRAGANDDROP - -/*! - This event handler is called whenever the TQScrollView receives a - wheelEvent() in \a{e}: the mouse position is translated to be a - point on the contents. -*/ -#ifndef TQT_NO_WHEELEVENT -void TQScrollView::contentsWheelEvent( TQWheelEvent * e ) -{ - e->ignore(); -} -#endif -/*! - This event handler is called whenever the TQScrollView receives a - contextMenuEvent() in \a{e}: the mouse position is translated to - be a point on the contents. -*/ -void TQScrollView::contentsContextMenuEvent( TQContextMenuEvent *e ) -{ - e->ignore(); -} - -/*! - This is a low-level painting routine that draws the viewport - contents. Reimplement this if drawContents() is too high-level - (for example, if you don't want to open a TQPainter on the - viewport). The paint event is passed in \a pe. -*/ -void TQScrollView::viewportPaintEvent( TQPaintEvent* pe ) -{ - TQWidget* vp = viewport(); - - TQPainter p(vp); - TQRect r = pe->rect(); - - if ( d->clipped_viewport ) { - TQRect rr( - -d->clipped_viewport->x(), -d->clipped_viewport->y(), - d->viewport->width(), d->viewport->height() - ); - r &= rr; - if ( r.isValid() ) { - int ex = r.x() + d->clipped_viewport->x() + d->contentsX(); - int ey = r.y() + d->clipped_viewport->y() + d->contentsY(); - int ew = r.width(); - int eh = r.height(); - drawContentsOffset(&p, - d->contentsX()+d->clipped_viewport->x(), - d->contentsY()+d->clipped_viewport->y(), - ex, ey, ew, eh); - } - } else { - r &= d->viewport->rect(); - int ex = r.x() + d->contentsX(); - int ey = r.y() + d->contentsY(); - int ew = r.width(); - int eh = r.height(); - drawContentsOffset(&p, d->contentsX(), d->contentsY(), ex, ey, ew, eh); - } -} - - -/*! - To provide simple processing of events on the contents, this - function receives all resize events sent to the viewport. - - \sa TQWidget::resizeEvent() -*/ -void TQScrollView::viewportResizeEvent( TQResizeEvent* ) -{ -} - -/*! \internal - - To provide simple processing of events on the contents, this - function receives all mouse press events sent to the viewport, - translates the event and calls contentsMousePressEvent(). - - \sa contentsMousePressEvent(), TQWidget::mousePressEvent() -*/ -void TQScrollView::viewportMousePressEvent( TQMouseEvent* e ) -{ - TQMouseEvent ce(e->type(), viewportToContents(e->pos()), - e->globalPos(), e->button(), e->state()); - contentsMousePressEvent(&ce); - if ( !ce.isAccepted() ) - e->ignore(); -} - -/*!\internal - - To provide simple processing of events on the contents, this function - receives all mouse release events sent to the viewport, translates - the event and calls contentsMouseReleaseEvent(). - - \sa TQWidget::mouseReleaseEvent() -*/ -void TQScrollView::viewportMouseReleaseEvent( TQMouseEvent* e ) -{ - TQMouseEvent ce(e->type(), viewportToContents(e->pos()), - e->globalPos(), e->button(), e->state()); - contentsMouseReleaseEvent(&ce); - if ( !ce.isAccepted() ) - e->ignore(); -} - -/*!\internal - - To provide simple processing of events on the contents, this function - receives all mouse double click events sent to the viewport, - translates the event and calls contentsMouseDoubleClickEvent(). - - \sa TQWidget::mouseDoubleClickEvent() -*/ -void TQScrollView::viewportMouseDoubleClickEvent( TQMouseEvent* e ) -{ - TQMouseEvent ce(e->type(), viewportToContents(e->pos()), - e->globalPos(), e->button(), e->state()); - contentsMouseDoubleClickEvent(&ce); - if ( !ce.isAccepted() ) - e->ignore(); -} - -/*!\internal - - To provide simple processing of events on the contents, this function - receives all mouse move events sent to the viewport, translates the - event and calls contentsMouseMoveEvent(). - - \sa TQWidget::mouseMoveEvent() -*/ -void TQScrollView::viewportMouseMoveEvent( TQMouseEvent* e ) -{ - TQMouseEvent ce(e->type(), viewportToContents(e->pos()), - e->globalPos(), e->button(), e->state()); - contentsMouseMoveEvent(&ce); - if ( !ce.isAccepted() ) - e->ignore(); -} - -#ifndef TQT_NO_DRAGANDDROP - -/*!\internal - - To provide simple processing of events on the contents, this function - receives all drag enter events sent to the viewport, translates the - event and calls contentsDragEnterEvent(). - - \sa TQWidget::dragEnterEvent() -*/ -void TQScrollView::viewportDragEnterEvent( TQDragEnterEvent* e ) -{ - e->setPoint(viewportToContents(e->pos())); - contentsDragEnterEvent(e); - e->setPoint(contentsToViewport(e->pos())); -} - -/*!\internal - - To provide simple processing of events on the contents, this function - receives all drag move events sent to the viewport, translates the - event and calls contentsDragMoveEvent(). - - \sa TQWidget::dragMoveEvent() -*/ -void TQScrollView::viewportDragMoveEvent( TQDragMoveEvent* e ) -{ - e->setPoint(viewportToContents(e->pos())); - contentsDragMoveEvent(e); - e->setPoint(contentsToViewport(e->pos())); -} - -/*!\internal - - To provide simple processing of events on the contents, this function - receives all drag leave events sent to the viewport and calls - contentsDragLeaveEvent(). - - \sa TQWidget::dragLeaveEvent() -*/ -void TQScrollView::viewportDragLeaveEvent( TQDragLeaveEvent* e ) -{ - contentsDragLeaveEvent(e); -} - -/*!\internal - - To provide simple processing of events on the contents, this function - receives all drop events sent to the viewport, translates the event - and calls contentsDropEvent(). - - \sa TQWidget::dropEvent() -*/ -void TQScrollView::viewportDropEvent( TQDropEvent* e ) -{ - e->setPoint(viewportToContents(e->pos())); - contentsDropEvent(e); - e->setPoint(contentsToViewport(e->pos())); -} - -#endif // TQT_NO_DRAGANDDROP - -/*!\internal - - To provide simple processing of events on the contents, this function - receives all wheel events sent to the viewport, translates the - event and calls contentsWheelEvent(). - - \sa TQWidget::wheelEvent() -*/ -#ifndef TQT_NO_WHEELEVENT -void TQScrollView::viewportWheelEvent( TQWheelEvent* e ) -{ - /* - Different than standard mouse events, because wheel events might - be sent to the focus widget if the widget-under-mouse doesn't want - the event itself. - */ - TQWheelEvent ce( viewportToContents(e->pos()), - e->globalPos(), e->delta(), e->state(), e->orientation()); - contentsWheelEvent(&ce); - if ( ce.isAccepted() ) - e->accept(); - else - e->ignore(); -} -#endif - -/*! \internal - - To provide simple processing of events on the contents, this function - receives all context menu events sent to the viewport, translates the - event and calls contentsContextMenuEvent(). -*/ -void TQScrollView::viewportContextMenuEvent( TQContextMenuEvent *e ) -{ - TQContextMenuEvent ce(e->reason(), viewportToContents(e->pos()), e->globalPos(), e->state() ); - contentsContextMenuEvent( &ce ); - if ( ce.isAccepted() ) - e->accept(); - else - e->ignore(); -} - -/*! - Returns the component horizontal scroll bar. It is made available - to allow accelerators, autoscrolling, etc. - - It should not be used for other purposes. - - This function never returns 0. -*/ -TQScrollBar* TQScrollView::horizontalScrollBar() const -{ - return d->hbar; -} - -/*! - Returns the component vertical scroll bar. It is made available to - allow accelerators, autoscrolling, etc. - - It should not be used for other purposes. - - This function never returns 0. -*/ -TQScrollBar* TQScrollView::verticalScrollBar() const { - return d->vbar; -} - - -/*! - Scrolls the content so that the point \a (x, y) is visible with at - least 50-pixel margins (if possible, otherwise centered). -*/ -void TQScrollView::ensureVisible( int x, int y ) -{ - ensureVisible(x, y, 50, 50); -} - -/*! - \overload - - Scrolls the content so that the point \a (x, y) is visible with at - least the \a xmargin and \a ymargin margins (if possible, - otherwise centered). -*/ -void TQScrollView::ensureVisible( int x, int y, int xmargin, int ymargin ) -{ - int pw=visibleWidth(); - int ph=visibleHeight(); - - int cx=-d->contentsX(); - int cy=-d->contentsY(); - int cw=d->contentsWidth(); - int ch=contentsHeight(); - - if ( pw < xmargin*2 ) - xmargin=pw/2; - if ( ph < ymargin*2 ) - ymargin=ph/2; - - if ( cw <= pw ) { - xmargin=0; - cx=0; - } - if ( ch <= ph ) { - ymargin=0; - cy=0; - } - - if ( x < -cx+xmargin ) - cx = -x+xmargin; - else if ( x >= -cx+pw-xmargin ) - cx = -x+pw-xmargin; - - if ( y < -cy+ymargin ) - cy = -y+ymargin; - else if ( y >= -cy+ph-ymargin ) - cy = -y+ph-ymargin; - - if ( cx > 0 ) - cx=0; - else if ( cx < pw-cw && cw>pw ) - cx=pw-cw; - - if ( cy > 0 ) - cy=0; - else if ( cy < ph-ch && ch>ph ) - cy=ph-ch; - - setContentsPos( -cx, -cy ); -} - -/*! - Scrolls the content so that the point \a (x, y) is in the top-left - corner. -*/ -void TQScrollView::setContentsPos( int x, int y ) -{ -#if 0 - // bounds checking... - if ( TQApplication::reverseLayout() ) - if ( x > d->contentsWidth() - visibleWidth() ) x = d->contentsWidth() - visibleWidth(); - else -#endif - if ( x < 0 ) x = 0; - if ( y < 0 ) y = 0; - // Choke signal handling while we update BOTH sliders. - d->signal_choke=TRUE; - moveContents( -x, -y ); - d->vbar->setValue( y ); - d->hbar->setValue( x ); - d->signal_choke=FALSE; -} - -/*! - Scrolls the content by \a dx to the left and \a dy upwards. -*/ -void TQScrollView::scrollBy( int dx, int dy ) -{ - setContentsPos( TQMAX( d->contentsX()+dx, 0 ), TQMAX( d->contentsY()+dy, 0 ) ); -} - -/*! - Scrolls the content so that the point \a (x, y) is in the center - of visible area. -*/ -void TQScrollView::center( int x, int y ) -{ - ensureVisible( x, y, 32000, 32000 ); -} - -/*! - \overload - - Scrolls the content so that the point \a (x, y) is visible with - the \a xmargin and \a ymargin margins (as fractions of visible - the area). - - For example: - \list - \i Margin 0.0 allows (x, y) to be on the edge of the visible area. - \i Margin 0.5 ensures that (x, y) is in middle 50% of the visible area. - \i Margin 1.0 ensures that (x, y) is in the center of the the visible area. - \endlist -*/ -void TQScrollView::center( int x, int y, float xmargin, float ymargin ) -{ - int pw=visibleWidth(); - int ph=visibleHeight(); - ensureVisible( x, y, int( xmargin/2.0*pw+0.5 ), int( ymargin/2.0*ph+0.5 ) ); -} - - -/*! - \fn void TQScrollView::contentsMoving(int x, int y) - - This signal is emitted just before the contents are moved to - position \a (x, y). - - \sa contentsX(), contentsY() -*/ - -/*! - Moves the contents by \a (x, y). -*/ -void TQScrollView::moveContents(int x, int y) -{ - if ( -x+visibleWidth() > d->contentsWidth() ) -#if 0 - if( TQApplication::reverseLayout() ) - x=TQMAX(0,-d->contentsWidth()+visibleWidth()); - else -#endif - x=TQMIN(0,-d->contentsWidth()+visibleWidth()); - if ( -y+visibleHeight() > contentsHeight() ) - y=TQMIN(0,-contentsHeight()+visibleHeight()); - - int dx = x - d->vx; - int dy = y - d->vy; - - if (!dx && !dy) - return; // Nothing to do - - emit contentsMoving( -x, -y ); - - d->vx = x; - d->vy = y; - - if ( d->clipped_viewport || d->static_bg ) { - // Cheap move (usually) - d->moveAllBy(dx,dy); - } else if ( /*dx && dy ||*/ - ( TQABS(dy) * 5 > visibleHeight() * 4 ) || - ( TQABS(dx) * 5 > visibleWidth() * 4 ) - ) - { - // Big move - if ( viewport()->isUpdatesEnabled() ) - viewport()->update(); - d->moveAllBy(dx,dy); - } else if ( !d->fake_scroll || d->contentsWidth() > visibleWidth() ) { - // Small move - clipper()->scroll(dx,dy); - } - d->hideOrShowAll(this, TRUE ); -} - -/*! - \property TQScrollView::contentsX - \brief the X coordinate of the contents that are at the left edge of - the viewport. -*/ -int TQScrollView::contentsX() const -{ - return d->contentsX(); -} - -/*! - \property TQScrollView::contentsY - \brief the Y coordinate of the contents that are at the top edge of - the viewport. -*/ -int TQScrollView::contentsY() const -{ - return d->contentsY(); -} - -/*! - \property TQScrollView::contentsWidth - \brief the width of the contents area -*/ -int TQScrollView::contentsWidth() const -{ - return d->contentsWidth(); -} - -/*! - \property TQScrollView::contentsHeight - \brief the height of the contents area -*/ -int TQScrollView::contentsHeight() const -{ - return d->vheight; -} - -/*! - Sets the size of the contents area to \a w pixels wide and \a h - pixels high and updates the viewport accordingly. -*/ -void TQScrollView::resizeContents( int w, int h ) -{ - int ow = d->vwidth; - int oh = d->vheight; - d->vwidth = w; - d->vheight = h; - - d->scrollbar_timer.start( 0, TRUE ); - - if ( d->children.isEmpty() && d->policy == Default ) - setResizePolicy( Manual ); - - if ( ow > w ) { - // Swap - int t=w; - w=ow; - ow=t; - } - // Refresh area ow..w - if ( ow < visibleWidth() && w >= 0 ) { - if ( ow < 0 ) - ow = 0; - if ( w > visibleWidth() ) - w = visibleWidth(); - clipper()->update( d->contentsX()+ow, 0, w-ow, visibleHeight() ); - } - - if ( oh > h ) { - // Swap - int t=h; - h=oh; - oh=t; - } - // Refresh area oh..h - if ( oh < visibleHeight() && h >= 0 ) { - if ( oh < 0 ) - oh = 0; - if ( h > visibleHeight() ) - h = visibleHeight(); - clipper()->update( 0, d->contentsY()+oh, visibleWidth(), h-oh); - } -} - -/*! - Calls update() on a rectangle defined by \a x, \a y, \a w, \a h, - translated appropriately. If the rectangle is not visible, nothing - is repainted. - - \sa repaintContents() -*/ -void TQScrollView::updateContents( int x, int y, int w, int h ) -{ - if ( testWState(WState_Visible|WState_BlockUpdates) != WState_Visible ) - return; - - TQWidget* vp = viewport(); - - // Translate - x -= d->contentsX(); - y -= d->contentsY(); - - // Clip to TQCOORD space - if ( x < 0 ) { - w += x; - x = 0; - } - if ( y < 0 ) { - h += y; - y = 0; - } - - if ( w < 0 || h < 0 ) - return; - if ( x > visibleWidth() || y > visibleHeight() ) - return; - - if ( w > visibleWidth() ) - w = visibleWidth(); - if ( h > visibleHeight() ) - h = visibleHeight(); - - if ( d->clipped_viewport ) { - // Translate clipper() to viewport() - x -= d->clipped_viewport->x(); - y -= d->clipped_viewport->y(); - } - - vp->update( x, y, w, h ); -} - -/*! - \overload - - Updates the contents in rectangle \a r -*/ -void TQScrollView::updateContents( const TQRect& r ) -{ - updateContents(r.x(), r.y(), r.width(), r.height()); -} - -/*! - \overload -*/ -void TQScrollView::updateContents() -{ - updateContents( d->contentsX(), d->contentsY(), visibleWidth(), visibleHeight() ); -} - -/*! - \overload - - Repaints the contents of rectangle \a r. If \a erase is TRUE the - background is cleared using the background color. -*/ -void TQScrollView::repaintContents( const TQRect& r, bool erase ) -{ - repaintContents(r.x(), r.y(), r.width(), r.height(), erase); -} - - -/*! - \overload - - Repaints the contents. If \a erase is TRUE the background is - cleared using the background color. -*/ -void TQScrollView::repaintContents( bool erase ) -{ - repaintContents( d->contentsX(), d->contentsY(), visibleWidth(), visibleHeight(), erase ); -} - - -/*! - Calls repaint() on a rectangle defined by \a x, \a y, \a w, \a h, - translated appropriately. If the rectangle is not visible, nothing - is repainted. If \a erase is TRUE the background is cleared using - the background color. - - \sa updateContents() -*/ -void TQScrollView::repaintContents( int x, int y, int w, int h, bool erase ) -{ - if ( testWState(WState_Visible|WState_BlockUpdates) != WState_Visible ) - return; - - TQWidget* vp = viewport(); - - // Translate logical to clipper() - x -= d->contentsX(); - y -= d->contentsY(); - - // Clip to TQCOORD space - if ( x < 0 ) { - w += x; - x = 0; - } - if ( y < 0 ) { - h += y; - y = 0; - } - - if ( w < 0 || h < 0 ) - return; - if ( w > visibleWidth() ) - w = visibleWidth(); - if ( h > visibleHeight() ) - h = visibleHeight(); - - if ( d->clipped_viewport ) { - // Translate clipper() to viewport() - x -= d->clipped_viewport->x(); - y -= d->clipped_viewport->y(); - } - - vp->repaint( x, y, w, h, erase ); -} - - -/*! - For backward-compatibility only. It is easier to use - drawContents(TQPainter*,int,int,int,int). - - The default implementation translates the painter appropriately - and calls drawContents(TQPainter*,int,int,int,int). See - drawContents() for an explanation of the parameters \a p, \a - offsetx, \a offsety, \a clipx, \a clipy, \a clipw and \a cliph. -*/ -void TQScrollView::drawContentsOffset(TQPainter* p, int offsetx, int offsety, int clipx, int clipy, int clipw, int cliph) -{ - p->translate(-offsetx,-offsety); - drawContents(p, clipx, clipy, clipw, cliph); -} - -/*! - \fn void TQScrollView::drawContents(TQPainter* p, int clipx, int clipy, int clipw, int cliph) - - Reimplement this function if you are viewing a drawing area rather - than a widget. - - The function should draw the rectangle (\a clipx, \a clipy, \a - clipw, \a cliph) of the contents using painter \a p. The clip - rectangle is in the scrollview's coordinates. - - For example: - \code - { - // Fill a 40000 by 50000 rectangle at (100000,150000) - - // Calculate the coordinates... - int x1 = 100000, y1 = 150000; - int x2 = x1+40000-1, y2 = y1+50000-1; - - // Clip the coordinates so X/Windows will not have problems... - if (x1 < clipx) x1=clipx; - if (y1 < clipy) y1=clipy; - if (x2 > clipx+clipw-1) x2=clipx+clipw-1; - if (y2 > clipy+cliph-1) y2=clipy+cliph-1; - - // Paint using the small coordinates... - if ( x2 >= x1 && y2 >= y1 ) - p->fillRect(x1, y1, x2-x1+1, y2-y1+1, red); - } - \endcode - - The clip rectangle and translation of the painter \a p is already - set appropriately. -*/ -void TQScrollView::drawContents(TQPainter*, int, int, int, int) -{ -} - - -/*! - \reimp -*/ -void TQScrollView::frameChanged() -{ - // slight ugle-hack - the listview header needs readjusting when - // changing the frame - if (TQListView *lv = ::tqt_cast(this)) - lv->triggerUpdate(); - TQFrame::frameChanged(); - updateScrollBars(); -} - - -/*! - Returns the viewport widget of the scrollview. This is the widget - containing the contents widget or which is the drawing area. -*/ -TQWidget* TQScrollView::viewport() const -{ - if ( d->clipped_viewport ) - return d->clipped_viewport; - return d->viewport; -} - -/*! - Returns the clipper widget. Contents in the scrollview are - ultimately clipped to be inside the clipper widget. - - You should not need to use this function. - - \sa visibleWidth(), visibleHeight() -*/ -TQWidget* TQScrollView::clipper() const -{ - return d->viewport; -} - -/*! - \property TQScrollView::visibleWidth - \brief the horizontal amount of the content that is visible -*/ -int TQScrollView::visibleWidth() const -{ - return clipper()->width(); -} - -/*! - \property TQScrollView::visibleHeight - \brief the vertical amount of the content that is visible -*/ -int TQScrollView::visibleHeight() const -{ - return clipper()->height(); -} - - -void TQScrollView::changeFrameRect(const TQRect& r) -{ - TQRect oldr = frameRect(); - if (oldr != r) { - TQRect cr = contentsRect(); - TQRegion fr( frameRect() ); - fr = fr.subtract( contentsRect() ); - setFrameRect( r ); - if ( isVisible() ) { - cr = cr.intersect( contentsRect() ); - fr = fr.unite( frameRect() ); - fr = fr.subtract( cr ); - if ( !fr.isEmpty() ) - TQApplication::postEvent( this, new TQPaintEvent( fr, FALSE ) ); - } - } -} - - -/*! - Sets the margins around the scrolling area to \a left, \a top, \a - right and \a bottom. This is useful for applications such as - spreadsheets with "locked" rows and columns. The marginal space is - \e inside the frameRect() and is left blank; reimplement - drawFrame() or put widgets in the unused area. - - By default all margins are zero. - - \sa frameChanged() -*/ -void TQScrollView::setMargins(int left, int top, int right, int bottom) -{ - if ( left == d->l_marg && - top == d->t_marg && - right == d->r_marg && - bottom == d->b_marg ) - return; - - d->l_marg = left; - d->t_marg = top; - d->r_marg = right; - d->b_marg = bottom; - updateScrollBars(); -} - - -/*! - Returns the left margin. - - \sa setMargins() -*/ -int TQScrollView::leftMargin() const -{ - return d->l_marg; -} - - -/*! - Returns the top margin. - - \sa setMargins() -*/ -int TQScrollView::topMargin() const -{ - return d->t_marg; -} - - -/*! - Returns the right margin. - - \sa setMargins() -*/ -int TQScrollView::rightMargin() const -{ - return d->r_marg; -} - - -/*! - Returns the bottom margin. - - \sa setMargins() -*/ -int TQScrollView::bottomMargin() const -{ - return d->b_marg; -} - -/*! - \reimp -*/ -bool TQScrollView::focusNextPrevChild( bool next ) -{ - // Makes sure that the new focus widget is on-screen, if - // necessary by scrolling the scroll view. - - // first set things up for the scan - TQFocusData *f = focusData(); - TQWidget *startingPoint = f->home(); - TQWidget *candidate = 0; - TQWidget *w = next ? f->next() : f->prev(); - TQSVChildRec *r; - extern bool tqt_tab_all_widgets; - uint focus_flag = tqt_tab_all_widgets ? TabFocus : StrongFocus; - - // then scan for a possible focus widget candidate - while( !candidate && w != startingPoint ) { - if ( w != startingPoint && - (w->focusPolicy() & focus_flag) == focus_flag - && w->isEnabled() &&!w->focusProxy() && w->isVisible() ) - candidate = w; - w = next ? f->next() : f->prev(); - } - - // if we could not find one, maybe super or parentWidget() can? - if ( !candidate ) - return TQFrame::focusNextPrevChild( next ); - - // we've found one. - r = d->ancestorRec( candidate ); - if ( r && ( r->child == candidate || - candidate->isVisibleTo( r->child ) ) ) { - TQPoint cp = r->child->mapToGlobal(TQPoint(0,0)); - TQPoint cr = candidate->mapToGlobal(TQPoint(0,0)) - cp; - ensureVisible( r->x+cr.x()+candidate->width()/2, - r->y+cr.y()+candidate->height()/2, - candidate->width()/2, - candidate->height()/2 ); - } - - candidate->setFocus(); - return TRUE; -} - - - -/*! - When a large numbers of child widgets are in a scrollview, - especially if they are close together, the scrolling performance - can suffer greatly. If \a y is TRUE the scrollview will use an - extra widget to group child widgets. - - Note that you may only call enableClipper() prior to adding - widgets. - - For a full discussion, see this class's \link #enableclipper - detailed description\endlink. -*/ -void TQScrollView::enableClipper(bool y) -{ - if ( !d->clipped_viewport == !y ) - return; - if ( d->children.count() ) - tqFatal("May only call TQScrollView::enableClipper() before adding widgets"); - if ( y ) { - d->clipped_viewport = new TQClipperWidget(clipper(), "qt_clipped_viewport", d->flags); - d->clipped_viewport->setGeometry(-coord_limit/2,-coord_limit/2, - coord_limit,coord_limit); - d->clipped_viewport->setBackgroundMode( d->viewport->backgroundMode() ); - d->viewport->setBackgroundMode(NoBackground); // no exposures for this - d->viewport->removeEventFilter( this ); - d->clipped_viewport->installEventFilter( this ); - d->clipped_viewport->show(); - } else { - delete d->clipped_viewport; - d->clipped_viewport = 0; - } -} - -/*! - Sets the scrollview to have a static background if \a y is TRUE, - or a scrolling background if \a y is FALSE. By default, the - background is scrolling. - - Be aware that this mode is quite slow, as a full repaint of the - visible area has to be triggered on every contents move. - - \sa hasStaticBackground() -*/ -void TQScrollView::setStaticBackground(bool y) -{ - d->static_bg = y; -} - -/*! - Returns TRUE if TQScrollView uses a static background; otherwise - returns FALSE. - - \sa setStaticBackground() -*/ -bool TQScrollView::hasStaticBackground() const -{ - return d->static_bg; -} - -/*! - \overload - - Returns the point \a p translated to a point on the viewport() - widget. -*/ -TQPoint TQScrollView::contentsToViewport( const TQPoint& p ) const -{ - if ( d->clipped_viewport ) { - return TQPoint( p.x() - d->contentsX() - d->clipped_viewport->x(), - p.y() - d->contentsY() - d->clipped_viewport->y() ); - } else { - return TQPoint( p.x() - d->contentsX(), - p.y() - d->contentsY() ); - } -} - -/*! - \overload - - Returns the point on the viewport \a vp translated to a point in - the contents. -*/ -TQPoint TQScrollView::viewportToContents( const TQPoint& vp ) const -{ - if ( d->clipped_viewport ) { - return TQPoint( vp.x() + d->contentsX() + d->clipped_viewport->x(), - vp.y() + d->contentsY() + d->clipped_viewport->y() ); - } else { - return TQPoint( vp.x() + d->contentsX(), - vp.y() + d->contentsY() ); - } -} - - -/*! - Translates a point (\a x, \a y) in the contents to a point (\a vx, - \a vy) on the viewport() widget. -*/ -void TQScrollView::contentsToViewport( int x, int y, int& vx, int& vy ) const -{ - const TQPoint v = contentsToViewport(TQPoint(x,y)); - vx = v.x(); - vy = v.y(); -} - -/*! - Translates a point (\a vx, \a vy) on the viewport() widget to a - point (\a x, \a y) in the contents. -*/ -void TQScrollView::viewportToContents( int vx, int vy, int& x, int& y ) const -{ - const TQPoint c = viewportToContents(TQPoint(vx,vy)); - x = c.x(); - y = c.y(); -} - -/*! - \reimp -*/ -TQSize TQScrollView::sizeHint() const -{ - if ( d->use_cached_size_hint && d->cachedSizeHint.isValid() ) - return d->cachedSizeHint; - - constPolish(); - int f = 2 * frameWidth(); - int h = fontMetrics().height(); - TQSize sz( f, f ); - if ( d->policy > Manual ) { - TQSVChildRec *r = d->children.first(); - if ( r ) { - TQSize cs = r->child->sizeHint(); - if ( cs.isValid() ) - sz += cs.boundedTo( r->child->maximumSize() ); - else - sz += r->child->size(); - } - } else { - sz += TQSize( d->contentsWidth(), contentsHeight() ); - } - if (d->vMode == AlwaysOn) - sz.setWidth(sz.width() + d->vbar->sizeHint().width()); - if (d->hMode == AlwaysOn) - sz.setHeight(sz.height() + d->hbar->sizeHint().height()); - return sz.expandedTo( TQSize(12 * h, 8 * h) ) - .boundedTo( TQSize(36 * h, 24 * h) ); -} - - -/*! - \reimp -*/ -TQSize TQScrollView::minimumSizeHint() const -{ - int h = fontMetrics().height(); - if ( h < 10 ) - h = 10; - int f = 2 * frameWidth(); - return TQSize( (6 * h) + f, (4 * h) + f ); -} - - -/*! - \reimp - - (Implemented to get rid of a compiler warning.) -*/ -void TQScrollView::drawContents( TQPainter * ) -{ -} - -#ifndef TQT_NO_DRAGANDDROP - -/*! - \internal -*/ -void TQScrollView::startDragAutoScroll() -{ - if ( !d->autoscroll_timer.isActive() ) { - d->autoscroll_time = initialScrollTime; - d->autoscroll_accel = initialScrollAccel; - d->autoscroll_timer.start( d->autoscroll_time ); - } -} - - -/*! - \internal -*/ -void TQScrollView::stopDragAutoScroll() -{ - d->autoscroll_timer.stop(); -} - - -/*! - \internal -*/ -void TQScrollView::doDragAutoScroll() -{ - TQPoint p = d->viewport->mapFromGlobal( TQCursor::pos() ); - - if ( d->autoscroll_accel-- <= 0 && d->autoscroll_time ) { - d->autoscroll_accel = initialScrollAccel; - d->autoscroll_time--; - d->autoscroll_timer.start( d->autoscroll_time ); - } - int l = TQMAX( 1, ( initialScrollTime- d->autoscroll_time ) ); - - int dx = 0, dy = 0; - if ( p.y() < autoscroll_margin ) { - dy = -l; - } else if ( p.y() > visibleHeight() - autoscroll_margin ) { - dy = +l; - } - if ( p.x() < autoscroll_margin ) { - dx = -l; - } else if ( p.x() > visibleWidth() - autoscroll_margin ) { - dx = +l; - } - if ( dx || dy ) { - scrollBy(dx,dy); - } else { - stopDragAutoScroll(); - } -} - - -/*! - \property TQScrollView::dragAutoScroll - \brief whether autoscrolling in drag move events is enabled - - If this property is set to TRUE (the default), the TQScrollView - automatically scrolls the contents in drag move events if the user - moves the cursor close to a border of the view. Of course this - works only if the viewport accepts drops. Specifying FALSE - disables this autoscroll feature. - - \warning Enabling this property might not be enough to - effectively turn on autoscrolling. If you put a custom widget in - the TQScrollView, you might need to call TQDragEvent::ignore() on - the event in the dragEnterEvent() and dragMoveEvent() - reimplementations. -*/ - -void TQScrollView::setDragAutoScroll( bool b ) -{ - d->drag_autoscroll = b; -} - -bool TQScrollView::dragAutoScroll() const -{ - return d->drag_autoscroll; -} - -#endif // TQT_NO_DRAGANDDROP - -/*!\internal - */ -void TQScrollView::setCachedSizeHint( const TQSize &sh ) const -{ - if ( isVisible() && !d->cachedSizeHint.isValid() ) - d->cachedSizeHint = sh; -} - -/*!\internal - */ -void TQScrollView::disableSizeHintCaching() -{ - d->use_cached_size_hint = FALSE; -} - -/*!\internal - */ -TQSize TQScrollView::cachedSizeHint() const -{ - return d->use_cached_size_hint ? d->cachedSizeHint : TQSize(); -} - -#endif // TQT_NO_SCROLLVIEW diff --git a/src/widgets/qslider.cpp b/src/widgets/qslider.cpp deleted file mode 100644 index df7555031..000000000 --- a/src/widgets/qslider.cpp +++ /dev/null @@ -1,924 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQSlider class -** -** Created : 961019 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqslider.h" -#ifndef TQT_NO_SLIDER -#include "tqpainter.h" -#include "ntqdrawutil.h" -#include "tqtimer.h" -#include "tqbitmap.h" -#include "ntqapplication.h" -#include "tqstyle.h" -#if defined(QT_ACCESSIBILITY_SUPPORT) -#include "ntqaccessible.h" -#endif - -static const int thresholdTime = 300; -static const int repeatTime = 100; - -struct TQSliderPrivate -{ - // ### move these to TQSlider in TQt 4.0 - int sliderStartVal; - TQSliderPrivate() : sliderStartVal( 0 ) { } -}; - - -/*! - \class TQSlider - \brief The TQSlider widget provides a vertical or horizontal slider. - - \ingroup basic - \mainclass - - The slider is the classic widget for controlling a bounded value. - It lets the user move a slider along a horizontal or vertical - groove and translates the slider's position into an integer value - within the legal range. - - TQSlider inherits TQRangeControl, which provides the "integer" side - of the slider. setRange() and value() are likely to be used by - practically all slider users; see the \l TQRangeControl - documentation for information about the many other functions that - class provides. - - The main functions offered by the slider itself are tickmark and - orientation control; you can use setTickmarks() to indicate where - you want the tickmarks to be, setTickInterval() to indicate how - many of them you want and setOrientation() to indicate whether the - slider is to be horizontal or vertical. - - A slider accepts focus on Tab and uses the mouse wheel and a - suitable keyboard interface. - - - - \important setRange - - \sa TQScrollBar TQSpinBox - \link guibooks.html#fowler GUI Design Handbook: Slider\endlink -*/ - - -/*! - \enum TQSlider::TickSetting - - This enum specifies where the tickmarks are to be drawn relative - to the slider's groove and the handle the user moves. - - \value NoMarks do not draw any tickmarks. - \value Both draw tickmarks on both sides of the groove. - \value Above draw tickmarks above the (horizontal) slider - \value Below draw tickmarks below the (horizontal) slider - \value Left draw tickmarks to the left of the (vertical) slider - \value Right draw tickmarks to the right of the (vertical) slider -*/ - - -/*! - Constructs a vertical slider. - - The \a parent and \a name arguments are sent on to the TQWidget - constructor. -*/ - -TQSlider::TQSlider( TQWidget *parent, const char *name ) - : TQWidget( parent, name ) -{ - orient = Vertical; - init(); -} - -/*! - Constructs a slider. - - The \a orientation must be \l TQt::Vertical or \l TQt::Horizontal. - - The \a parent and \a name arguments are sent on to the TQWidget - constructor. -*/ - -TQSlider::TQSlider( Orientation orientation, TQWidget *parent, const char *name ) - : TQWidget( parent, name ) -{ - orient = orientation; - init(); -} - -/*! - Constructs a slider whose value can never be smaller than \a - minValue or greater than \a maxValue, whose page step size is \a - pageStep and whose value is initially \a value (which is - guaranteed to be in range using bound()). - - If \a orientation is \c TQt::Vertical the slider is vertical and if it - is \c TQt::Horizontal the slider is horizontal. - - The \a parent and \a name arguments are sent on to the TQWidget - constructor. -*/ - -TQSlider::TQSlider( int minValue, int maxValue, int pageStep, - int value, Orientation orientation, - TQWidget *parent, const char *name ) - : TQWidget( parent, name ), - TQRangeControl( minValue, maxValue, 1, pageStep, value ) -{ - orient = orientation; - init(); - sliderVal = value; -} - -/*! - Destructor. -*/ -TQSlider::~TQSlider() -{ - delete d; -} - -void TQSlider::init() -{ - d = new TQSliderPrivate; - timer = 0; - sliderPos = 0; - sliderVal = 0; - clickOffset = 0; - state = Idle; - track = TRUE; - ticks = NoMarks; - tickInt = 0; - setFocusPolicy( TabFocus ); - initTicks(); - - TQSizePolicy sp( TQSizePolicy::Expanding, TQSizePolicy::Fixed ); - if ( orient == Vertical ) - sp.transpose(); - setSizePolicy( sp ); - clearWState( WState_OwnSizePolicy ); -} - - -/* - Does what's needed when someone changes the tickmark status. -*/ - -void TQSlider::initTicks() -{ - tickOffset = style().pixelMetric( TQStyle::PM_SliderTickmarkOffset, this ); -} - - -/*! - \property TQSlider::tracking - \brief whether slider tracking is enabled - - If tracking is enabled (the default), the slider emits the - valueChanged() signal whenever the slider is being dragged. If - tracking is disabled, the slider emits the valueChanged() signal - when the user releases the mouse button (unless the value happens - to be the same as before). -*/ - -void TQSlider::setTracking( bool enable ) -{ - track = enable; -} - - -/*! - \fn void TQSlider::valueChanged( int value ) - - This signal is emitted when the slider value is changed, with the - new slider \a value as its argument. -*/ - -/*! - \fn void TQSlider::sliderPressed() - - This signal is emitted when the user presses the slider with the - mouse. -*/ - -/*! - \fn void TQSlider::sliderMoved( int value ) - - This signal is emitted when the slider is dragged, with the new - slider \a value as its argument. -*/ - -/*! - \fn void TQSlider::sliderReleased() - - This signal is emitted when the user releases the slider with the mouse. -*/ - -/* - Calculates slider position corresponding to value \a v. -*/ - -int TQSlider::positionFromValue( int v ) const -{ - int a = available(); - int x = TQRangeControl::positionFromValue( v, a ); - if ( orient == Horizontal && TQApplication::reverseLayout() ) - x = a - x; - return x; -} - -/* - Returns the available space in which the slider can move. -*/ - -int TQSlider::available() const -{ - return style().pixelMetric( TQStyle::PM_SliderSpaceAvailable, this ); -} - -/* - Calculates a value corresponding to slider position \a p. -*/ - -int TQSlider::valueFromPosition( int p ) const -{ - int a = available(); - int x = TQRangeControl::valueFromPosition( p, a ); - if ( orient == Horizontal && TQApplication::reverseLayout() ) - x = maxValue() + minValue() - x; - return x; -} - -/*! - Implements the virtual TQRangeControl function. -*/ - -void TQSlider::rangeChange() -{ - int newPos = positionFromValue( value() ); - if ( newPos != sliderPos ) { - reallyMoveSlider( newPos ); - } -} - -/*! - Implements the virtual TQRangeControl function. -*/ - -void TQSlider::valueChange() -{ - if ( sliderVal != value() ) { - int newPos = positionFromValue( value() ); - sliderVal = value(); - reallyMoveSlider( newPos ); - } - emit valueChanged(value()); -#if defined(QT_ACCESSIBILITY_SUPPORT) - TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); -#endif -} - - -/*! - \reimp -*/ -void TQSlider::resizeEvent( TQResizeEvent * ) -{ - rangeChange(); - initTicks(); -} - - -/*! - Reimplements the virtual function TQWidget::setPalette(). - - Sets the background color to the mid color for Motif style sliders - using palette \a p. -*/ - -void TQSlider::setPalette( const TQPalette &p ) -{ - TQWidget::setPalette( p ); -} - - - -/*! - \property TQSlider::orientation - \brief the slider's orientation - - The orientation must be \l TQt::Vertical (the default) or \l - TQt::Horizontal. -*/ - -void TQSlider::setOrientation( Orientation orientation ) -{ - if ( orientation == orient ) - return; - - if ( !testWState( WState_OwnSizePolicy ) ) { - TQSizePolicy sp = sizePolicy(); - sp.transpose(); - setSizePolicy( sp ); - clearWState( WState_OwnSizePolicy ); - } - - orient = orientation; - - rangeChange(); - update(); -} - -/*! - \fn int TQSlider::sliderStart() const - - Returns the start position of the slider. -*/ - - -/*! - Returns the slider handle rectangle. (This is the visual marker - that the user can move.) -*/ - -TQRect TQSlider::sliderRect() const -{ - return style().querySubControlMetrics( TQStyle::CC_Slider, this, - TQStyle::SC_SliderHandle ); -} - -/* - Performs the actual moving of the slider. -*/ - -void TQSlider::reallyMoveSlider( int newPos ) -{ - TQRegion oldR(sliderRect()); - sliderPos = newPos; - TQRegion newR(sliderRect()); - - /* just the one repaint if no background */ - if (backgroundMode() == NoBackground) - repaint(newR | oldR, FALSE); - else { - repaint(oldR.subtract(newR)); - repaint(newR, FALSE); - } -} - - -/*! - \reimp -*/ -void TQSlider::paintEvent( TQPaintEvent * ) -{ - TQPainter p( this ); - - TQStyle::SFlags flags = TQStyle::Style_Default; - if (isEnabled()) - flags |= TQStyle::Style_Enabled; - if (hasFocus()) - flags |= TQStyle::Style_HasFocus; - if (hasMouse()) - flags |= TQStyle::Style_MouseOver; - - TQStyle::SCFlags sub = TQStyle::SC_SliderGroove | TQStyle::SC_SliderHandle; - if ( tickmarks() != NoMarks ) { - sub |= TQStyle::SC_SliderTickmarks; - } - - style().drawComplexControl( TQStyle::CC_Slider, &p, this, rect(), colorGroup(), - flags, sub, state == Dragging ? TQStyle::SC_SliderHandle : TQStyle::SC_None ); -} - - -/*! - \reimp -*/ -void TQSlider::mousePressEvent( TQMouseEvent *e ) -{ - int slideLength = style().pixelMetric( TQStyle::PM_SliderLength, this ); - resetState(); - d->sliderStartVal = sliderVal; - TQRect r = sliderRect(); - - if ( e->button() == RightButton ) - return; - - if ( r.contains( e->pos() ) ) { - state = Dragging; - clickOffset = (TQCOORD)( goodPart( e->pos() ) - sliderPos ); - emit sliderPressed(); - } else if ( e->button() == MidButton ) { - int pos = goodPart( e->pos() ); - moveSlider( pos - slideLength / 2 ); - state = Dragging; - clickOffset = slideLength / 2; - } else if ( ( orient == Horizontal && e->pos().x() < r.left() ) //### goodPart - || ( orient == Vertical && e->pos().y() < r.top() ) ) { - if ( orient == Horizontal && TQApplication::reverseLayout() ) { - state = TimingUp; - addPage(); - } else { - state = TimingDown; - subtractPage(); - } - if ( !timer ) - timer = new TQTimer( this ); - connect( timer, TQ_SIGNAL(timeout()), TQ_SLOT(repeatTimeout()) ); - timer->start( thresholdTime, TRUE ); - } else if ( ( orient == Horizontal && e->pos().x() > r.right() ) //### goodPart - || ( orient == Vertical && e->pos().y() > r.bottom() ) ) { - if ( orient == Horizontal && TQApplication::reverseLayout() ) { - state = TimingDown; - subtractPage(); - } else { - state = TimingUp; - addPage(); - } - if ( !timer ) - timer = new TQTimer( this ); - connect( timer, TQ_SIGNAL(timeout()), TQ_SLOT(repeatTimeout()) ); - timer->start( thresholdTime, TRUE ); - } - update( sliderRect() ); -} - -/*! - \reimp -*/ -void TQSlider::mouseMoveEvent( TQMouseEvent *e ) -{ - if ( state != Dragging ) - return; - - TQRect r = rect(); - int m = style().pixelMetric( TQStyle::PM_MaximumDragDistance, - this ); - if ( m >= 0 ) { - if ( orientation() == Horizontal ) - r.setRect( r.x() - m, r.y() - 2*m/3, - r.width() + 2*m, r.height() + 3*m ); - else - r.setRect( r.x() - 2*m/3, r.y() - m, - r.width() + 3*m, r.height() + 2*m ); - if ( !r.contains( e->pos() ) ) { - moveSlider( positionFromValue(d->sliderStartVal) ); - return; - } - } - - int pos = goodPart( e->pos() ); - moveSlider( pos - clickOffset ); -} - -/*! - \reimp -*/ -#ifndef TQT_NO_WHEELEVENT -void TQSlider::wheelEvent( TQWheelEvent * e ) -{ - if ( e->orientation() != orientation() && !rect().contains(e->pos()) ) - return; - - static float offset = 0; - static TQSlider* offset_owner = 0; - if (offset_owner != this){ - offset_owner = this; - offset = 0; - } - offset += -e->delta()*TQMAX(pageStep(),lineStep())/120; - if (TQABS(offset)<1) - return; - setValue( value() + int(offset) ); - offset -= int(offset); - e->accept(); -} -#endif - -/*! - \reimp -*/ -void TQSlider::mouseReleaseEvent( TQMouseEvent * ) -{ - resetState(); - update( sliderRect() ); -} - -/*! - \reimp -*/ -void TQSlider::focusInEvent( TQFocusEvent * e) -{ - TQWidget::focusInEvent( e ); -} - -/*! - \reimp -*/ -void TQSlider::focusOutEvent( TQFocusEvent * e ) -{ - TQWidget::focusOutEvent( e ); -} - -/*! - Moves the left (or top) edge of the slider to position \a pos. The - slider is actually moved to the step position nearest the given \a - pos. -*/ - -void TQSlider::moveSlider( int pos ) -{ - int a = available(); - int newPos = TQMIN( a, TQMAX( 0, pos ) ); - int newVal = valueFromPosition( newPos ); - if (style().styleHint(TQStyle::SH_Slider_SnapToValue, this)) - newPos = positionFromValue( newVal ); - if ( sliderPos != newPos ) - reallyMoveSlider( newPos ); - if ( sliderVal != newVal ) { - sliderVal = newVal; - emit sliderMoved( sliderVal ); - } - if ( tracking() && sliderVal != value() ) - setValue( sliderVal ); - -} - - -/* - Resets all state information and stops the timer. -*/ - -void TQSlider::resetState() -{ - if ( timer ) { - timer->stop(); - timer->disconnect(); - } - switch ( state ) { - case TimingUp: - case TimingDown: - break; - case Dragging: { - setValue( valueFromPosition( sliderPos ) ); - emit sliderReleased(); - break; - } - case Idle: - break; - default: - tqWarning("TQSlider: (%s) in wrong state", name( "unnamed" ) ); - } - state = Idle; -} - - -/*! - \reimp -*/ -void TQSlider::keyPressEvent( TQKeyEvent *e ) -{ - bool sloppy = bool(style().styleHint(TQStyle::SH_Slider_SloppyKeyEvents, this)); - switch ( e->key() ) { - case Key_Left: - if ( sloppy || orient == Horizontal ) { - if (TQApplication::reverseLayout()) - addLine(); - else - subtractLine(); - } - break; - case Key_Right: - if ( sloppy || orient == Horizontal ) { - if (TQApplication::reverseLayout()) - subtractLine(); - else - addLine(); - } - break; - case Key_Up: - if ( sloppy || orient == Vertical ) - subtractLine(); - break; - case Key_Down: - if ( sloppy || orient == Vertical ) - addLine(); - break; - case Key_Prior: - subtractPage(); - break; - case Key_Next: - addPage(); - break; - case Key_Home: - setValue( minValue() ); - break; - case Key_End: - setValue( maxValue() ); - break; - default: - e->ignore(); - return; - } -} - -void TQSlider::setValue( int value ) -{ - TQRangeControl::setValue( value ); -#if defined(QT_ACCESSIBILITY_SUPPORT) - TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); -#endif -} - - -/*! \reimp -*/ - -void TQSlider::addLine() -{ - TQRangeControl::addLine(); -} - -/*! \reimp -*/ - -void TQSlider::subtractLine() -{ - TQRangeControl::subtractLine(); -} - -/*! - Moves the slider one pageStep() up or right. -*/ - -void TQSlider::addStep() -{ - addPage(); -} - - -/*! - Moves the slider one pageStep() down or left. -*/ - -void TQSlider::subtractStep() -{ - subtractPage(); -} - - -/* - Waits for autorepeat. -*/ - -void TQSlider::repeatTimeout() -{ - Q_ASSERT( timer ); - timer->disconnect(); - if ( state == TimingDown ) - connect( timer, TQ_SIGNAL(timeout()), TQ_SLOT(subtractStep()) ); - else if ( state == TimingUp ) - connect( timer, TQ_SIGNAL(timeout()), TQ_SLOT(addStep()) ); - timer->start( repeatTime, FALSE ); -} - - -/* - Returns the relevant dimension of \a p. -*/ - -int TQSlider::goodPart( const TQPoint &p ) const -{ - return (orient == Horizontal) ? p.x() : p.y(); -} - -/*! - \reimp -*/ -TQSize TQSlider::sizeHint() const -{ - constPolish(); - const int length = 84, tickSpace = 5; - int thick = style().pixelMetric( TQStyle::PM_SliderThickness, this ); - if ( ticks & Above ) - thick += tickSpace; - if ( ticks & Below ) - thick += tickSpace; - int w = thick, h = length; - if ( orient == Horizontal ) { - w = length; - h = thick; - } - return (style().sizeFromContents(TQStyle::CT_Slider, this, - TQSize(w, h)).expandedTo(TQApplication::globalStrut())); -} - - - -/*! - \reimp -*/ - -TQSize TQSlider::minimumSizeHint() const -{ - TQSize s = sizeHint(); - int length = style().pixelMetric(TQStyle::PM_SliderLength, this); - if ( orient == Horizontal ) - s.setWidth( length ); - else - s.setHeight( length ); - - return s; -} - -/*! \fn void TQSlider::setSizePolicy( TQSizePolicy::SizeType, TQSizePolicy::SizeType, bool ) - \reimp -*/ - -/*! \reimp */ -void TQSlider::setSizePolicy( TQSizePolicy sp ) -{ - // ## remove 4.0 - TQWidget::setSizePolicy( sp ); -} - -/*! \reimp */ -TQSizePolicy TQSlider::sizePolicy() const -{ - // ### 4.0 remove this reimplementation - return TQWidget::sizePolicy(); -} - -/*! - \property TQSlider::tickmarks - \brief the tickmark settings for this slider - - The valid values are in \l{TQSlider::TickSetting}. The default is - \c NoMarks. - - \sa tickInterval -*/ - -void TQSlider::setTickmarks( TickSetting s ) -{ - ticks = s; - initTicks(); - update(); -} - - -/*! - \property TQSlider::tickInterval - \brief the interval between tickmarks - - This is a value interval, not a pixel interval. If it is 0, the - slider will choose between lineStep() and pageStep(). The initial - value of tickInterval is 0. - - \sa TQRangeControl::lineStep(), TQRangeControl::pageStep() -*/ - -void TQSlider::setTickInterval( int i ) -{ - tickInt = TQMAX( 0, i ); - update(); -} - - -/*! - \reimp -*/ -void TQSlider::styleChange( TQStyle& old ) -{ - TQWidget::styleChange( old ); -} - -/*! - \property TQSlider::minValue - \brief the current minimum value of the slider - - When setting this property, the \l TQSlider::maxValue is adjusted, - if necessary, to ensure that the range remains valid. - - \sa setRange() -*/ -int TQSlider::minValue() const -{ - return TQRangeControl::minValue(); -} - -/*! - \property TQSlider::maxValue - \brief the current maximum value of the slider - - When setting this property, the \l TQSlider::minValue is adjusted, - if necessary, to ensure that the range remains valid. - - \sa setRange() -*/ -int TQSlider::maxValue() const -{ - return TQRangeControl::maxValue(); -} - -void TQSlider::setMinValue( int minVal ) -{ - TQRangeControl::setMinValue( minVal ); -} - -void TQSlider::setMaxValue( int maxVal ) -{ - TQRangeControl::setMaxValue( maxVal ); -} - -/*! - \property TQSlider::lineStep - \brief the current line step - - When setting lineStep, the virtual stepChange() function will be - called if the new line step is different from the previous - setting. - - \sa setSteps() TQRangeControl::pageStep() setRange() -*/ -int TQSlider::lineStep() const -{ - return TQRangeControl::lineStep(); -} - -/*! - \property TQSlider::pageStep - \brief the current page step - - When setting pageStep, the virtual stepChange() function will be - called if the new page step is different from the previous - setting. - - \sa TQRangeControl::setSteps() setLineStep() setRange() -*/ - -int TQSlider::pageStep() const -{ - return TQRangeControl::pageStep(); -} - -void TQSlider::setLineStep( int i ) -{ - setSteps( i, pageStep() ); -} - -void TQSlider::setPageStep( int i ) -{ - setSteps( lineStep(), i ); -} - -/*! - \property TQSlider::value - \brief the current slider value - - \sa TQRangeControl::value() prevValue() -*/ - -int TQSlider::value() const -{ - return TQRangeControl::value(); -} - -#endif diff --git a/src/widgets/qspinbox.cpp b/src/widgets/qspinbox.cpp deleted file mode 100644 index d6d85beef..000000000 --- a/src/widgets/qspinbox.cpp +++ /dev/null @@ -1,1116 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQSpinBox widget class -** -** Created : 970101 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqspinbox.h" -#ifndef TQT_NO_SPINBOX - -#include "ntqcursor.h" -#include "ntqpushbutton.h" -#include "tqpainter.h" -#include "tqbitmap.h" -#include "ntqlineedit.h" -#include "ntqvalidator.h" -#include "tqpixmapcache.h" -#include "ntqapplication.h" -#include "tqstyle.h" -#if defined(QT_ACCESSIBILITY_SUPPORT) -#include "ntqaccessible.h" -#endif - -static bool sumOutOfRange(int current, int add) -{ - if (add > 0 && INT_MAX - add < current) { - return true; - } - if (add < 0 && INT_MIN - add > current) { - return true; - } - return false; -} - -class TQSpinBoxPrivate -{ -public: - TQSpinBoxPrivate() {} - TQSpinWidget* controls; - uint selreq : 1; -}; - -class TQSpinBoxValidator : public TQIntValidator -{ -public: - TQSpinBoxValidator( TQSpinBox *sb, const char *name ) - : TQIntValidator( sb, name ), spinBox( sb ) { } - - virtual State validate( TQString& str, int& pos ) const; - -private: - TQSpinBox *spinBox; -}; - -TQValidator::State TQSpinBoxValidator::validate( TQString& str, int& pos ) const -{ - TQString pref = spinBox->prefix(); - TQString suff = spinBox->suffix(); - TQString suffStriped = suff.stripWhiteSpace(); - uint overhead = pref.length() + suff.length(); - State state = Invalid; - - ((TQIntValidator *) this)->setRange( spinBox->minValue(), - spinBox->maxValue() ); - if ( overhead == 0 ) { - state = TQIntValidator::validate( str, pos ); - } else { - bool stripedVersion = FALSE; - if ( str.length() >= overhead && str.startsWith(pref) - && (str.endsWith(suff) - || (stripedVersion = str.endsWith(suffStriped))) ) { - if ( stripedVersion ) - overhead = pref.length() + suffStriped.length(); - TQString core = str.mid( pref.length(), str.length() - overhead ); - int corePos = pos - pref.length(); - state = TQIntValidator::validate( core, corePos ); - pos = corePos + pref.length(); - str.replace( pref.length(), str.length() - overhead, core ); - } else { - state = TQIntValidator::validate( str, pos ); - if ( state == Invalid ) { - // stripWhiteSpace(), cf. TQSpinBox::interpretText() - TQString special = spinBox->specialValueText().stripWhiteSpace(); - TQString candidate = str.stripWhiteSpace(); - - if ( special.startsWith(candidate) ) { - if ( candidate.length() == special.length() ) { - state = Acceptable; - } else { - state = Intermediate; - } - } - } - } - } - return state; -} - -/*! - \class TQSpinBox - \brief The TQSpinBox class provides a spin box widget (spin button). - - \ingroup basic - \mainclass - - TQSpinBox allows the user to choose a value either by clicking the - up/down buttons to increase/decrease the value currently displayed - or by typing the value directly into the spin box. If the value is - entered directly into the spin box, Enter (or Return) must be - pressed to apply the new value. The value is usually an integer. - - Every time the value changes TQSpinBox emits the valueChanged() - signal. The current value can be fetched with value() and set - with setValue(). - - The spin box keeps the value within a numeric range, and to - multiples of the lineStep() size (see TQRangeControl for details). - Clicking the up/down buttons or using the keyboard accelerator's - up and down arrows will increase or decrease the current value in - steps of size lineStep(). The minimum and maximum value and the - step size can be set using one of the constructors, and can be - changed later with setMinValue(), setMaxValue() and setLineStep(). - - Most spin boxes are directional, but TQSpinBox can also operate as - a circular spin box, i.e. if the range is 0-99 and the current - value is 99, clicking "up" will give 0. Use setWrapping() if you - want circular behavior. - - The displayed value can be prepended and appended with arbitrary - strings indicating, for example, currency or the unit of - measurement. See setPrefix() and setSuffix(). The text in the spin - box is retrieved with text() (which includes any prefix() and - suffix()), or with cleanText() (which has no prefix(), no suffix() - and no leading or trailing whitespace). currentValueText() returns - the spin box's current value as text. - - Normally the spin box displays up and down arrows in the buttons. - You can use setButtonSymbols() to change the display to show - + and - symbols if you prefer. In either case the up - and down arrow keys work as expected. - - It is often desirable to give the user a special (often default) - choice in addition to the range of numeric values. See - setSpecialValueText() for how to do this with TQSpinBox. - - The default \l TQWidget::focusPolicy() is StrongFocus. - - If using prefix(), suffix() and specialValueText() don't provide - enough control, you can ignore them and subclass TQSpinBox instead. - - TQSpinBox can easily be subclassed to allow the user to input - things other than an integer value as long as the allowed input - can be mapped to a range of integers. This can be done by - overriding the virtual functions mapValueToText() and - mapTextToValue(), and setting another suitable validator using - setValidator(). - - For example, these functions could be changed so that the user - provided values from 0.0 to 10.0, or -1 to signify 'Auto', while - the range of integers used inside the program would be -1 to 100: - - \code - class MySpinBox : public TQSpinBox - { - TQ_OBJECT - public: - ... - - TQString mapValueToText( int value ) - { - if ( value == -1 ) // special case - return TQString( "Auto" ); - - return TQString( "%1.%2" ) // 0.0 to 10.0 - .arg( value / 10 ).arg( value % 10 ); - } - - int mapTextToValue( bool *ok ) - { - if ( text() == "Auto" ) // special case - return -1; - - return (int) ( 10 * text().toFloat() ); // 0 to 100 - } - }; - \endcode - - - - \sa TQScrollBar TQSlider - \link guibooks.html#fowler GUI Design Handbook: Spin Box \endlink -*/ - - -/*! - Constructs a spin box with the default TQRangeControl range and - step values. It is called \a name and has parent \a parent. - - \sa minValue(), maxValue(), setRange(), lineStep(), setSteps() -*/ - -TQSpinBox::TQSpinBox( TQWidget * parent , const char *name ) - : TQWidget( parent, name, WNoAutoErase ), - TQRangeControl() -{ - initSpinBox(); -} - - -/*! - Constructs a spin box that allows values from \a minValue to \a - maxValue inclusive, with step amount \a step. The value is - initially set to \a minValue. - - The spin box is called \a name and has parent \a parent. - - \sa minValue(), maxValue(), setRange(), lineStep(), setSteps() -*/ - -TQSpinBox::TQSpinBox( int minValue, int maxValue, int step, TQWidget* parent, - const char* name ) - : TQWidget( parent, name, WNoAutoErase ), - TQRangeControl( minValue, maxValue, step, step, minValue ) -{ - initSpinBox(); -} - -/* - \internal Initialization. -*/ - -void TQSpinBox::initSpinBox() -{ - d = new TQSpinBoxPrivate; - - d->controls = new TQSpinWidget( this, "controls" ); - connect( d->controls, TQ_SIGNAL( stepUpPressed() ), TQ_SLOT( stepUp() ) ); - connect( d->controls, TQ_SIGNAL( stepDownPressed() ), TQ_SLOT( stepDown() ) ); - - wrap = FALSE; - edited = FALSE; - d->selreq = FALSE; - - validate = new TQSpinBoxValidator( this, "validator" ); - vi = new TQLineEdit( this, "qt_spinbox_edit" ); - d->controls->setEditWidget( vi ); - vi->setValidator( validate ); - vi->installEventFilter( this ); - vi->setFrame( FALSE ); - setFocusProxy( vi ); - - setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) ); - setBackgroundMode( PaletteBackground, PaletteBase ); - - updateDisplay(); - - connect( vi, TQ_SIGNAL(textChanged(const TQString&)), TQ_SLOT(textChanged()) ); -} - -/*! - Destroys the spin box, freeing all memory and other resources. -*/ - -TQSpinBox::~TQSpinBox() -{ - delete d; -} - - -/*! - \property TQSpinBox::text - \brief the spin box's text, including any prefix() and suffix() - - There is no default text. - - \sa value() -*/ - -TQString TQSpinBox::text() const -{ - return vi->text(); -} - - - -/*! - \property TQSpinBox::cleanText - \brief the spin box's text with no prefix(), suffix() or leading - or trailing whitespace. - - \sa text, prefix, suffix -*/ - -TQString TQSpinBox::cleanText() const -{ - TQString s = TQString(text()).stripWhiteSpace(); - if ( !prefix().isEmpty() ) { - TQString px = TQString(prefix()).stripWhiteSpace(); - int len = px.length(); - if ( len && s.left(len) == px ) // Remove _only_ if it is the prefix - s.remove( (uint)0, len ); - } - if ( !suffix().isEmpty() ) { - TQString sx = TQString(suffix()).stripWhiteSpace(); - int len = sx.length(); - if ( len && s.right(len) == sx ) // Remove _only_ if it is the suffix - s.truncate( s.length() - len ); - } - return s.stripWhiteSpace(); -} - - -/*! - \property TQSpinBox::specialValueText - \brief the special-value text - - If set, the spin box will display this text instead of a numeric - value whenever the current value is equal to minVal(). Typical use - is to indicate that this choice has a special (default) meaning. - - For example, if your spin box allows the user to choose the margin - width in a print dialog and your application is able to - automatically choose a good margin width, you can set up the spin - box like this: - \code - TQSpinBox marginBox( -1, 20, 1, parent, "marginBox" ); - marginBox->setSuffix( " mm" ); - marginBox->setSpecialValueText( "Auto" ); - \endcode - The user will then be able to choose a margin width from 0-20 - millimeters or select "Auto" to leave it to the application to - choose. Your code must then interpret the spin box value of -1 as - the user requesting automatic margin width. - - All values are displayed with the prefix() and suffix() (if set), - \e except for the special value, which only shows the special - value text. - - To turn off the special-value text display, call this function - with an empty string. The default is no special-value text, i.e. - the numeric value is shown as usual. - - If no special-value text is set, specialValueText() returns - TQString::null. -*/ - -void TQSpinBox::setSpecialValueText( const TQString &text ) -{ - specText = text; - updateDisplay(); -} - - -TQString TQSpinBox::specialValueText() const -{ - if ( specText.isEmpty() ) - return TQString::null; - else - return specText; -} - - -/*! - \property TQSpinBox::prefix - \brief the spin box's prefix - - The prefix is prepended to the start of the displayed value. - Typical use is to display a unit of measurement or a currency - symbol. For example: - - \code - sb->setPrefix( "$" ); - \endcode - - To turn off the prefix display, set this property to an empty - string. The default is no prefix. The prefix is not displayed for - the minValue() if specialValueText() is not empty. - - If no prefix is set, prefix() returns TQString::null. - - \sa suffix() -*/ - -void TQSpinBox::setPrefix( const TQString &text ) -{ - pfix = text; - updateDisplay(); -} - - -TQString TQSpinBox::prefix() const -{ - if ( pfix.isEmpty() ) - return TQString::null; - else - return pfix; -} - - -/*! - \property TQSpinBox::suffix - \brief the suffix of the spin box - - The suffix is appended to the end of the displayed value. Typical - use is to display a unit of measurement or a currency symbol. For - example: - - \code - sb->setSuffix( " km" ); - \endcode - - To turn off the suffix display, set this property to an empty - string. The default is no suffix. The suffix is not displayed for - the minValue() if specialValueText() is not empty. - - If no suffix is set, suffix() returns a TQString::null. - - \sa prefix() -*/ - -void TQSpinBox::setSuffix( const TQString &text ) -{ - sfix = text; - updateDisplay(); -} - -TQString TQSpinBox::suffix() const -{ - if ( sfix.isEmpty() ) - return TQString::null; - else - return sfix; -} - - -/*! - \property TQSpinBox::wrapping - \brief whether it is possible to step the value from the highest - value to the lowest value and vice versa - - By default, wrapping is turned off. - - If you have a range of 0..100 and wrapping is off when the user - reaches 100 and presses the Up Arrow nothing will happen; but if - wrapping is on the value will change from 100 to 0, then to 1, - etc. When wrapping is on, navigating past the highest value takes - you to the lowest and vice versa. - - \sa minValue, maxValue, setRange() -*/ - -void TQSpinBox::setWrapping( bool on ) -{ - wrap = on; - updateDisplay(); -} - -bool TQSpinBox::wrapping() const -{ - return wrap; -} - -/*! - \reimp -*/ -TQSize TQSpinBox::sizeHint() const -{ - constPolish(); - TQSize sz = vi->sizeHint(); - int h = sz.height(); - TQFontMetrics fm( font() ); - int w = 35; - int wx = fm.width( ' ' )*2; - TQString s; - s = prefix() + ( (TQSpinBox*)this )->mapValueToText( minValue() ) + suffix(); - w = TQMAX( w, fm.width( s ) + wx); - s = prefix() + ( (TQSpinBox*)this )->mapValueToText( maxValue() ) + suffix(); - w = TQMAX(w, fm.width( s ) + wx ); - if ( !specialValueText().isEmpty() ) { - s = specialValueText(); - w = TQMAX( w, fm.width( s ) + wx ); - } - return style().sizeFromContents(TQStyle::CT_SpinBox, this, - TQSize( w + d->controls->downRect().width(), - h + style().pixelMetric( TQStyle::PM_DefaultFrameWidth ) * 2). - expandedTo( TQApplication::globalStrut() )); -} - - -/*! - \reimp -*/ -TQSize TQSpinBox::minimumSizeHint() const -{ - int w = vi->minimumSizeHint().width() + d->controls->downRect().width(); - int h = TQMAX( vi->minimumSizeHint().height(), d->controls->minimumSizeHint().height() ); - return TQSize( w, h ); -} - -// Does the layout of the lineedit and the buttons - -void TQSpinBox::arrangeWidgets() -{ - d->controls->arrange(); -} - -/*! - \property TQSpinBox::value - \brief the value of the spin box - - \sa TQRangeControl::setValue() -*/ - -void TQSpinBox::setValue( int value ) -{ - edited = FALSE; // we ignore anything entered and not yet interpreted - TQRangeControl::setValue( value ); - updateDisplay(); -} - -int TQSpinBox::value() const -{ - TQSpinBox * that = (TQSpinBox *) this; - if ( edited ) { - that->edited = FALSE; // avoid recursion - that->interpretText(); - } - return TQRangeControl::value(); -} - - -/*! - Increases the spin box's value by one lineStep(), wrapping as - necessary if wrapping() is TRUE. This is the same as clicking on - the pointing-up button and can be used for keyboard accelerators, - for example. - - \sa stepDown(), addLine(), lineStep(), setSteps(), setValue(), value() -*/ - -void TQSpinBox::stepUp() -{ - if ( edited ) - interpretText(); - if ( wrapping() && ( value()+lineStep() > maxValue() || sumOutOfRange(value(), lineStep() ) ) ) { - setValue( minValue() ); - } else { - addLine(); - } -} - - -/*! - Decreases the spin box's value one lineStep(), wrapping as - necessary if wrapping() is TRUE. This is the same as clicking on - the pointing-down button and can be used for keyboard - accelerators, for example. - - \sa stepUp(), subtractLine(), lineStep(), setSteps(), setValue(), value() -*/ - -void TQSpinBox::stepDown() -{ - if ( edited ) - interpretText(); - if ( wrapping() && ( value()-lineStep() < minValue() || sumOutOfRange(value(), -lineStep() ) ) ) { - setValue( maxValue() ); - } else { - subtractLine(); - } -} - - -/*! - \fn void TQSpinBox::valueChanged( int value ) - - This signal is emitted every time the value of the spin box - changes; the new value is passed in \a value. This signal will be - emitted as a result of a call to setValue(), or because the user - changed the value by using a keyboard accelerator or mouse click, - etc. - - Note that the valueChanged() signal is emitted \e every time, not - just for the "last" step; i.e. if the user clicks "up" three - times, this signal is emitted three times. - - \sa value() -*/ - - -/*! - \fn void TQSpinBox::valueChanged( const TQString& valueText ) - - \overload - - This signal is emitted whenever the valueChanged( int ) signal is - emitted, i.e. every time the value of the spin box changes - (whatever the cause, e.g. by setValue(), by a keyboard - accelerator, by mouse clicks, etc.). - - The \a valueText parameter is the same string that is displayed in - the edit field of the spin box. - - \sa value() prefix() suffix() specialValueText() -*/ - - - -/*! - Intercepts and handles the events coming to the embedded TQLineEdit - that have special meaning for the TQSpinBox. The object is passed - as \a o and the event is passed as \a ev. -*/ - -bool TQSpinBox::eventFilter( TQObject* o, TQEvent* ev ) -{ - if (o != vi) - return TQWidget::eventFilter(o,ev); - - if ( ev->type() == TQEvent::KeyPress ) { - TQKeyEvent* k = (TQKeyEvent*)ev; - - bool retval = FALSE; // workaround for MSVC++ optimization bug - if( (k->key() == Key_Tab) || (k->key() == Key_BackTab) ){ - if ( k->state() & TQt::ControlButton ) - return FALSE; - if ( edited ) - interpretText(); - tqApp->sendEvent( this, ev ); - retval = TRUE; - } if ( k->key() == Key_Up ) { - stepUp(); - retval = TRUE; - } else if ( k->key() == Key_Down ) { - stepDown(); - retval = TRUE; - } else if ( k->key() == Key_Enter || k->key() == Key_Return ) { - interpretText(); - return FALSE; - } - if ( retval ) - return retval; - } else if ( ev->type() == TQEvent::FocusOut || ev->type() == TQEvent::Hide ) { - if ( edited ) { - interpretText(); - } - return FALSE; - } - return FALSE; -} - -/*! - \reimp - */ -void TQSpinBox::setEnabled( bool enabled ) -{ - TQWidget::setEnabled( enabled ); - updateDisplay(); -} - -/*! - \reimp -*/ -void TQSpinBox::leaveEvent( TQEvent* ) -{ -} - - -/*! - \reimp -*/ -void TQSpinBox::resizeEvent( TQResizeEvent* ) -{ - d->controls->resize( width(), height() ); -} - -/*! - \reimp -*/ -#ifndef TQT_NO_WHEELEVENT -void TQSpinBox::wheelEvent( TQWheelEvent * e ) -{ - e->accept(); - static float offset = 0; - static TQSpinBox* offset_owner = 0; - if (offset_owner != this) { - offset_owner = this; - offset = 0; - } - offset += -e->delta()/120; - if (TQABS(offset) < 1) - return; - int ioff = int(offset); - int i; - for (i=0; i 0 ? stepDown() : stepUp(); - offset -= ioff; -} -#endif - -/*! - This virtual function is called by TQRangeControl whenever the - value has changed. The TQSpinBox reimplementation updates the - display and emits the valueChanged() signals; if you need - additional processing, either reimplement this or connect to one - of the valueChanged() signals. -*/ - -void TQSpinBox::valueChange() -{ - d->selreq = hasFocus(); - updateDisplay(); - d->selreq = FALSE; - emit valueChanged( value() ); - emit valueChanged( currentValueText() ); -#if defined(QT_ACCESSIBILITY_SUPPORT) - TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); -#endif -} - - -/*! - This virtual function is called by TQRangeControl whenever the - range has changed. It adjusts the default validator and updates - the display; if you need additional processing, you can - reimplement this function. -*/ - -void TQSpinBox::rangeChange() -{ - updateDisplay(); -} - - -/*! - Sets the validator to \a v. The validator controls what keyboard - input is accepted when the user is editing in the value field. The - default is to use a suitable TQIntValidator. - - Use setValidator(0) to turn off input validation (entered input - will still be kept within the spin box's range). -*/ - -void TQSpinBox::setValidator( const TQValidator* v ) -{ - if ( vi ) - vi->setValidator( v ); -} - - -/*! - Returns the validator that constrains editing for this spin box if - there is any; otherwise returns 0. - - \sa setValidator() TQValidator -*/ - -const TQValidator * TQSpinBox::validator() const -{ - return vi ? vi->validator() : 0; -} - -/*! - Updates the contents of the embedded TQLineEdit to reflect the - current value using mapValueToText(). Also enables/disables the - up/down push buttons accordingly. - - \sa mapValueToText() -*/ -void TQSpinBox::updateDisplay() -{ - vi->setUpdatesEnabled( FALSE ); - vi->setText( currentValueText() ); - if ( d->selreq && isVisible() && ( hasFocus() || vi->hasFocus() ) ) { - selectAll(); - } else { - if ( !suffix().isEmpty() && vi->text().endsWith(suffix()) ) - vi->setCursorPosition( vi->text().length() - suffix().length() ); - } - vi->setUpdatesEnabled( TRUE ); - vi->repaint( FALSE ); // immediate repaint needed for some reason - edited = FALSE; - - bool upEnabled = isEnabled() && ( wrapping() || value() < maxValue() ); - bool downEnabled = isEnabled() && ( wrapping() || value() > minValue() ); - - d->controls->setUpEnabled( upEnabled ); - d->controls->setDownEnabled( downEnabled ); - vi->setEnabled( isEnabled() ); - repaint( FALSE ); -} - - -/*! - TQSpinBox calls this after the user has manually edited the - contents of the spin box (i.e. by typing in the embedded - TQLineEdit, rather than using the up/down buttons/keys). - - The default implementation of this function interprets the new - text using mapTextToValue(). If mapTextToValue() is successful, it - changes the spin box's value; if not, the value is left unchanged. - - \sa editor() -*/ - -void TQSpinBox::interpretText() -{ - bool ok = TRUE; - bool done = FALSE; - int newVal = 0; - if ( !specialValueText().isEmpty() ) { - TQString s = text().stripWhiteSpace(); - TQString t = specialValueText().stripWhiteSpace(); - if ( s == t ) { - newVal = minValue(); - done = TRUE; - } - } - if ( !done ) - newVal = mapTextToValue( &ok ); - if ( ok ) - setValue( newVal ); - updateDisplay(); // sometimes redundant -} - - -/*! - Returns the geometry of the "up" button. -*/ - -TQRect TQSpinBox::upRect() const -{ - return d->controls->upRect(); -} - - -/*! - Returns the geometry of the "down" button. -*/ - -TQRect TQSpinBox::downRect() const -{ - return d->controls->downRect(); -} - - -/*! - Returns a pointer to the embedded TQLineEdit. -*/ - -TQLineEdit* TQSpinBox::editor() const -{ - return vi; -} - - -/*! - This slot is called whenever the user edits the spin box's text. -*/ - -void TQSpinBox::textChanged() -{ - edited = TRUE; // this flag is cleared in updateDisplay() -} - - -/*! - This virtual function is used by the spin box whenever it needs to - display value \a v. The default implementation returns a string - containing \a v printed in the standard way. Reimplementations may - return anything. (See the example in the detailed description.) - - Note that TQt does not call this function for specialValueText() - and that neither prefix() nor suffix() are included in the return - value. - - If you reimplement this, you may also need to reimplement - mapTextToValue(). - - \sa updateDisplay(), mapTextToValue() -*/ - -TQString TQSpinBox::mapValueToText( int v ) -{ - TQString s; - s.setNum( v ); - return s; -} - - -/*! - This virtual function is used by the spin box whenever it needs to - interpret text entered by the user as a value. The text is - available as text() and as cleanText(), and this function must - parse it if possible. If \a ok is not 0: if it parses the text - successfully, \a *ok is set to TRUE; otherwise \a *ok is set to - FALSE. - - Subclasses that need to display spin box values in a non-numeric - way need to reimplement this function. - - Note that TQt handles specialValueText() separately; this function - is only concerned with the other values. - - The default implementation tries to interpret the text() as an - integer in the standard way and returns the integer value. - - \sa interpretText(), mapValueToText() -*/ - -int TQSpinBox::mapTextToValue( bool* ok ) -{ - TQString s = text(); - int newVal = s.toInt( ok ); - if ( !(*ok) && !( !prefix() && !suffix() ) ) {// Try removing any pre/suffix - s = cleanText(); - newVal = s.toInt( ok ); - } - return newVal; -} - - -/*! - Returns the full text calculated from the current value, including - any prefix and suffix. If there is special value text and the - value is minValue() the specialValueText() is returned. -*/ - -TQString TQSpinBox::currentValueText() -{ - TQString s; - if ( (value() == minValue()) && !specialValueText().isEmpty() ) { - s = specialValueText(); - } else { - s = prefix(); - s.append( mapValueToText( value() ) ); - s.append( suffix() ); - } - return s; -} - -/*! - \reimp -*/ - -void TQSpinBox::styleChange( TQStyle& old ) -{ - arrangeWidgets(); - TQWidget::styleChange( old ); -} - - -/*! - \enum TQSpinBox::ButtonSymbols - - This enum type determines what the buttons in a spin box show. - - \value UpDownArrows the buttons show little arrows in the classic - style. - - \value PlusMinus the buttons show + and - symbols. - - \sa TQSpinBox::buttonSymbols -*/ - -/*! - \property TQSpinBox::buttonSymbols - - \brief the current button symbol mode - - The possible values can be either \c UpDownArrows or \c PlusMinus. - The default is \c UpDownArrows. - - \sa ButtonSymbols -*/ - -void TQSpinBox::setButtonSymbols( ButtonSymbols newSymbols ) -{ - if ( buttonSymbols() == newSymbols ) - return; - - switch ( newSymbols ) { - case UpDownArrows: - d->controls->setButtonSymbols( TQSpinWidget::UpDownArrows ); - break; - case PlusMinus: - d->controls->setButtonSymbols( TQSpinWidget::PlusMinus ); - break; - } - // repaint( FALSE ); -} - -TQSpinBox::ButtonSymbols TQSpinBox::buttonSymbols() const -{ - switch( d->controls->buttonSymbols() ) { - case TQSpinWidget::UpDownArrows: - return UpDownArrows; - case TQSpinWidget::PlusMinus: - return PlusMinus; - } - return UpDownArrows; -} - -/*! - \property TQSpinBox::minValue - - \brief the minimum value of the spin box - - When setting this property, \l TQSpinBox::maxValue is adjusted, if - necessary, to ensure that the range remains valid. - - \sa setRange() setSpecialValueText() -*/ - -int TQSpinBox::minValue() const -{ - return TQRangeControl::minValue(); -} - -void TQSpinBox::setMinValue( int minVal ) -{ - TQRangeControl::setMinValue( minVal ); -} - -/*! - \property TQSpinBox::maxValue - \brief the maximum value of the spin box - - When setting this property, \l TQSpinBox::minValue is adjusted, if - necessary, to ensure that the range remains valid. - - \sa setRange() setSpecialValueText() -*/ - -int TQSpinBox::maxValue() const -{ - return TQRangeControl::maxValue(); -} - -void TQSpinBox::setMaxValue( int maxVal ) -{ - TQRangeControl::setMaxValue( maxVal ); -} - -/*! - \property TQSpinBox::lineStep - \brief the line step - - When the user uses the arrows to change the spin box's value the - value will be incremented/decremented by the amount of the line - step. - - The setLineStep() function calls the virtual stepChange() function - if the new line step is different from the previous setting. - - \sa TQRangeControl::setSteps() setRange() -*/ - -int TQSpinBox::lineStep() const -{ - return TQRangeControl::lineStep(); -} - -void TQSpinBox::setLineStep( int i ) -{ - setSteps( i, pageStep() ); -} - -/*! - Selects all the text in the spin box's editor. -*/ - -void TQSpinBox::selectAll() -{ - int overhead = prefix().length() + suffix().length(); - if ( !overhead || currentValueText() == specialValueText() ) { - vi->selectAll(); - } else { - vi->setSelection( prefix().length(), vi->text().length() - overhead ); - } -} - -#endif diff --git a/src/widgets/qspinwidget.cpp b/src/widgets/qspinwidget.cpp deleted file mode 100644 index c5b237d41..000000000 --- a/src/widgets/qspinwidget.cpp +++ /dev/null @@ -1,467 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQSpinWidget class -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the widgets module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial licenses may use this file in accordance with the TQt -** Commercial License Agreement provided with the Software. -** -** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, -** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqrangecontrol.h" - -#ifndef TQT_NO_SPINWIDGET - -#include "tqrect.h" -#include "tqtimer.h" -#include "tqstyle.h" -#include "tqpainter.h" - -class TQSpinWidgetPrivate -{ -public: - TQSpinWidgetPrivate() - : upEnabled( TRUE ), - downEnabled( TRUE ), - theButton( 0 ), - buttonDown( 0 ), - timerUp( 0 ), - bsyms( TQSpinWidget::UpDownArrows ), - ed ( 0 ) {} - uint upEnabled :1; - uint downEnabled :1; - uint theButton :2; - uint buttonDown :2; - uint timerUp : 1; - TQRect up; - TQRect down; - TQTimer auRepTimer; - TQSpinWidget::ButtonSymbols bsyms; - TQWidget *ed; - void startTimer( int msec ) { auRepTimer.start( msec, TRUE ); } - void startTimer( bool up, int msec ) { timerUp = up; startTimer( msec ); } - void stopTimer() { auRepTimer.stop(); } -}; - -/*! - - \class TQSpinWidget qspinwidget.h - \brief The TQSpinWidget class is an internal range control related class. - - \internal - - Constructs an empty range control widget with parent \a parent - called \a name. - -*/ - -TQSpinWidget::TQSpinWidget( TQWidget* parent, const char* name ) - : TQWidget( parent, name ) -{ - d = new TQSpinWidgetPrivate(); - connect( &d->auRepTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( timerDone() ) ); - setFocusPolicy( StrongFocus ); - - arrange(); - updateDisplay(); -} - - -/*! Destroys the object and frees any allocated resources. - -*/ - -TQSpinWidget::~TQSpinWidget() -{ - delete d; -} - -/*! */ -TQWidget * TQSpinWidget::editWidget() -{ - return d->ed; -} - -/*! - Sets the editing widget to \a w. -*/ -void TQSpinWidget::setEditWidget( TQWidget * w ) -{ - if ( w ) { - if (w->parentWidget() != this) - w->reparent( this, TQPoint( 0, 0 ) ); - setFocusProxy( w ); - } - d->ed = w; - arrange(); - updateDisplay(); -} - -/*! \reimp - -*/ - -void TQSpinWidget::mousePressEvent( TQMouseEvent *e ) -{ - if ( e->button() != LeftButton ) { - d->stopTimer(); - d->buttonDown = 0; - d->theButton = 0; - repaint( d->down.unite( d->up ), FALSE ); - return; - } - - uint oldButtonDown = d->buttonDown; - - if ( d->down.contains( e->pos() ) && d->downEnabled ) - d->buttonDown = 1; - else if ( d->up.contains( e->pos() ) && d->upEnabled ) - d->buttonDown = 2; - else - d->buttonDown = 0; - - d->theButton = d->buttonDown; - if ( oldButtonDown != d->buttonDown ) { - if ( !d->buttonDown ) { - repaint( d->down.unite( d->up ), FALSE ); - } else if ( d->buttonDown & 1 ) { - repaint( d->down, FALSE ); - stepDown(); - d->startTimer( FALSE, 300 ); - } else if ( d->buttonDown & 2 ) { - repaint( d->up, FALSE ); - stepUp(); - d->startTimer( TRUE, 300 ); - } - } -} - -/*! - -*/ - -void TQSpinWidget::arrange() -{ - d->up = TQStyle::visualRect( style().querySubControlMetrics( TQStyle::CC_SpinWidget, this, - TQStyle::SC_SpinWidgetUp ), this ); - d->down = TQStyle::visualRect( style().querySubControlMetrics( TQStyle::CC_SpinWidget, this, - TQStyle::SC_SpinWidgetDown ), this ); - if ( d->ed ) { - TQRect r = TQStyle::visualRect( style().querySubControlMetrics( TQStyle::CC_SpinWidget, this, - TQStyle::SC_SpinWidgetEditField ), this ); - d->ed->setGeometry( r ); - } -} - -/*! - -*/ - -void TQSpinWidget::stepUp() -{ - emit stepUpPressed(); -} - -void TQSpinWidget::resizeEvent( TQResizeEvent* ) -{ - arrange(); -} - -/*! - -*/ - -void TQSpinWidget::stepDown() -{ - emit stepDownPressed(); -} - - -void TQSpinWidget::timerDone() -{ - // we use a double timer to make it possible for users to do - // something with 0-timer on valueChanged. - TQTimer::singleShot( 1, this, TQ_SLOT( timerDoneEx() ) ); -} - -void TQSpinWidget::timerDoneEx() -{ - if ( !d->buttonDown ) - return; - if ( d->timerUp ) - stepUp(); - else - stepDown(); - d->startTimer( 100 ); -} - - -void TQSpinWidget::windowActivationChange( bool oldActive ) -{ - //was active, but lost focus - if ( oldActive && d->buttonDown ) { - d->stopTimer(); - d->buttonDown = 0; - d->theButton = 0; - } - TQWidget::windowActivationChange( oldActive ); -} - - - -/*! - The event is passed in \a e. -*/ - -void TQSpinWidget::mouseReleaseEvent( TQMouseEvent *e ) -{ - if ( e->button() != LeftButton ) - return; - - uint oldButtonDown = d->theButton; - d->theButton = 0; - if ( oldButtonDown != d->theButton ) { - if ( oldButtonDown & 1 ) - repaint( d->down, FALSE ); - else if ( oldButtonDown & 2 ) - repaint( d->up, FALSE ); - } - d->stopTimer(); - d->buttonDown = 0; -} - - -/*! - The event is passed in \a e. -*/ - -void TQSpinWidget::mouseMoveEvent( TQMouseEvent *e ) -{ - if ( !(e->state() & LeftButton ) ) - return; - - uint oldButtonDown = d->theButton; - if ( oldButtonDown & 1 && !d->down.contains( e->pos() ) ) { - d->stopTimer(); - d->theButton = 0; - repaint( d->down, FALSE ); - } else if ( oldButtonDown & 2 && !d->up.contains( e->pos() ) ) { - d->stopTimer(); - d->theButton = 0; - repaint( d->up, FALSE ); - } else if ( !oldButtonDown && d->up.contains( e->pos() ) && d->buttonDown & 2 ) { - d->startTimer( 500 ); - d->theButton = 2; - repaint( d->up, FALSE ); - } else if ( !oldButtonDown && d->down.contains( e->pos() ) && d->buttonDown & 1 ) { - d->startTimer( 500 ); - d->theButton = 1; - repaint( d->down, FALSE ); - } -} - - -/*! - The event is passed in \a e. -*/ -#ifndef TQT_NO_WHEELEVENT -void TQSpinWidget::wheelEvent( TQWheelEvent *e ) -{ - e->accept(); - static float offset = 0; - static TQSpinWidget* offset_owner = 0; - if ( offset_owner != this ) { - offset_owner = this; - offset = 0; - } - offset += -e->delta()/120; - if ( TQABS( offset ) < 1 ) - return; - int ioff = int(offset); - int i; - for( i=0; i < TQABS( ioff ); i++ ) - offset > 0 ? stepDown() : stepUp(); - offset -= ioff; -} -#endif - -/*! - -*/ -void TQSpinWidget::paintEvent( TQPaintEvent * ) -{ - TQPainter p( this ); - - TQStyle::SFlags flags = TQStyle::Style_Default; - if (isEnabled()) - flags |= TQStyle::Style_Enabled; - if (hasMouse()) - flags |= TQStyle::Style_MouseOver; - if (hasFocus() || (focusProxy() && focusProxy()->hasFocus())) - flags |= TQStyle::Style_HasFocus; - - TQStyle::SCFlags active; - if ( d->theButton & 1 ) - active = TQStyle::SC_SpinWidgetDown; - else if ( d->theButton & 2 ) - active = TQStyle::SC_SpinWidgetUp; - else - active = TQStyle::SC_None; - - TQRect fr = TQStyle::visualRect( - style().querySubControlMetrics( TQStyle::CC_SpinWidget, this, - TQStyle::SC_SpinWidgetFrame ), this ); - style().drawComplexControl( TQStyle::CC_SpinWidget, &p, this, - fr, colorGroup(), - flags, - (uint)TQStyle::SC_All, - active ); -} - - -/*! - The previous style is passed in \a old. -*/ - -void TQSpinWidget::styleChange( TQStyle& old ) -{ - arrange(); - TQWidget::styleChange( old ); -} - -/*! -*/ - -TQRect TQSpinWidget::upRect() const -{ - return d->up; -} - -/*! -*/ - -TQRect TQSpinWidget::downRect() const -{ - return d->down; -} - -/*! -*/ - -void TQSpinWidget::updateDisplay() -{ - if ( !isEnabled() ) { - d->upEnabled = FALSE; - d->downEnabled = FALSE; - } - if ( d->theButton & 1 && ( d->downEnabled ) == 0 ) { - d->theButton &= ~1; - d->buttonDown &= ~1; - } - - if ( d->theButton & 2 && ( d->upEnabled ) == 0 ) { - d->theButton &= ~2; - d->buttonDown &= ~2; - } - repaint( FALSE ); -} - - -/*! - The previous enabled state is passed in \a old. -*/ - -void TQSpinWidget::enableChanged( bool ) -{ - d->upEnabled = isEnabled(); - d->downEnabled = isEnabled(); - updateDisplay(); -} - - -/*! - Sets up-enabled to \a on. -*/ - -void TQSpinWidget::setUpEnabled( bool on ) -{ - if ( (bool)d->upEnabled != on ) { - d->upEnabled = on; - updateDisplay(); - } -} - -/*! -*/ - -bool TQSpinWidget::isUpEnabled() const -{ - return d->upEnabled; -} - -/*! - Sets down-enabled to \a on. -*/ - -void TQSpinWidget::setDownEnabled( bool on ) -{ - if ( (bool)d->downEnabled != on ) { - d->downEnabled = on; - updateDisplay(); - } -} - -/*! -*/ - -bool TQSpinWidget::isDownEnabled() const -{ - return d->downEnabled; -} - -/*! - Sets the button symbol to \a bs. -*/ - -void TQSpinWidget::setButtonSymbols( ButtonSymbols bs ) -{ - d->bsyms = bs; -} - -/*! -*/ - -TQSpinWidget::ButtonSymbols TQSpinWidget::buttonSymbols() const -{ - return d->bsyms; -} - -#endif diff --git a/src/widgets/qt_widgets.pri b/src/widgets/qt_widgets.pri index 876cc428c..72cfdba84 100644 --- a/src/widgets/qt_widgets.pri +++ b/src/widgets/qt_widgets.pri @@ -5,11 +5,11 @@ widgets { HEADERS += $$WIDGETS_H/ntqbuttongroup.h \ $$WIDGETS_H/ntqbutton.h \ - $$WIDGETS_P/qdialogbuttons_p.h \ - $$WIDGETS_H/ntqcheckbox.h \ - $$WIDGETS_H/ntqcombobox.h \ + $$WIDGETS_P/tqdialogbuttons_p.h \ + $$WIDGETS_H/tqcheckbox.h \ + $$WIDGETS_H/tqcombobox.h \ $$WIDGETS_P/tqwidgetresizehandler_p.h \ - $$WIDGETS_H/ntqdial.h \ + $$WIDGETS_H/tqdial.h \ $$WIDGETS_H/ntqdockarea.h \ $$WIDGETS_H/ntqdockwindow.h \ $$WIDGETS_H/ntqframe.h \ @@ -22,8 +22,8 @@ widgets { $$WIDGETS_H/ntqhbox.h \ $$WIDGETS_H/tqiconview.h \ $$WIDGETS_H/tqlabel.h \ - $$WIDGETS_H/ntqlcdnumber.h \ - $$WIDGETS_H/ntqlineedit.h \ + $$WIDGETS_H/tqlcdnumber.h \ + $$WIDGETS_H/tqlineedit.h \ $$WIDGETS_H/ntqlistbox.h \ $$WIDGETS_H/ntqlistview.h \ $$WIDGETS_H/tqmainwindow.h \ @@ -32,14 +32,14 @@ widgets { $$WIDGETS_H/ntqmultilineedit.h \ $$WIDGETS_H/tqpopupmenu.h \ $$WIDGETS_H/ntqprogressbar.h \ - $$WIDGETS_H/ntqpushbutton.h \ - $$WIDGETS_H/ntqradiobutton.h \ + $$WIDGETS_H/tqpushbutton.h \ + $$WIDGETS_H/tqradiobutton.h \ $$WIDGETS_H/ntqrangecontrol.h \ - $$WIDGETS_H/ntqscrollbar.h \ - $$WIDGETS_H/ntqscrollview.h \ - $$WIDGETS_H/ntqslider.h \ + $$WIDGETS_H/tqscrollbar.h \ + $$WIDGETS_H/tqscrollview.h \ + $$WIDGETS_H/tqslider.h \ $$WIDGETS_H/ntqsplashscreen.h \ - $$WIDGETS_H/ntqspinbox.h \ + $$WIDGETS_H/tqspinbox.h \ $$WIDGETS_H/ntqsplitter.h \ $$WIDGETS_H/tqstatusbar.h \ $$WIDGETS_H/ntqtabbar.h \ @@ -67,11 +67,11 @@ widgets { SOURCES += $$WIDGETS_CPP/qbuttongroup.cpp \ $$WIDGETS_CPP/qbutton.cpp \ - $$WIDGETS_CPP/qdialogbuttons.cpp \ - $$WIDGETS_CPP/qcheckbox.cpp \ - $$WIDGETS_CPP/qcombobox.cpp \ + $$WIDGETS_CPP/tqdialogbuttons.cpp \ + $$WIDGETS_CPP/tqcheckbox.cpp \ + $$WIDGETS_CPP/tqcombobox.cpp \ $$WIDGETS_CPP/tqwidgetresizehandler.cpp \ - $$WIDGETS_CPP/qdial.cpp \ + $$WIDGETS_CPP/tqdial.cpp \ $$WIDGETS_CPP/qdockarea.cpp \ $$WIDGETS_CPP/qdockwindow.cpp \ $$WIDGETS_CPP/qframe.cpp \ @@ -84,8 +84,8 @@ widgets { $$WIDGETS_CPP/qhbox.cpp \ $$WIDGETS_CPP/tqiconview.cpp \ $$WIDGETS_CPP/tqlabel.cpp \ - $$WIDGETS_CPP/qlcdnumber.cpp \ - $$WIDGETS_CPP/qlineedit.cpp \ + $$WIDGETS_CPP/tqlcdnumber.cpp \ + $$WIDGETS_CPP/tqlineedit.cpp \ $$WIDGETS_CPP/qlistbox.cpp \ $$WIDGETS_CPP/qlistview.cpp \ $$WIDGETS_CPP/tqmainwindow.cpp \ @@ -94,15 +94,15 @@ widgets { $$WIDGETS_CPP/qmultilineedit.cpp \ $$WIDGETS_CPP/tqpopupmenu.cpp \ $$WIDGETS_CPP/qprogressbar.cpp \ - $$WIDGETS_CPP/qpushbutton.cpp \ - $$WIDGETS_CPP/qradiobutton.cpp \ + $$WIDGETS_CPP/tqpushbutton.cpp \ + $$WIDGETS_CPP/tqradiobutton.cpp \ $$WIDGETS_CPP/qrangecontrol.cpp \ - $$WIDGETS_CPP/qscrollbar.cpp \ - $$WIDGETS_CPP/qscrollview.cpp \ - $$WIDGETS_CPP/qslider.cpp \ + $$WIDGETS_CPP/tqscrollbar.cpp \ + $$WIDGETS_CPP/tqscrollview.cpp \ + $$WIDGETS_CPP/tqslider.cpp \ $$WIDGETS_CPP/qsplashscreen.cpp \ - $$WIDGETS_CPP/qspinbox.cpp \ - $$WIDGETS_CPP/qspinwidget.cpp \ + $$WIDGETS_CPP/tqspinbox.cpp \ + $$WIDGETS_CPP/tqspinwidget.cpp \ $$WIDGETS_CPP/qsplitter.cpp \ $$WIDGETS_CPP/tqstatusbar.cpp \ $$WIDGETS_CPP/tqsyntaxhighlighter.cpp \ diff --git a/src/widgets/tqaction.cpp b/src/widgets/tqaction.cpp index 31d308420..a7e5c0e58 100644 --- a/src/widgets/tqaction.cpp +++ b/src/widgets/tqaction.cpp @@ -45,7 +45,7 @@ #include "tqpopupmenu.h" #include "ntqaccel.h" #include "tqtoolbutton.h" -#include "ntqcombobox.h" +#include "tqcombobox.h" #include "tqtooltip.h" #include "tqwhatsthis.h" #include "tqstatusbar.h" diff --git a/src/widgets/tqcheckbox.cpp b/src/widgets/tqcheckbox.cpp new file mode 100644 index 000000000..a9cf27d0d --- /dev/null +++ b/src/widgets/tqcheckbox.cpp @@ -0,0 +1,364 @@ +/**************************************************************************** +** +** Implementation of TQCheckBox class +** +** Created : 940222 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqcheckbox.h" +#ifndef TQT_NO_CHECKBOX +#include "tqpainter.h" +#include "ntqdrawutil.h" +#include "tqpixmap.h" +#include "tqpixmapcache.h" +#include "tqbitmap.h" +#include "tqtextstream.h" +#include "ntqapplication.h" +#include "tqstyle.h" + +/*! + \class TQCheckBox tqcheckbox.h + \brief The TQCheckBox widget provides a checkbox with a text label. + + \ingroup basic + \mainclass + + TQCheckBox and TQRadioButton are both option buttons. That is, they + can be switched on (checked) or off (unchecked). The classes + differ in how the choices for the user are restricted. Radio + buttons define a "one of many" choice, whereas checkboxes provide + "many of many" choices. + + A TQButtonGroup can be used to group check buttons visually. + + Whenever a checkbox is checked or cleared it emits the signal + toggled(). Connect to this signal if you want to trigger an action + each time the checkbox changes state. You can use isChecked() to + query whether or not a checkbox is checked. + + \warning The toggled() signal can not be trusted for tristate + checkboxes. + + In addition to the usual checked and unchecked states, TQCheckBox + optionally provides a third state to indicate "no change". This + is useful whenever you need to give the user the option of neither + checking nor unchecking a checkbox. If you need this third state, + enable it with setTristate() and use state() to query the current + toggle state. When a tristate checkbox changes state, it emits the + stateChanged() signal. + + Just like TQPushButton, a checkbox can display text or a pixmap. + The text can be set in the constructor or with setText(); the + pixmap is set with setPixmap(). + + \important text(), setText(), text(), pixmap(), setPixmap(), + accel(), setAccel(), isToggleButton(), setDown(), isDown(), + isOn(), state(), autoRepeat(), isExclusiveToggle(), group(), + setAutoRepeat(), toggle(), pressed(), released(), clicked(), + toggled(), state() stateChanged() + + + + \sa TQButton TQRadioButton + \link guibooks.html#fowler Fowler: Check Box \endlink +*/ + +/*! + \property TQCheckBox::checked + \brief whether the checkbox is checked + + The default is unchecked, i.e. FALSE. +*/ + +/*! + \property TQCheckBox::autoMask + \brief whether the checkbox is automatically masked + + \sa TQWidget::setAutoMask() +*/ + +/*! + \property TQCheckBox::tristate + \brief whether the checkbox is a tri-state checkbox + + The default is two-state, i.e. tri-state is FALSE. +*/ + +/*! + Constructs a checkbox with no text. + + The \a parent and \a name arguments are sent to the TQWidget + constructor. +*/ + +TQCheckBox::TQCheckBox( TQWidget *parent, const char *name ) + : TQButton( parent, name, WNoAutoErase | WMouseNoMask ) +{ + setToggleButton( TRUE ); + setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) ); +} + +/*! + Constructs a checkbox with text \a text. + + The \a parent and \a name arguments are sent to the TQWidget + constructor. +*/ + +TQCheckBox::TQCheckBox( const TQString &text, TQWidget *parent, const char *name ) + : TQButton( parent, name, WNoAutoErase | WMouseNoMask ) +{ + setText( text ); + setToggleButton( TRUE ); + setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) ); +} + +/*! + Sets the checkbox to the "no change" state. + + \sa setTristate() +*/ +void TQCheckBox::setNoChange() +{ + setTristate(TRUE); + setState( NoChange ); +} + +void TQCheckBox::setTristate(bool y) +{ + setToggleType( y ? Tristate : Toggle ); +} + +bool TQCheckBox::isTristate() const +{ + return toggleType() == Tristate; +} + + +/*!\reimp +*/ +TQSize TQCheckBox::sizeHint() const +{ + // NB: TQRadioButton::sizeHint() is similar + constPolish(); + + TQPainter p(this); + TQSize sz = style().itemRect(&p, TQRect(0, 0, 1, 1), ShowPrefix, FALSE, + pixmap(), text()).size(); + + return (style().sizeFromContents(TQStyle::CT_CheckBox, this, sz). + expandedTo(TQApplication::globalStrut())); +} + + +/*!\reimp +*/ + +void TQCheckBox::drawButton( TQPainter *paint ) +{ + TQPainter *p = paint; + TQRect irect = TQStyle::visualRect( style().subRect(TQStyle::SR_CheckBoxIndicator, this), this ); + const TQColorGroup &cg = colorGroup(); + +#if !defined( TQT_NO_TEXTSTREAM ) && !defined( TQ_WS_MACX ) +# define SAVE_CHECKBOX_PIXMAPS +#endif +#if defined(SAVE_CHECKBOX_PIXMAPS) + TQString pmkey; // pixmap key + int kf = 0; + if ( isDown() ) + kf |= 1; + if ( isEnabled() ) + kf |= 2; + if ( hasFocus() ) + kf |= 4; // active vs. normal colorgroup + if( isActiveWindow() ) + kf |= 8; + if ( hasMouse() ) + kf |= 16; + + kf |= state() << 5; + TQTextOStream os(&pmkey); + os << "$qt_check_" << style().className() << "_" + << palette().serialNumber() << "_" << irect.width() << "x" << irect.height() << "_" << kf; + TQPixmap *pm = TQPixmapCache::find( pmkey ); + if ( pm ) { // pixmap exists + p->drawPixmap( irect.topLeft(), *pm ); + drawButtonLabel( p ); + return; + } + bool use_pm = TRUE; + TQPainter pmpaint; + int wx = 0, wy = 0; + if ( use_pm ) { + pm = new TQPixmap( irect.size() ); // create new pixmap + TQ_CHECK_PTR( pm ); + pm->fill( cg.background() ); + TQPainter::redirect(this, pm); + pmpaint.begin(this); + p = &pmpaint; // draw in pixmap + wx = irect.x(); // save x,y coords + wy = irect.y(); + irect.moveTopLeft(TQPoint(0, 0)); + p->setBackgroundColor( cg.background() ); + } +#endif + + TQStyle::SFlags flags = TQStyle::Style_Default; + if ( isEnabled() ) + flags |= TQStyle::Style_Enabled; + if ( hasFocus() ) + flags |= TQStyle::Style_HasFocus; + if ( isDown() ) + flags |= TQStyle::Style_Down; + if ( hasMouse() ) + flags |= TQStyle::Style_MouseOver; + if ( state() == TQButton::On ) + flags |= TQStyle::Style_On; + else if ( state() == TQButton::Off ) + flags |= TQStyle::Style_Off; + else if ( state() == TQButton::NoChange ) + flags |= TQStyle::Style_NoChange; + + style().drawControl(TQStyle::CE_CheckBox, p, this, irect, cg, flags); + +#if defined(SAVE_CHECKBOX_PIXMAPS) + if ( use_pm ) { + pmpaint.end(); + TQPainter::redirect( this, 0 ); + if ( backgroundPixmap() || backgroundMode() == X11ParentRelative ) { + TQBitmap bm( pm->size() ); + bm.fill( color0 ); + pmpaint.begin( &bm ); + style().drawControlMask(TQStyle::CE_CheckBox, &pmpaint, this, irect); + pmpaint.end(); + pm->setMask( bm ); + } + p = paint; // draw in default device + p->drawPixmap( wx, wy, *pm ); + if (!TQPixmapCache::insert(pmkey, pm) ) // save in cache + delete pm; + } +#endif + + drawButtonLabel( paint ); +} + + +/*!\reimp +*/ +void TQCheckBox::drawButtonLabel( TQPainter *p ) +{ + TQRect r = + TQStyle::visualRect( style().subRect(TQStyle::SR_CheckBoxContents, this), this ); + + TQStyle::SFlags flags = TQStyle::Style_Default; + if (isEnabled()) + flags |= TQStyle::Style_Enabled; + if (hasFocus()) + flags |= TQStyle::Style_HasFocus; + if (isDown()) + flags |= TQStyle::Style_Down; + if (state() == TQButton::On) + flags |= TQStyle::Style_On; + else if (state() == TQButton::Off) + flags |= TQStyle::Style_Off; + else if (state() == TQButton::NoChange) + flags |= TQStyle::Style_NoChange; + + style().drawControl(TQStyle::CE_CheckBoxLabel, p, this, r, colorGroup(), flags); +} + +/*! + \reimp +*/ +void TQCheckBox::resizeEvent( TQResizeEvent *e ) +{ + TQButton::resizeEvent(e); + if ( isVisible() ) { + TQPainter p(this); + TQSize isz = style().itemRect(&p, TQRect(0, 0, 1, 1), ShowPrefix, FALSE, + pixmap(), text()).size(); + TQSize wsz = (style().sizeFromContents(TQStyle::CT_CheckBox, this, isz). + expandedTo(TQApplication::globalStrut())); + + update(wsz.width(), isz.width(), 0, wsz.height()); + } + if (autoMask()) + updateMask(); +} + +/*! + \reimp +*/ +void TQCheckBox::updateMask() +{ + TQRect irect = + TQStyle::visualRect( style().subRect(TQStyle::SR_CheckBoxIndicator, this), this ); + + TQBitmap bm(width(), height()); + bm.fill(color0); + + TQPainter p( &bm, this ); + style().drawControlMask(TQStyle::CE_CheckBox, &p, this, irect); + if ( ! text().isNull() || ( pixmap() && ! pixmap()->isNull() ) ) { + TQRect crect = + TQStyle::visualRect( style().subRect( TQStyle::SR_CheckBoxContents, + this ), this ); + TQRect frect = + TQStyle::visualRect( style().subRect( TQStyle::SR_CheckBoxFocusRect, + this ), this ); + TQRect label(crect.unite(frect)); + p.fillRect(label, color1); + } + p.end(); + + setMask(bm); +} + +/*!\reimp*/ +bool TQCheckBox::hitButton( const TQPoint &pos ) const +{ + TQRect r = TQStyle::visualRect( style().subRect( TQStyle::SR_CheckBoxFocusRect, this ), this ); + if ( tqApp->reverseLayout() ) { + r.setRight( width() ); + } else { + r.setLeft( 0 ); + } + return r.contains( pos ); +} + +#endif diff --git a/src/widgets/tqcheckbox.h b/src/widgets/tqcheckbox.h new file mode 100644 index 000000000..4a63e4b4a --- /dev/null +++ b/src/widgets/tqcheckbox.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Definition of TQCheckBox class +** +** Created : 940222 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQCHECKBOX_H +#define TQCHECKBOX_H + +#ifndef QT_H +#include "ntqbutton.h" +#endif // QT_H + +#ifndef TQT_NO_CHECKBOX + +class TQ_EXPORT TQCheckBox : public TQButton +{ + TQ_OBJECT + TQ_PROPERTY( bool checked READ isChecked WRITE setChecked ) + TQ_PROPERTY( bool tristate READ isTristate WRITE setTristate ) + TQ_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true ) + +public: + TQCheckBox( TQWidget *parent, const char* name=0 ); + TQCheckBox( const TQString &text, TQWidget *parent, const char* name=0 ); + + bool isChecked() const; + + void setNoChange(); + + void setTristate(bool y=TRUE); + bool isTristate() const; + + TQSize sizeHint() const; + +public slots: + void setChecked( bool check ); + +protected: + void resizeEvent( TQResizeEvent* ); + void drawButton( TQPainter * ); + void drawButtonLabel( TQPainter * ); + void updateMask(); + bool hitButton( const TQPoint &pos ) const; +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQCheckBox( const TQCheckBox & ); + TQCheckBox &operator=( const TQCheckBox & ); +#endif +}; + + +inline bool TQCheckBox::isChecked() const +{ return isOn(); } + +inline void TQCheckBox::setChecked( bool check ) +{ setOn( check ); } + + +#endif // TQT_NO_CHECKBOX + +#endif // TQCHECKBOX_H diff --git a/src/widgets/tqcombobox.cpp b/src/widgets/tqcombobox.cpp new file mode 100644 index 000000000..9914c4398 --- /dev/null +++ b/src/widgets/tqcombobox.cpp @@ -0,0 +1,2338 @@ +/********************************************************************** +** +** Implementation of TQComboBox widget class +** +** Created : 940426 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqcombobox.h" +#ifndef TQT_NO_COMBOBOX +#include "tqpopupmenu.h" +#include "ntqlistbox.h" +#include "tqpainter.h" +#include "ntqdrawutil.h" +#include "tqstrlist.h" +#include "tqpixmap.h" +#include "tqtimer.h" +#include "ntqapplication.h" +#include "tqlineedit.h" +#include "tqbitmap.h" +#include "qeffects_p.h" +#include "tqstringlist.h" +#include "tqcombobox.h" +#include "tqstyle.h" +#include +#if defined(QT_ACCESSIBILITY_SUPPORT) +#include "ntqaccessible.h" +#endif + +/*! + \class TQComboBox tqcombobox.h + \brief The TQComboBox widget is a combined button and popup list. + + \ingroup basic + \mainclass + + A combobox is a selection widget which displays the current item + and can pop up a list of items. A combobox may be editable in + which case the user can enter arbitrary strings. + + Comboboxes provide a means of showing the user's current choice + out of a list of options in a way that takes up the minimum amount + of screen space. + + TQComboBox supports three different display styles: Aqua/Motif 1.x, + Motif 2.0 and Windows. In Motif 1.x, a combobox was called + XmOptionMenu. In Motif 2.0, OSF introduced an improved combobox + and named that XmComboBox. TQComboBox provides both. + + TQComboBox provides two different constructors. The simplest + constructor creates an "old-style" combobox in Motif (or Aqua) + style: + \code + TQComboBox *c = new TQComboBox( this, "read-only combobox" ); + \endcode + + The other constructor creates a new-style combobox in Motif style, + and can create both read-only and editable comboboxes: + \code + TQComboBox *c1 = new TQComboBox( FALSE, this, "read-only combobox" ); + TQComboBox *c2 = new TQComboBox( TRUE, this, "editable combobox" ); + \endcode + + New-style comboboxes use a list box in both Motif and Windows + styles, and both the content size and the on-screen size of the + list box can be limited with sizeLimit() and setMaxCount() + respectively. Old-style comboboxes use a popup in Aqua and Motif + style, and that popup will happily grow larger than the desktop if + you put enough data into it. + + The two constructors create identical-looking comboboxes in + Windows style. + + Comboboxes can contain pixmaps as well as strings; the + insertItem() and changeItem() functions are suitably overloaded. + For editable comboboxes, the function clearEdit() is provided, + to clear the displayed string without changing the combobox's + contents. + + A combobox emits two signals, activated() and highlighted(), when + a new item has been activated (selected) or highlighted (made + current). Both signals exist in two versions, one with a \c + TQString argument and one with an \c int argument. If the user + highlights or activates a pixmap, only the \c int signals are + emitted. Whenever the text of an editable combobox is changed the + textChanged() signal is emitted. + + When the user enters a new string in an editable combobox, the + widget may or may not insert it, and it can insert it in several + locations. The default policy is is \c AtBottom but you can change + this using setInsertionPolicy(). + + It is possible to constrain the input to an editable combobox + using TQValidator; see setValidator(). By default, any input is + accepted. + + If the combobox is not editable then it has a default + focusPolicy() of \c TabFocus, i.e. it will not grab focus if + clicked. This differs from both Windows and Motif. If the combobox + is editable then it has a default focusPolicy() of \c StrongFocus, + i.e. it will grab focus if clicked. + + A combobox can be populated using the insert functions, + insertStringList() and insertItem() for example. Items can be + changed with changeItem(). An item can be removed with + removeItem() and all items can be removed with clear(). The text + of the current item is returned by currentText(), and the text of + a numbered item is returned with text(). The current item can be + set with setCurrentItem() or setCurrentText(). The number of items + in the combobox is returned by count(); the maximum number of + items can be set with setMaxCount(). You can allow editing using + setEditable(). For editable comboboxes you can set auto-completion + using setAutoCompletion() and whether or not the user can add + duplicates is set with setDuplicatesEnabled(). + + (Motif 1, read-only)
            + (Motif 2, editable)
            + (Motif 2, read-only)
            + (Windows style) + + Depending on the style, TQComboBox will use a TQListBox or a + TQPopupMenu to display the list of items. See setListBox() for + more information. + + \sa TQLineEdit TQListBox TQSpinBox TQRadioButton TQButtonGroup + \link guibooks.html#fowler GUI Design Handbook: Combo Box,\endlink + \link guibooks.html#fowler GUI Design Handbook: Drop-Down List Box.\endlink +*/ + + +/*! + \enum TQComboBox::Policy + + This enum specifies what the TQComboBox should do when a new string + is entered by the user. + + \value NoInsertion the string will not be inserted into the + combobox. + + \value AtTop insert the string as the first item in the combobox. + + \value AtCurrent replace the previously selected item with the + string the user has entered. + + \value AtBottom insert the string as the last item in the + combobox. + + \value AfterCurrent insert the string after the previously + selected item. + + \value BeforeCurrent insert the string before the previously + selected item. + + activated() is always emitted when the string is entered. + + If inserting the new string would cause the combobox to breach its + content size limit, the item at the other end of the list is + deleted. The definition of "other end" is + implementation-dependent. +*/ + + +/*! + \fn void TQComboBox::activated( int index ) + + This signal is emitted when a new item has been activated + (selected). The \a index is the position of the item in the + combobox. + + This signal is not emitted if the item is changed + programmatically, e.g. using setCurrentItem(). +*/ + +/*! + \overload void TQComboBox::activated( const TQString &string ) + + This signal is emitted when a new item has been activated + (selected). \a string is the selected string. + + You can also use the activated(int) signal, but be aware that its + argument is meaningful only for selected strings, not for user + entered strings. +*/ + +/*! + \fn void TQComboBox::highlighted( int index ) + + This signal is emitted when a new item has been set to be the + current item. The \a index is the position of the item in the + combobox. + + This signal is not emitted if the item is changed + programmatically, e.g. using setCurrentItem(). +*/ + +/*! + \overload void TQComboBox::highlighted( const TQString &string ) + + This signal is emitted when a new item has been set to be the + current item. \a string is the item's text. + + You can also use the highlighted(int) signal. +*/ + +/*! + \fn void TQComboBox::textChanged( const TQString &string ) + + This signal is used for editable comboboxes. It is emitted + whenever the contents of the text entry field changes. \a string + contains the new text. +*/ + +/*! + \property TQComboBox::autoCompletion + \brief whether auto-completion is enabled + + This property can only be set for editable comboboxes, for + non-editable comboboxes it has no effect. It is FALSE by default. +*/ + +/*! + \property TQComboBox::autoMask + \brief whether the combobox is automatically masked + + \sa TQWidget::setAutoMask() +*/ + +/*! \property TQComboBox::autoResize + \brief whether auto resize is enabled + \obsolete + + If this property is set to TRUE then the combobox will resize itself + whenever its contents change. The default is FALSE. +*/ + +/*! + \property TQComboBox::count + \brief the number of items in the combobox +*/ + +/*! + \property TQComboBox::currentItem + \brief the index of the current item in the combobox + + Note that the activated() and highlighted() signals are only + emitted when the user changes the current item, not when it is + changed programmatically. +*/ + +/*! + \property TQComboBox::currentText + \brief the text of the combobox's current item +*/ + +/*! + \property TQComboBox::duplicatesEnabled + \brief whether duplicates are allowed + + If the combobox is editable and the user enters some text in the + combobox's lineedit and presses Enter (and the insertionPolicy() + is not \c NoInsertion), then what happens is this: + \list + \i If the text is not already in the list, the text is inserted. + \i If the text is in the list and this property is TRUE (the + default), the text is inserted. + \i If the text is in the list and this property is FALSE, the text + is \e not inserted; instead the item which has matching text becomes + the current item. + \endlist + + This property only affects user-interaction. You can use + insertItem() to insert duplicates if you wish regardless of this + setting. +*/ + +/*! + \property TQComboBox::editable + \brief whether the combobox is editable + + This property's default is FALSE. Note that the combobox will be + cleared if this property is set to TRUE for a 1.x Motif style + combobox. To avoid this, use setEditable() before inserting any + items. Also note that the 1.x version of Motif didn't have any + editable comboboxes, so the combobox will change it's appearance + to a 2.0 style Motif combobox is it is set to be editable. +*/ + +/*! + \property TQComboBox::insertionPolicy + \brief the position of the items inserted by the user + + The default insertion policy is \c AtBottom. See \l Policy. +*/ + +/*! + \property TQComboBox::maxCount + \brief the maximum number of items allowed in the combobox +*/ + +/*! + \property TQComboBox::sizeLimit + \brief the maximum on-screen size of the combobox. + + This property is ignored for both Motif 1.x style and non-editable + comboboxes in Mac style. The default limit is ten + lines. If the number of items in the combobox is or grows larger + than lines, a scrollbar is added. +*/ + +class TQComboBoxPopup : public TQPopupMenu +{ +public: + TQComboBoxPopup( TQWidget *parent=0, const char *name=0 ) + : TQPopupMenu( parent, name ) + { + } + + int itemHeight( int index ) + { + return TQPopupMenu::itemHeight( index ); + } +}; + +static inline TQString escapedComboString(const TQString &str) +{ + TQString stringToReturn = str; + return stringToReturn.replace('&', "&&"); +} + +class TQComboBoxPopupItem : public TQCustomMenuItem +{ + TQListBoxItem *li; + TQSize sc; // Size cache optimization +public: + TQComboBoxPopupItem(TQListBoxItem *i) : TQCustomMenuItem(), li(i), sc(0, 0) { } + virtual bool fullSpan() const { return TRUE; } + virtual void paint( TQPainter*, const TQColorGroup&, bool, bool, int, int, int, int); + virtual TQSize sizeHint() { if (sc.isNull()) sc = TQSize(li->width(li->listBox()), TQMAX(25, li->height(li->listBox()))); return sc; } +}; +void TQComboBoxPopupItem::paint( TQPainter* p, const TQColorGroup&, bool, + bool, int x, int y, int, int) +{ + p->save(); + p->translate(x, y + ((sizeHint().height() / 2) - (li->height(li->listBox()) / 2))); + li->paint(p); + p->restore(); +} + + +class TQComboBoxData +{ +public: + TQComboBoxData( TQComboBox *cb ): ed( 0 ), usingLBox( FALSE ), pop( 0 ), lBox( 0 ), combo( cb ) + { + duplicatesEnabled = TRUE; + cb->setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) ); + } + + inline bool usingListBox() { return usingLBox; } + inline TQListBox * listBox() { return lBox; } + inline TQComboBoxPopup * popup() { return pop; } + void updateLinedGeometry(); + void setListBox( TQListBox *l ); + void setPopupMenu( TQComboBoxPopup * pm, bool isPopup=TRUE ); + + int current; + int maxCount; + int sizeLimit; + TQComboBox::Policy p; + bool autoresize; + bool poppedUp; + bool mouseWasInsidePopup; + bool arrowPressed; + bool arrowDown; + bool discardNextMousePress; + bool shortClick; + bool useCompletion; + bool completeNow; + int completeAt; + bool duplicatesEnabled; + int fullHeight, currHeight; + + TQLineEdit * ed; // /bin/ed rules! + TQTimer *completionTimer; + + TQSize sizeHint; + +private: + bool usingLBox; + TQComboBoxPopup *pop; + TQListBox *lBox; + TQComboBox *combo; + +}; + +void TQComboBoxData::updateLinedGeometry() +{ + if ( !ed || !combo ) + return; + TQRect r = TQStyle::visualRect( combo->style().querySubControlMetrics(TQStyle::CC_ComboBox, combo, + TQStyle::SC_ComboBoxEditField), combo ); + + const TQPixmap *pix = current < combo->count() ? combo->pixmap( current ) : 0; + if ( pix && pix->width() < r.width() ) + r.setLeft( r.left() + pix->width() + 4 ); + if ( r != ed->geometry() ) + ed->setGeometry( r ); +} + +void TQComboBoxData::setListBox( TQListBox *l ) +{ + lBox = l; + usingLBox = TRUE; + l->setMouseTracking( TRUE ); +#ifdef TQ_WS_X11 + l->x11SetWindowType( TQWidget::X11WindowTypeCombo ); + l->x11SetWindowTransient( combo->topLevelWidget()); +#endif +} + +void TQComboBoxData::setPopupMenu( TQComboBoxPopup * pm, bool isPopup ) +{ + pop = pm; + if(isPopup) + usingLBox = FALSE; +#ifdef TQ_WS_X11 + if( pm ) { + pm->x11SetWindowType( TQWidget::X11WindowTypeCombo ); + pm->x11SetWindowTransient( combo->topLevelWidget()); + } +#endif +} + +static inline bool checkInsertIndex( const char *method, const char * name, + int count, int *index) +{ + bool range_err = (*index > count); +#if defined(QT_CHECK_RANGE) + if ( range_err ) + tqWarning( "TQComboBox::%s: (%s) Index %d out of range", + method, name ? name : "", *index ); +#else + Q_UNUSED( method ) + Q_UNUSED( name ) +#endif + if ( *index < 0 ) // append + *index = count; + return !range_err; +} + + +static inline bool checkIndex( const char *method, const char * name, + int count, int index ) +{ + bool range_err = (index >= count); +#if defined(QT_CHECK_RANGE) + if ( range_err ) + tqWarning( "TQComboBox::%s: (%s) Index %i out of range", + method, name ? name : "", index ); +#else + Q_UNUSED( method ) + Q_UNUSED( name ) +#endif + return !range_err; +} + + + +/*! + Constructs a combobox widget with parent \a parent called \a name. + + This constructor creates a popup list if the program uses Motif + (or Aqua) look and feel; this is compatible with Motif 1.x and + Aqua. + + Note: If you use this constructor to create your TQComboBox, then + the pixmap() function will always return 0. To workaround this, + use the other constructor. + +*/ + + + +TQComboBox::TQComboBox( TQWidget *parent, const char *name ) + : TQWidget( parent, name, WNoAutoErase ) +{ + d = new TQComboBoxData( this ); + if ( style().styleHint(TQStyle::SH_ComboBox_Popup, this) || + style().styleHint(TQStyle::SH_GUIStyle) == TQt::MotifStyle ) { + d->setPopupMenu( new TQComboBoxPopup( this, "in-combo" ) ); + d->popup()->setFont( font() ); + connect( d->popup(), TQ_SIGNAL(activated(int)), + TQ_SLOT(internalActivate(int)) ); + connect( d->popup(), TQ_SIGNAL(highlighted(int)), + TQ_SLOT(internalHighlight(int)) ); + } else { + setUpListBox(); + } + d->ed = 0; + d->current = 0; + d->maxCount = INT_MAX; + d->sizeLimit = 10; + d->p = AtBottom; + d->autoresize = FALSE; + d->poppedUp = FALSE; + d->arrowDown = FALSE; + d->arrowPressed = FALSE; + d->discardNextMousePress = FALSE; + d->shortClick = FALSE; + d->useCompletion = FALSE; + d->completeAt = 0; + d->completeNow = FALSE; + d->completionTimer = new TQTimer( this ); + + setFocusPolicy( TabFocus ); + setBackgroundMode( PaletteButton ); +} + + +/*! + Constructs a combobox with a maximum size and either Motif 2.0 or + Windows look and feel. + + The input field can be edited if \a rw is TRUE, otherwise the user + may only choose one of the items in the combobox. + + The \a parent and \a name arguments are passed on to the TQWidget + constructor. +*/ + + +TQComboBox::TQComboBox( bool rw, TQWidget *parent, const char *name ) + : TQWidget( parent, name, WNoAutoErase ) +{ + d = new TQComboBoxData( this ); + setUpListBox(); + + if(d->popup() && style().styleHint(TQStyle::SH_ComboBox_Popup, this)) + d->popup()->setItemChecked(d->current, FALSE); + d->current = 0; + d->maxCount = INT_MAX; + setSizeLimit(10); + d->p = AtBottom; + d->autoresize = FALSE; + d->poppedUp = FALSE; + d->arrowDown = FALSE; + d->discardNextMousePress = FALSE; + d->shortClick = FALSE; + d->useCompletion = FALSE; + d->completeAt = 0; + d->completeNow = FALSE; + d->completionTimer = new TQTimer( this ); + + setFocusPolicy( StrongFocus ); + + d->ed = 0; + if ( rw ) + setUpLineEdit(); + setBackgroundMode( PaletteButton, PaletteBase ); +} + + + +/*! + Destroys the combobox. +*/ + +TQComboBox::~TQComboBox() +{ + delete d; +} + +void TQComboBox::setDuplicatesEnabled( bool enable ) +{ + d->duplicatesEnabled = enable; +} + +bool TQComboBox::duplicatesEnabled() const +{ + return d->duplicatesEnabled; +} + +int TQComboBox::count() const +{ + if ( d->usingListBox() ) + return d->listBox()->count(); + else + return d->popup()->count(); +} + + +/*! + \overload + + Inserts the \a list of strings at position \a index in the + combobox. + + This is only for compatibility since it does not support Unicode + strings. See insertStringList(). +*/ + +void TQComboBox::insertStrList( const TQStrList &list, int index ) +{ + insertStrList( &list, index ); +} + +/*! + \overload + + Inserts the \a list of strings at position \a index in the + combobox. + + This is only for compatibility since it does not support Unicode + strings. See insertStringList(). +*/ + +void TQComboBox::insertStrList( const TQStrList *list, int index ) +{ + if ( !list ) { +#if defined(QT_CHECK_NULL) + Q_ASSERT( list != 0 ); +#endif + return; + } + TQStrListIterator it( *list ); + const char* tmp; + if ( index < 0 ) + index = count(); + while ( (tmp=it.current()) ) { + ++it; + if ( d->usingListBox() ) + d->listBox()->insertItem( TQString::fromLatin1(tmp), index ); + else + d->popup()->insertItem( escapedComboString(TQString::fromLatin1(tmp)), index, index ); + if ( index++ == d->current && d->current < count() ) { + if ( d->ed ) { + d->ed->setText( text( d->current ) ); + d->updateLinedGeometry(); + } else + update(); + currentChanged(); + } + } + if ( index != count() ) + reIndex(); +} + +/*! + Inserts the \a list of strings at position \a index in the + combobox. +*/ + +void TQComboBox::insertStringList( const TQStringList &list, int index ) +{ + TQStringList::ConstIterator it = list.begin(); + if ( index < 0 ) + index = count(); + while ( it != list.end() ) { + if ( d->usingListBox() ) + d->listBox()->insertItem( *it, index ); + else + d->popup()->insertItem( escapedComboString(*it), index, index ); + if ( index++ == d->current && d->current < count() ) { + if ( d->ed ) { + d->ed->setText( text( d->current ) ); + d->updateLinedGeometry(); + } else + update(); + currentChanged(); + } + ++it; + } + if ( index != count() ) + reIndex(); +} + +/*! + Inserts the array of char * \a strings at position \a index in the + combobox. + + The \a numStrings argument is the number of strings. If \a + numStrings is -1 (default), the \a strings array must be + terminated with 0. + + Example: + \code + static const char* items[] = { "red", "green", "blue", 0 }; + combo->insertStrList( items ); + \endcode + + \sa insertStringList() +*/ + +void TQComboBox::insertStrList( const char **strings, int numStrings, int index) +{ + if ( !strings ) { +#if defined(QT_CHECK_NULL) + Q_ASSERT( strings != 0 ); +#endif + return; + } + if ( index < 0 ) + index = count(); + int i = 0; + while ( (numStrings<0 && strings[i]!=0) || iusingListBox() ) + d->listBox()->insertItem( TQString::fromLatin1(strings[i]), index ); + else + d->popup()->insertItem( escapedComboString(TQString::fromLatin1(strings[i])), index, index ); + i++; + if ( index++ == d->current && d->current < count() ) { + if ( d->ed ) { + d->ed->setText( text( d->current ) ); + d->updateLinedGeometry(); + } else + update(); + currentChanged(); + } + } + if ( index != count() ) + reIndex(); +} + + +/*! + Inserts a text item with text \a t, at position \a index. The item + will be appended if \a index is negative. +*/ + +void TQComboBox::insertItem( const TQString &t, int index ) +{ + int cnt = count(); + if ( !checkInsertIndex( "insertItem", name(), cnt, &index ) ) + return; + if ( d->usingListBox() ) + d->listBox()->insertItem( t, index ); + else + d->popup()->insertItem( escapedComboString(t), index, index ); + if ( index != cnt ) + reIndex(); + if ( index == d->current && d->current < count() ) { + if ( d->ed ) { + d->ed->setText( text( d->current ) ); + d->updateLinedGeometry(); + } else + update(); + } + if ( index == d->current ) + currentChanged(); +} + +/*! + \overload + + Inserts a \a pixmap item at position \a index. The item will be + appended if \a index is negative. +*/ + +void TQComboBox::insertItem( const TQPixmap &pixmap, int index ) +{ + int cnt = count(); + if ( !checkInsertIndex( "insertItem", name(), cnt, &index ) ) + return; + if ( d->usingListBox() ) + d->listBox()->insertItem( pixmap, index ); + else + d->popup()->insertItem( pixmap, index, index ); + if ( index != cnt ) + reIndex(); + if ( index == d->current && d->current < count() ) { + if ( d->ed ) { + d->ed->setText( text( d->current ) ); + d->updateLinedGeometry(); + } else + update(); + } + if ( index == d->current ) + currentChanged(); +} + +/*! + \overload + + Inserts a \a pixmap item with additional text \a text at position + \a index. The item will be appended if \a index is negative. +*/ + +void TQComboBox::insertItem( const TQPixmap &pixmap, const TQString& text, int index ) +{ + int cnt = count(); + if ( !checkInsertIndex( "insertItem", name(), cnt, &index ) ) + return; + if ( d->usingListBox() ) + d->listBox()->insertItem( pixmap, text, index ); + else + d->popup()->insertItem( pixmap, escapedComboString(text), index, index ); + if ( index != cnt ) + reIndex(); + if ( index == d->current && d->current < count() ) { + if ( d->ed ) { + d->ed->setText( this->text( d->current ) ); + d->updateLinedGeometry(); + } else + update(); + } + if ( index == d->current ) + currentChanged(); +} + + +/*! + Removes the item at position \a index. +*/ + +void TQComboBox::removeItem( int index ) +{ + int cnt = count(); + if ( !checkIndex( "removeItem", name(), cnt, index ) ) + return; + if ( d->usingListBox() ) { + if ( style().styleHint(TQStyle::SH_ComboBox_Popup, this) && d->popup() ) + d->popup()->removeItemAt( index ); + d->listBox()->removeItem( index ); + } else { + d->popup()->removeItemAt( index ); + } + if ( index != cnt-1 ) + reIndex(); + if ( index == d->current ) { + if ( d->ed ) { + TQString s = TQString::fromLatin1(""); + if (d->current < cnt - 1) + s = text( d->current ); + d->ed->setText( s ); + d->updateLinedGeometry(); + } + else { + if ( d->usingListBox() ) { + d->current = d->listBox()->currentItem(); + } else { + if (d->current > count()-1 && d->current > 0) + d->current--; + } + update(); + } + currentChanged(); + } + else { + if ( !d->ed ) { + if (d->current < cnt - 1) + setCurrentItem( d->current ); + else + setCurrentItem( d->current - 1 ); + } + } + +} + + +/*! + Removes all combobox items. +*/ + +void TQComboBox::clear() +{ + if ( d->usingListBox() ) { + if ( style().styleHint(TQStyle::SH_ComboBox_Popup, this) && d->popup() ) + d->popup()->clear(); + d->listBox()->resize( 0, 0 ); + d->listBox()->clear(); + } else { + d->popup()->clear(); + } + + if(d->popup() && style().styleHint(TQStyle::SH_ComboBox_Popup, this)) + d->popup()->setItemChecked(d->current, FALSE); + d->current = 0; + if ( d->ed ) { + d->ed->setText( TQString::fromLatin1("") ); + d->updateLinedGeometry(); + } + currentChanged(); +} + + +TQString TQComboBox::currentText() const +{ + if ( d->ed ) + return d->ed->text(); + else if ( d->current < count() ) + return text( currentItem() ); + else + return TQString::null; +} + +void TQComboBox::setCurrentText( const TQString& txt ) +{ + int i; + for ( i = 0; i < count(); i++) + if ( text( i ) == txt ) + break; + if ( i < count() ) + setCurrentItem( i ); + else if ( d->ed ) + d->ed->setText( txt ); + else + changeItem( txt, currentItem() ); +} + + +/*! + Returns the text item at position \a index, or TQString::null if + the item is not a string. + + \sa currentText() +*/ + +TQString TQComboBox::text( int index ) const +{ + if ( !checkIndex( "text", name(), count(), index ) ) + return TQString::null; + if ( d->usingListBox() ) { + return d->listBox()->text( index ); + } else { + TQString retText = d->popup()->text(index); + retText.replace("&&", "&"); + return retText; + } +} + +/*! + Returns the pixmap item at position \a index, or 0 if the item is + not a pixmap. +*/ + +const TQPixmap *TQComboBox::pixmap( int index ) const +{ + if ( !checkIndex( "pixmap", name(), count(), index ) ) + return 0; + if ( d->usingListBox() ) + return d->listBox()->pixmap( index ); + else + return d->popup()->pixmap( index ); +} + +/*! + Replaces the item at position \a index with the text \a t. +*/ + +void TQComboBox::changeItem( const TQString &t, int index ) +{ + if ( !checkIndex( "changeItem", name(), count(), index ) ) + return; + if ( d->usingListBox() ) + d->listBox()->changeItem( t, index ); + else + d->popup()->changeItem( t, index ); + if ( index == d->current ) { + if ( d->ed ) { + d->ed->setText( text( d->current ) ); + d->updateLinedGeometry(); + } else + update(); + } +} + +/*! + \overload + + Replaces the item at position \a index with the pixmap \a im, + unless the combobox is editable. + + \sa insertItem() +*/ + +void TQComboBox::changeItem( const TQPixmap &im, int index ) +{ + if ( !checkIndex( "changeItem", name(), count(), index ) ) + return; + if ( d->usingListBox() ) + d->listBox()->changeItem( im, index ); + else + d->popup()->changeItem( im, index ); + if ( index == d->current ) + update(); +} + +/*! + \overload + + Replaces the item at position \a index with the pixmap \a im and + the text \a t. + + \sa insertItem() +*/ + +void TQComboBox::changeItem( const TQPixmap &im, const TQString &t, int index ) +{ + if ( !checkIndex( "changeItem", name(), count(), index ) ) + return; + if ( d->usingListBox() ) + d->listBox()->changeItem( im, t, index ); + else + d->popup()->changeItem( im, t, index ); + if ( index == d->current ) + update(); +} + + +int TQComboBox::currentItem() const +{ + return d->current; +} + +void TQComboBox::setCurrentItem( int index ) +{ + if ( index == d->current && !d->ed ) { + return; + } + if ( !checkIndex( "setCurrentItem", name(), count(), index ) ) { + return; + } + + if ( d->usingListBox() && !( listBox()->item(index) && listBox()->item(index)->isSelectable() ) ) + return; + + if(d->popup() && style().styleHint(TQStyle::SH_ComboBox_Popup, this)) + d->popup()->setItemChecked(d->current, FALSE); + d->current = index; + d->completeAt = 0; + if ( d->ed ) { + d->ed->setText( text( index ) ); + d->updateLinedGeometry(); + } + // ### We want to keep ListBox's currentItem in sync, even if NOT popuped... + if ( d->usingListBox() && d->listBox() ) { + d->listBox()->setCurrentItem( index ); + } else { + internalHighlight( index ); + // internalActivate( index ); ### this leads to weird behavior, as in 3.0.1 + } + + currentChanged(); +} + +bool TQComboBox::autoResize() const +{ + return d->autoresize; +} + +void TQComboBox::setAutoResize( bool enable ) +{ + if ( (bool)d->autoresize != enable ) { + d->autoresize = enable; + if ( enable ) + adjustSize(); + } +} + + +/*! + \reimp + + This implementation caches the size hint to avoid resizing when + the contents change dynamically. To invalidate the cached value + call setFont(). +*/ +TQSize TQComboBox::sizeHint() const +{ + if ( isVisible() && d->sizeHint.isValid() ) + return d->sizeHint; + + constPolish(); + int i, w; + TQFontMetrics fm = fontMetrics(); + + int maxW = count() ? 18 : 7 * fm.width(TQChar('x')) + 18; + int maxH = TQMAX( fm.lineSpacing(), 14 ) + 2; + + if ( !d->usingListBox() ) { + w = d->popup()->sizeHint().width() - 2* d->popup()->frameWidth(); + if ( w > maxW ) + maxW = w; + } else { + for( i = 0; i < count(); i++ ) { + w = d->listBox()->item( i )->width( d->listBox() ); + if ( w > maxW ) + maxW = w; + } + } + + d->sizeHint = (style().sizeFromContents(TQStyle::CT_ComboBox, this, + TQSize(maxW, maxH)). + expandedTo(TQApplication::globalStrut())); + + return d->sizeHint; +} + + +/*! + \internal + Receives activated signals from an internal popup list and emits + the activated() signal. +*/ + +void TQComboBox::internalActivate( int index ) +{ + if ( d->current != index ) { + if ( !d->usingListBox() || listBox()->item( index )->isSelectable() ) { + if(d->popup() && style().styleHint(TQStyle::SH_ComboBox_Popup, this)) + d->popup()->setItemChecked(d->current, FALSE); + d->current = index; + currentChanged(); + } + } + if ( d->usingListBox() ) + popDownListBox(); + else + d->popup()->removeEventFilter( this ); + d->poppedUp = FALSE; + + TQString t( text( index ) ); + if ( d->ed ) { + d->ed->setText( t ); + d->updateLinedGeometry(); + } + emit activated( index ); + emit activated( t ); +} + +/*! + \internal + Receives highlighted signals from an internal popup list and emits + the highlighted() signal. +*/ + +void TQComboBox::internalHighlight( int index ) +{ + emit highlighted( index ); + TQString t = text( index ); + if ( !t.isNull() ) + emit highlighted( t ); +} + +/*! + \internal + Receives timeouts after a click. Used to decide if a Motif style + popup should stay up or not after a click. +*/ +void TQComboBox::internalClickTimeout() +{ + d->shortClick = FALSE; +} + +/*! + Sets the palette for both the combobox button and the combobox + popup list to \a palette. +*/ + +void TQComboBox::setPalette( const TQPalette &palette ) +{ + TQWidget::setPalette( palette ); + if ( d->listBox() ) + d->listBox()->setPalette( palette ); + if ( d->popup() ) + d->popup()->setPalette( palette ); +} + +/*! + Sets the font for both the combobox button and the combobox popup + list to \a font. +*/ + +void TQComboBox::setFont( const TQFont &font ) +{ + d->sizeHint = TQSize(); // invalidate size hint + TQWidget::setFont( font ); + if ( d->usingListBox() ) + d->listBox()->setFont( font ); + else + d->popup()->setFont( font ); + if (d->ed) + d->ed->setFont( font ); + if ( d->autoresize ) + adjustSize(); +} + + +/*!\reimp +*/ + +void TQComboBox::resizeEvent( TQResizeEvent * e ) +{ + if ( d->ed ) + d->updateLinedGeometry(); + if ( d->listBox() ) + d->listBox()->resize( width(), d->listBox()->height() ); + TQWidget::resizeEvent( e ); +} + +/*!\reimp +*/ + +void TQComboBox::paintEvent( TQPaintEvent * ) +{ + TQPainter p( this ); + const TQColorGroup & g = colorGroup(); + p.setPen(g.text()); + + TQStyle::SFlags flags = TQStyle::Style_Default; + if (isEnabled()) + flags |= TQStyle::Style_Enabled; + if (hasFocus()) + flags |= TQStyle::Style_HasFocus; + if (hasMouse()) + flags |= TQStyle::Style_MouseOver; + + if ( width() < 5 || height() < 5 ) { + qDrawShadePanel( &p, rect(), g, FALSE, 2, + &g.brush( TQColorGroup::Button ) ); + return; + } + + bool reverse = TQApplication::reverseLayout(); + if ( !d->usingListBox() && + style().styleHint(TQStyle::SH_GUIStyle) == TQt::MotifStyle) { // motif 1.x style + int dist, buttonH, buttonW; + dist = 8; + buttonH = 7; + buttonW = 11; + int xPos; + int x0; + int w = width() - dist - buttonW - 1; + if ( reverse ) { + xPos = dist + 1; + x0 = xPos + 4; + } else { + xPos = w; + x0 = 4; + } + qDrawShadePanel( &p, rect(), g, FALSE, + style().pixelMetric(TQStyle::PM_DefaultFrameWidth, this), + &g.brush( TQColorGroup::Button ) ); + qDrawShadePanel( &p, xPos, (height() - buttonH)/2, + buttonW, buttonH, g, FALSE, + style().pixelMetric(TQStyle::PM_DefaultFrameWidth, this) ); + TQRect clip( x0, 2, w - 2 - 4 - 5, height() - 4 ); + TQString str = d->popup()->text( this->d->current ); + if ( !str.isNull() ) { + p.drawText( clip, AlignCenter | SingleLine, str ); + } + + TQPixmap *pix = d->popup()->pixmap( this->d->current ); + TQIconSet *iconSet = d->popup()->iconSet( this->d->current ); + if (pix || iconSet) { + TQPixmap pm = ( pix ? *pix : iconSet->pixmap() ); + p.setClipRect( clip ); + p.drawPixmap( 4, (height()-pm.height())/2, pm ); + p.setClipping( FALSE ); + } + + if ( hasFocus() ) + p.drawRect( xPos - 5, 4, width() - xPos + 1 , height() - 8 ); + } else if(!d->usingListBox()) { + style().drawComplexControl( TQStyle::CC_ComboBox, &p, this, rect(), g, + flags, (uint)TQStyle::SC_All, + (d->arrowDown ? + TQStyle::SC_ComboBoxArrow : + TQStyle::SC_None )); + + TQRect re = style().querySubControlMetrics( TQStyle::CC_ComboBox, this, + TQStyle::SC_ComboBoxEditField ); + re = TQStyle::visualRect(re, this); + p.setClipRect( re ); + + TQString str = d->popup()->text( this->d->current ); + TQPixmap *pix = d->popup()->pixmap( this->d->current ); + if ( !str.isNull() ) { + p.save(); + p.setFont(font()); + TQFontMetrics fm(font()); + int x = re.x(), y = re.y() + fm.ascent(); + if( pix ) + x += pix->width() + 5; + p.drawText( x, y, str ); + p.restore(); + } + if ( pix ) { + p.fillRect( re.x(), re.y(), pix->width() + 4, re.height(), + colorGroup().brush( TQColorGroup::Base ) ); + p.drawPixmap( re.x() + 2, re.y() + + ( re.height() - pix->height() ) / 2, *pix ); + } + } else { + style().drawComplexControl( TQStyle::CC_ComboBox, &p, this, rect(), g, + flags, (uint)TQStyle::SC_All, + (d->arrowDown ? + TQStyle::SC_ComboBoxArrow : + TQStyle::SC_None )); + + TQRect re = style().querySubControlMetrics( TQStyle::CC_ComboBox, this, + TQStyle::SC_ComboBoxEditField ); + re = TQStyle::visualRect(re, this); + p.setClipRect( re ); + + if ( !d->ed ) { + TQListBoxItem * item = d->listBox()->item( d->current ); + if ( item ) { + int itemh = item->height( d->listBox() ); + p.translate( re.x(), re.y() + (re.height() - itemh)/2 ); + item->paint( &p ); + } + } else if ( d->listBox() && d->listBox()->item( d->current ) ) { + TQListBoxItem * item = d->listBox()->item( d->current ); + const TQPixmap *pix = item->pixmap(); + if ( pix ) { + p.fillRect( re.x(), re.y(), pix->width() + 4, re.height(), + colorGroup().brush( TQColorGroup::Base ) ); + p.drawPixmap( re.x() + 2, re.y() + + ( re.height() - pix->height() ) / 2, *pix ); + } + } + p.setClipping( FALSE ); + } +} + + +/*!\reimp +*/ + +void TQComboBox::mousePressEvent( TQMouseEvent *e ) +{ + if ( e->button() != LeftButton ) + return; + if ( d->discardNextMousePress ) { + d->discardNextMousePress = FALSE; + return; + } + TQRect arrowRect = style().querySubControlMetrics( TQStyle::CC_ComboBox, this, + TQStyle::SC_ComboBoxArrow); + arrowRect = TQStyle::visualRect(arrowRect, this); + + // Correction for motif style, where arrow is smaller + // and thus has a rect that doesn't fit the button. + arrowRect.setHeight( TQMAX( height() - (2 * arrowRect.y()), arrowRect.height() ) ); + + if ( count() && ( !editable() || arrowRect.contains( e->pos() ) ) ) { + d->arrowPressed = FALSE; + + if ( d->usingListBox() ) { + listBox()->blockSignals( TRUE ); + tqApp->sendEvent( listBox(), e ); // trigger the listbox's autoscroll + listBox()->setCurrentItem(d->current); + listBox()->blockSignals( FALSE ); + popup(); + if ( arrowRect.contains( e->pos() ) ) { + d->arrowPressed = TRUE; + d->arrowDown = TRUE; + repaint( FALSE ); + } + } else { + popup(); + } + TQTimer::singleShot( 200, this, TQ_SLOT(internalClickTimeout())); + d->shortClick = TRUE; + } +} + +/*!\reimp +*/ + +void TQComboBox::mouseMoveEvent( TQMouseEvent * ) +{ +} + +/*!\reimp +*/ + +void TQComboBox::mouseReleaseEvent( TQMouseEvent * ) +{ +} + +/*!\reimp +*/ + +void TQComboBox::mouseDoubleClickEvent( TQMouseEvent *e ) +{ + mousePressEvent( e ); +} + + +/*!\reimp +*/ + +void TQComboBox::keyPressEvent( TQKeyEvent *e ) +{ + int c = currentItem(); + if ( ( e->key() == Key_F4 && e->state() == 0 ) || + ( e->key() == Key_Down && (e->state() & AltButton) ) || + ( !d->ed && e->key() == Key_Space ) ) { + if ( count() ) { + if ( !d->usingListBox() ) + d->popup()->setActiveItem( this->d->current ); + popup(); + } + return; + } else if ( d->usingListBox() && e->key() == Key_Up ) { + if ( c > 0 ) + setCurrentItem( c-1 ); + } else if ( d->usingListBox() && e->key() == Key_Down ) { + if ( ++c < count() ) + setCurrentItem( c ); + } else if ( d->usingListBox() && e->key() == Key_Home && ( !d->ed || !d->ed->hasFocus() ) ) { + setCurrentItem( 0 ); + } else if ( d->usingListBox() && e->key() == Key_End && ( !d->ed || !d->ed->hasFocus() ) ) { + setCurrentItem( count()-1 ); + } else if ( !d->ed && e->ascii() >= 32 && !e->text().isEmpty() ) { + if ( !d->completionTimer->isActive() ) { + d->completeAt = 0; + c = completionIndex( e->text(), ++c ); + if ( c >= 0 ) { + setCurrentItem( c ); + d->completeAt = e->text().length(); + } + } else { + d->completionTimer->stop(); + TQString ct = currentText().left( d->completeAt ) + e->text(); + c = completionIndex( ct, c ); + if ( c < 0 && d->completeAt > 0 ) { + c = completionIndex( e->text(), 0 ); + ct = e->text(); + } + d->completeAt = 0; + if ( c >= 0 ) { + setCurrentItem( c ); + d->completeAt = ct.length(); + } + } + d->completionTimer->start( 400, TRUE ); + } else { + e->ignore(); + return; + } + + c = currentItem(); + if ( count() && !text( c ).isNull() ) + emit activated( text( c ) ); + emit activated( c ); +} + + +/*!\reimp +*/ + +void TQComboBox::focusInEvent( TQFocusEvent * e ) +{ + TQWidget::focusInEvent( e ); + d->completeNow = FALSE; + d->completeAt = 0; +} + +/*!\reimp +*/ + +void TQComboBox::focusOutEvent( TQFocusEvent * e ) +{ + TQWidget::focusOutEvent( e ); + d->completeNow = FALSE; + d->completeAt = 0; +} + +/*!\reimp +*/ +#ifndef TQT_NO_WHEELEVENT +void TQComboBox::wheelEvent( TQWheelEvent *e ) +{ + if ( d->poppedUp ) { + if ( d->usingListBox() ) { + TQApplication::sendEvent( d->listBox(), e ); + } + } else { + if ( e->delta() > 0 ) { + int c = currentItem(); + if ( c > 0 ) { + setCurrentItem( c-1 ); + emit activated( currentItem() ); + emit activated( currentText() ); + } + } else { + int c = currentItem(); + if ( ++c < count() ) { + setCurrentItem( c ); + emit activated( currentItem() ); + emit activated( currentText() ); + } + } + e->accept(); + } +} +#endif + +/*! + \internal + Calculates the listbox height needed to contain all items, or as + many as the list box is supposed to contain. +*/ +static int listHeight( TQListBox *l, int sl ) +{ + if ( l->count() > 0 ) + return TQMIN( l->count(), (uint)sl) * l->item( 0 )->height(l); + else + return l->sizeHint().height(); +} + + +/*! + Pops up the combobox popup list. + + If the list is empty, no items appear. +*/ + +void TQComboBox::popup() +{ + if ( !count() || d->poppedUp ) + return; + + if( !d->usingListBox() || style().styleHint(TQStyle::SH_ComboBox_Popup, this) ) { + if(d->usingListBox()) { + if(!d->popup()) { + TQComboBoxPopup *p = new TQComboBoxPopup( this, "in-combo" ); + d->setPopupMenu( p, FALSE ); + p->setFont( font() ); + connect( p, TQ_SIGNAL(activated(int)), TQ_SLOT(internalActivate(int)) ); + connect( p, TQ_SIGNAL(highlighted(int)), TQ_SLOT(internalHighlight(int)) ); + } + d->popup()->clear(); + for(unsigned int i = 0; i < d->listBox()->count(); i++) { + TQListBoxItem *item = d->listBox()->item(i); + if(item->rtti() == TQListBoxText::RTTI) { + d->popup()->insertItem(escapedComboString(item->text()), i, i); + } else if(item->rtti() == TQListBoxPixmap::RTTI) { + if(item->pixmap()) + d->popup()->insertItem(TQIconSet(*item->pixmap()), escapedComboString(item->text()), i, i); + else + d->popup()->insertItem(escapedComboString(item->text()), i, i); + } else { + d->popup()->insertItem(new TQComboBoxPopupItem(item), i, i); + } + } + } + d->popup()->installEventFilter( this ); + if(d->popup() && style().styleHint(TQStyle::SH_ComboBox_Popup, this)) + d->popup()->setItemChecked(this->d->current, TRUE); + d->popup()->popup( mapToGlobal( TQPoint(0,0) ), this->d->current ); + update(); + } else { + // Send all listbox events to eventFilter(): + TQListBox* lb = d->listBox(); + lb->triggerUpdate( TRUE ); + lb->installEventFilter( this ); + d->mouseWasInsidePopup = FALSE; + int w = lb->variableWidth() ? lb->sizeHint().width() : width(); + int h = listHeight( lb, d->sizeLimit ) + 2; + TQRect screen = TQApplication::desktop()->availableGeometry( this ); + + int sx = screen.x(); // screen pos + int sy = screen.y(); + int sw = screen.width(); // screen width + int sh = screen.height(); // screen height + TQPoint pos = mapToGlobal( TQPoint(0,height()) ); + // ## Similar code is in TQPopupMenu + int x = pos.x(); + int y = pos.y(); + + // the complete widget must be visible + if ( x + w > sx + sw ) + x = sx+sw - w; + if ( x < sx ) + x = sx; + if (y + h > sy+sh && y - h - height() >= 0 ) + y = y - h - height(); + + TQRect rect = + style().querySubControlMetrics( TQStyle::CC_ComboBox, this, + TQStyle::SC_ComboBoxListBoxPopup, + TQStyleOption( x, y, w, h ) ); + // work around older styles that don't implement the combobox + // listbox popup subcontrol + if ( rect.isNull() ) + rect.setRect( x, y, w, h ); + lb->setGeometry( rect ); + + lb->raise(); + bool block = lb->signalsBlocked(); + lb->blockSignals( TRUE ); + TQListBoxItem* currentLBItem = 0; + if ( editable() && currentText() != text( currentItem() ) ) + currentLBItem = lb->findItem( currentText() ); + + currentLBItem = currentLBItem ? currentLBItem : lb->item( d->current ); + + lb->setCurrentItem( currentLBItem ); + lb->setContentsPos( lb->contentsX(), + lb->viewportToContents( lb->itemRect( currentLBItem ).topLeft() ).y() ); + + // set the current item to also be the selected item if it isn't already + if ( currentLBItem && currentLBItem->isSelectable() && !currentLBItem->isSelected() ) + lb->setSelected( currentLBItem, TRUE ); + lb->blockSignals( block ); + lb->setVScrollBarMode(TQScrollView::Auto); + +#ifndef TQT_NO_EFFECTS + if ( TQApplication::isEffectEnabled( UI_AnimateCombo ) ) { + if ( lb->y() < mapToGlobal(TQPoint(0,0)).y() ) + qScrollEffect( lb, TQEffects::UpScroll ); + else + qScrollEffect( lb ); + } else +#endif + lb->show(); + } + d->poppedUp = TRUE; +} + + +/*! + \reimp +*/ +void TQComboBox::updateMask() +{ + TQBitmap bm( size() ); + bm.fill( color0 ); + + { + TQPainter p( &bm, this ); + style().drawComplexControlMask(TQStyle::CC_ComboBox, &p, this, rect()); + } + + setMask( bm ); +} + +/*! + \internal + Pops down (removes) the combobox popup list box. +*/ +void TQComboBox::popDownListBox() +{ + Q_ASSERT( d->usingListBox() ); + d->listBox()->removeEventFilter( this ); + d->listBox()->viewport()->removeEventFilter( this ); + d->listBox()->hide(); + d->listBox()->setCurrentItem( d->current ); + if ( d->arrowDown ) { + d->arrowDown = FALSE; + repaint( FALSE ); + } + d->poppedUp = FALSE; + + update(); +} + + +/*! + \internal + Re-indexes the identifiers in the popup list. +*/ + +void TQComboBox::reIndex() +{ + if ( !d->usingListBox() ) { + int cnt = count(); + while ( cnt-- ) + d->popup()->setId( cnt, cnt ); + } +} + +/*! + \internal + Repaints the combobox. +*/ + +void TQComboBox::currentChanged() +{ + if ( d->autoresize ) + adjustSize(); + update(); + +#if defined(QT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); +#endif +} + +/*! \reimp + + \internal + + The event filter steals events from the popup or listbox when they + are popped up. It makes the popup stay up after a short click in + motif style. In windows style it toggles the arrow button of the + combobox field, and activates an item and takes down the listbox + when the mouse button is released. +*/ + +bool TQComboBox::eventFilter( TQObject *object, TQEvent *event ) +{ + if ( !event ) + return TRUE; + else if ( object == d->ed ) { + if ( event->type() == TQEvent::KeyPress ) { + bool isAccepted = ( (TQKeyEvent*)event )->isAccepted(); + keyPressEvent( (TQKeyEvent *)event ); + if ( ((TQKeyEvent *)event)->isAccepted() ) { + d->completeNow = FALSE; + return TRUE; + } else if ( ((TQKeyEvent *)event)->key() != Key_End ) { + d->completeNow = TRUE; + d->completeAt = d->ed->cursorPosition(); + } + if ( isAccepted ) + ( (TQKeyEvent*)event )->accept(); + else + ( (TQKeyEvent*)event )->ignore(); + } else if ( event->type() == TQEvent::KeyRelease ) { + keyReleaseEvent( (TQKeyEvent *)event ); + return ((TQKeyEvent *)event)->isAccepted(); + } else if ( event->type() == TQEvent::FocusIn ) { + focusInEvent( (TQFocusEvent *)event ); + } else if ( event->type() == TQEvent::FocusOut ) { + focusOutEvent( (TQFocusEvent *)event ); + } else if ( d->useCompletion && d->completeNow ) { + d->completeNow = FALSE; + if ( !d->ed->text().isNull() && + d->ed->cursorPosition() > d->completeAt && + d->ed->cursorPosition() == (int)d->ed->text().length() ) { + TQString ct( d->ed->text() ); + int i = completionIndex( ct, currentItem() ); + if ( i > -1 ) { + TQString it = text( i ); + d->ed->validateAndSet( it, ct.length(), + ct.length(), it.length() ); + d->current = i; + // ### sets current item without emitting signals. This is to + // make sure the right item is current if you change current with + // wheel/up/down. While typing current is not valid anyway. Fix properly + // in 4.0. + } + } + } + } else if ( d->usingListBox() && ( object == d->listBox() || + object == d->listBox()->viewport() )) { + TQMouseEvent *e = (TQMouseEvent*)event; + switch( event->type() ) { + case TQEvent::MouseMove: + if ( !d->mouseWasInsidePopup ) { + TQPoint pos = e->pos(); + if ( d->listBox()->rect().contains( pos ) ) + d->mouseWasInsidePopup = TRUE; + // Check if arrow button should toggle + if ( d->arrowPressed ) { + TQPoint comboPos; + comboPos = mapFromGlobal( d->listBox()->mapToGlobal(pos) ); + TQRect arrowRect = + style().querySubControlMetrics( TQStyle::CC_ComboBox, this, + TQStyle::SC_ComboBoxArrow); + arrowRect = TQStyle::visualRect(arrowRect, this); + if ( arrowRect.contains( comboPos ) ) { + if ( !d->arrowDown ) { + d->arrowDown = TRUE; + repaint( FALSE ); + } + } else { + if ( d->arrowDown ) { + d->arrowDown = FALSE; + repaint( FALSE ); + } + } + } + } else if ((e->state() & ( RightButton | LeftButton | MidButton ) ) == 0 && + style().styleHint(TQStyle::SH_ComboBox_ListMouseTracking, this)) { + TQWidget *mouseW = TQApplication::widgetAt( e->globalPos(), TRUE ); + if ( mouseW == d->listBox()->viewport() ) { //### + TQMouseEvent m( TQEvent::MouseMove, e->pos(), e->globalPos(), + LeftButton, LeftButton ); + TQApplication::sendEvent( object, &m ); //### Evil + return TRUE; + } + } + + break; + case TQEvent::MouseButtonRelease: + if ( d->listBox()->rect().contains( e->pos() ) ) { + TQMouseEvent tmp( TQEvent::MouseButtonDblClick, + e->pos(), e->button(), e->state() ) ; + // will hide popup + TQApplication::sendEvent( object, &tmp ); + return TRUE; + } else { + if ( d->mouseWasInsidePopup ) { + popDownListBox(); + } else { + d->arrowPressed = FALSE; + if ( d->arrowDown ) { + d->arrowDown = FALSE; + repaint( FALSE ); + } + } + } + break; + case TQEvent::MouseButtonDblClick: + case TQEvent::MouseButtonPress: + if ( !d->listBox()->rect().contains( e->pos() ) ) { + TQPoint globalPos = d->listBox()->mapToGlobal(e->pos()); + if ( TQApplication::widgetAt( globalPos, TRUE ) == this ) { + d->discardNextMousePress = TRUE; + // avoid popping up again + } + popDownListBox(); + return TRUE; + } + break; + case TQEvent::KeyPress: + switch( ((TQKeyEvent *)event)->key() ) { + case Key_Up: + case Key_Down: + if ( !(((TQKeyEvent *)event)->state() & AltButton) ) + break; + case Key_F4: + case Key_Escape: + if ( d->poppedUp ) { + popDownListBox(); + return TRUE; + } + break; + case Key_Enter: + case Key_Return: + // work around TQDialog's enter handling + return FALSE; + default: + break; + } + break; + case TQEvent::Hide: + popDownListBox(); + break; + default: + break; + } + } else if ( (!d->usingListBox() || style().styleHint(TQStyle::SH_ComboBox_Popup, this)) && + object == d->popup() ) { + TQMouseEvent *e = (TQMouseEvent*)event; + switch ( event->type() ) { + case TQEvent::MouseButtonRelease: + if ( d->shortClick ) { + TQMouseEvent tmp( TQEvent::MouseMove, + e->pos(), e->button(), e->state() ) ; + // highlight item, but don't pop down: + TQApplication::sendEvent( object, &tmp ); + return TRUE; + } + break; + case TQEvent::MouseButtonDblClick: + case TQEvent::MouseButtonPress: + if ( !d->popup()->rect().contains( e->pos() ) ) { + d->poppedUp = FALSE; + d->arrowDown = FALSE; + // remove filter, event will take down popup: + d->popup()->removeEventFilter( this ); + // ### uglehack! + // call internalHighlight so the highlighed signal + // will be emitted at least as often as necessary. + // it may be called more often than necessary + internalHighlight( d->current ); + } + break; + case TQEvent::Hide: + d->poppedUp = FALSE; + break; + default: + break; + } + } + return TQWidget::eventFilter( object, event ); +} + + +/*! + Returns the index of the first item \e after \a startingAt of + which \a prefix is a case-insensitive prefix. Returns -1 if no + items start with \a prefix. +*/ + +int TQComboBox::completionIndex( const TQString & prefix, + int startingAt = 0 ) const +{ + int start = startingAt; + if ( start < 0 || start >= count() ) + start = 0; + if ( start >= count() ) + return -1; + TQString match = prefix.lower(); + if ( match.length() < 1 ) + return start; + + TQString current; + int i = start; + do { + current = text( i ).lower(); + if ( current.startsWith( match ) ) + return i; + i++; + if ( i == count() ) + i = 0; + } while ( i != start ); + return -1; +} + + +int TQComboBox::sizeLimit() const +{ + return d ? d->sizeLimit : INT_MAX; +} + +void TQComboBox::setSizeLimit( int lines ) +{ + d->sizeLimit = lines; +} + + +int TQComboBox::maxCount() const +{ + return d ? d->maxCount : INT_MAX; +} + +void TQComboBox::setMaxCount( int count ) +{ + int l = this->count(); + while( --l > count ) + removeItem( l ); + d->maxCount = count; +} + +TQComboBox::Policy TQComboBox::insertionPolicy() const +{ + return d->p; +} + +void TQComboBox::setInsertionPolicy( Policy policy ) +{ + d->p = policy; +} + + + +/*! + Internal slot to keep the line editor up to date. +*/ + +void TQComboBox::returnPressed() +{ + TQString s( d->ed->text() ); + + if ( s.isEmpty() ) + return; + + int c = 0; + bool doInsert = TRUE; + if ( !d->duplicatesEnabled ) { + for ( int i = 0; i < count(); ++i ) { + if ( s == text( i ) ) { + doInsert = FALSE; + c = i; + break; + } + } + } + + if ( doInsert ) { + if ( insertionPolicy() != NoInsertion ) { + int cnt = count(); + while ( cnt >= d->maxCount ) { + removeItem( --cnt ); + } + } + + switch ( insertionPolicy() ) { + case AtCurrent: + if (count() == 0) + insertItem(s); + else if ( s != text( currentItem() ) ) + changeItem( s, currentItem() ); + emit activated( currentItem() ); + emit activated( s ); + return; + case NoInsertion: + emit activated( s ); + return; + case AtTop: + c = 0; + break; + case AtBottom: + c = count(); + break; + case BeforeCurrent: + c = currentItem(); + break; + case AfterCurrent: + c = count() == 0 ? 0 : currentItem() + 1; + break; + } + insertItem( s, c ); + } + + setCurrentItem( c ); + emit activated( c ); + emit activated( s ); +} + + +/*! \reimp +*/ + +void TQComboBox::setEnabled( bool enable ) +{ + if ( !enable ) { + if ( d->usingListBox() ) { + popDownListBox(); + } else { + d->popup()->removeEventFilter( this ); + d->popup()->close(); + d->poppedUp = FALSE; + } + } + TQWidget::setEnabled( enable ); +} + + + +/*! + Applies the validator \a v to the combobox so that only text which + is valid according to \a v is accepted. + + This function does nothing if the combobox is not editable. + + \sa validator() clearValidator() TQValidator +*/ + +void TQComboBox::setValidator( const TQValidator * v ) +{ + if ( d && d->ed ) + d->ed->setValidator( v ); +} + + +/*! + Returns the validator which constrains editing for this combobox + if there is one; otherwise returns 0. + + \sa setValidator() clearValidator() TQValidator +*/ + +const TQValidator * TQComboBox::validator() const +{ + return d && d->ed ? d->ed->validator() : 0; +} + + +/*! + This slot is equivalent to setValidator( 0 ). +*/ + +void TQComboBox::clearValidator() +{ + if ( d && d->ed ) + d->ed->setValidator( 0 ); +} + + +/*! + Sets the combobox to use \a newListBox instead of the current list + box or popup. As a side effect, it clears the combobox of its + current contents. + + \warning TQComboBox assumes that newListBox->text(n) returns + non-null for 0 \<= n \< newListbox->count(). This assumption is + necessary because of the line edit in TQComboBox. +*/ + +void TQComboBox::setListBox( TQListBox * newListBox ) +{ + clear(); + + if ( d->usingListBox() ) { + delete d->listBox(); + } else { + delete d->popup(); + d->setPopupMenu(0, FALSE); + } + + newListBox->reparent( this, WType_Popup, TQPoint(0,0), FALSE ); + d->setListBox( newListBox ); + d->listBox()->setFont( font() ); + d->listBox()->setPalette( palette() ); + d->listBox()->setVScrollBarMode(TQScrollView::AlwaysOff); + d->listBox()->setHScrollBarMode(TQScrollView::AlwaysOff); + d->listBox()->setFrameStyle( TQFrame::Box | TQFrame::Plain ); + d->listBox()->setLineWidth( 1 ); + d->listBox()->resize( 100, 10 ); + + connect( d->listBox(), TQ_SIGNAL(selected(int)), + TQ_SLOT(internalActivate(int)) ); + connect( d->listBox(), TQ_SIGNAL(highlighted(int)), + TQ_SLOT(internalHighlight(int))); +} + + +/*! + Returns the current list box, or 0 if there is no list box. + (TQComboBox can use TQPopupMenu instead of TQListBox.) Provided to + match setListBox(). + + \sa setListBox() +*/ + +TQListBox * TQComboBox::listBox() const +{ + return d && d->usingListBox() ? d->listBox() : 0; +} + +/*! + Returns the line edit, or 0 if there is no line edit. + + Only editable listboxes have a line editor. +*/ +TQLineEdit* TQComboBox::lineEdit() const +{ + return d->ed; +} + + + +/*! + Clears the line edit without changing the combobox's contents. + Does nothing if the combobox isn't editable. + + This is particularly useful when using a combobox as a line edit + with history. For example you can connect the combobox's + activated() signal to clearEdit() in order to present the user + with a new, empty line as soon as Enter is pressed. + + \sa setEditText() +*/ + +void TQComboBox::clearEdit() +{ + if ( d && d->ed ) + d->ed->clear(); +} + + +/*! + Sets the text in the line edit to \a newText without changing the + combobox's contents. Does nothing if the combobox isn't editable. + + This is useful e.g. for providing a good starting point for the + user's editing and entering the change in the combobox only when + the user presses Enter. + + \sa clearEdit() insertItem() +*/ + +void TQComboBox::setEditText( const TQString &newText ) +{ + if ( d && d->ed ) { + d->updateLinedGeometry(); + d->ed->setText( newText ); + } +} + +void TQComboBox::setAutoCompletion( bool enable ) +{ + d->useCompletion = enable; + d->completeNow = FALSE; +} + + +bool TQComboBox::autoCompletion() const +{ + return d->useCompletion; +} + +/*!\reimp + */ +void TQComboBox::styleChange( TQStyle& s ) +{ + d->sizeHint = TQSize(); // invalidate size hint... + if ( d->ed ) + d->updateLinedGeometry(); + TQWidget::styleChange( s ); +} + +bool TQComboBox::editable() const +{ + return d->ed != 0; +} + +void TQComboBox::setEditable( bool y ) +{ + if ( y == editable() ) + return; + if ( y ) { + if ( !d->usingListBox() ) + setUpListBox(); + setUpLineEdit(); + d->ed->show(); + if ( currentItem() ) + setEditText( currentText() ); + } else { + delete d->ed; + d->ed = 0; + } + + setFocusPolicy( StrongFocus ); + updateGeometry(); + update(); +} + + +void TQComboBox::setUpListBox() +{ + d->setListBox( new TQListBox( this, "in-combo", WType_Popup ) ); + d->listBox()->setFont( font() ); + d->listBox()->setPalette( palette() ); + d->listBox()->setVScrollBarMode( TQListBox::AlwaysOff ); + d->listBox()->setHScrollBarMode( TQListBox::AlwaysOff ); + d->listBox()->setFrameStyle( TQFrame::Box | TQFrame::Plain ); + d->listBox()->setLineWidth( 1 ); + d->listBox()->resize( 100, 10 ); + + connect( d->listBox(), TQ_SIGNAL(selected(int)), + TQ_SLOT(internalActivate(int)) ); + connect( d->listBox(), TQ_SIGNAL(highlighted(int)), + TQ_SLOT(internalHighlight(int))); +} + + +void TQComboBox::setUpLineEdit() +{ + if ( !d->ed ) + setLineEdit( new TQLineEdit( this, "combo edit" ) ); +} + +/*! + Sets the line edit to use \a edit instead of the current line edit. +*/ + +void TQComboBox::setLineEdit( TQLineEdit *edit ) +{ + if ( !edit ) { +#if defined(QT_CHECK_NULL) + Q_ASSERT( edit != 0 ); +#endif + return; + } + + edit->setText( currentText() ); + delete d->ed; + d->ed = edit; + + if ( edit->parent() != this ) + edit->reparent( this, TQPoint(0,0), FALSE ); + + connect (edit, TQ_SIGNAL( textChanged(const TQString&) ), + this, TQ_SIGNAL( textChanged(const TQString&) ) ); + connect( edit, TQ_SIGNAL(returnPressed()), TQ_SLOT(returnPressed()) ); + + edit->setFrame( FALSE ); + d->updateLinedGeometry(); + edit->installEventFilter( this ); + setFocusProxy( edit ); + setFocusPolicy( StrongFocus ); + setInputMethodEnabled( TRUE ); + + if ( !d->usingListBox() ) + setUpListBox(); + + if ( isVisible() ) + edit->show(); + + updateGeometry(); + update(); +} + +/*! + \reimp +*/ +void TQComboBox::hide() +{ + TQWidget::hide(); + + if (listBox()) + listBox()->hide(); + else if (d->popup()) + d->popup()->hide(); +} + +#endif // TQT_NO_COMBOBOX diff --git a/src/widgets/tqcombobox.h b/src/widgets/tqcombobox.h new file mode 100644 index 000000000..296148549 --- /dev/null +++ b/src/widgets/tqcombobox.h @@ -0,0 +1,206 @@ +/********************************************************************** +** +** Definition of TQComboBox class +** +** Created : 950426 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQCOMBOBOX_H +#define TQCOMBOBOX_H + +#ifndef QT_H +#include "tqwidget.h" +#endif // QT_H + +#ifndef TQT_NO_COMBOBOX + + +class TQStrList; +class TQStringList; +class TQLineEdit; +class TQValidator; +class TQListBox; +class TQComboBoxData; +class TQWheelEvent; + +class TQ_EXPORT TQComboBox : public TQWidget +{ + TQ_OBJECT + TQ_ENUMS( Policy ) + TQ_PROPERTY( bool editable READ editable WRITE setEditable ) + TQ_PROPERTY( int count READ count ) + TQ_PROPERTY( TQString currentText READ currentText WRITE setCurrentText DESIGNABLE false ) + TQ_PROPERTY( int currentItem READ currentItem WRITE setCurrentItem ) + TQ_PROPERTY( bool autoResize READ autoResize WRITE setAutoResize DESIGNABLE false ) + TQ_PROPERTY( int sizeLimit READ sizeLimit WRITE setSizeLimit ) + TQ_PROPERTY( int maxCount READ maxCount WRITE setMaxCount ) + TQ_PROPERTY( Policy insertionPolicy READ insertionPolicy WRITE setInsertionPolicy ) + TQ_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion ) + TQ_PROPERTY( bool duplicatesEnabled READ duplicatesEnabled WRITE setDuplicatesEnabled ) + TQ_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true ) + +public: + TQComboBox( TQWidget* parent=0, const char* name=0 ); + TQComboBox( bool rw, TQWidget* parent=0, const char* name=0 ); + ~TQComboBox(); + + int count() const; + + void insertStringList( const TQStringList &, int index=-1 ); + void insertStrList( const TQStrList &, int index=-1 ); + void insertStrList( const TQStrList *, int index=-1 ); + void insertStrList( const char **, int numStrings=-1, int index=-1); + + void insertItem( const TQString &text, int index=-1 ); + void insertItem( const TQPixmap &pixmap, int index=-1 ); + void insertItem( const TQPixmap &pixmap, const TQString &text, int index=-1 ); + + void removeItem( int index ); + + int currentItem() const; + virtual void setCurrentItem( int index ); + + TQString currentText() const; + virtual void setCurrentText( const TQString& ); + + TQString text( int index ) const; + const TQPixmap *pixmap( int index ) const; + + void changeItem( const TQString &text, int index ); + void changeItem( const TQPixmap &pixmap, int index ); + void changeItem( const TQPixmap &pixmap, const TQString &text, int index ); + + bool autoResize() const; + virtual void setAutoResize( bool ); + TQSize sizeHint() const; + + void setPalette( const TQPalette & ); + void setFont( const TQFont & ); + void setEnabled( bool ); + + virtual void setSizeLimit( int ); + int sizeLimit() const; + + virtual void setMaxCount( int ); + int maxCount() const; + + enum Policy { NoInsertion, AtTop, AtCurrent, AtBottom, + AfterCurrent, BeforeCurrent }; + + virtual void setInsertionPolicy( Policy policy ); + Policy insertionPolicy() const; + + virtual void setValidator( const TQValidator * ); + const TQValidator * validator() const; + + virtual void setListBox( TQListBox * ); + TQListBox * listBox() const; + + virtual void setLineEdit( TQLineEdit *edit ); + TQLineEdit* lineEdit() const; + + virtual void setAutoCompletion( bool ); + bool autoCompletion() const; + + bool eventFilter( TQObject *object, TQEvent *event ); + + void setDuplicatesEnabled( bool enable ); + bool duplicatesEnabled() const; + + bool editable() const; + void setEditable( bool ); + + virtual void popup(); + + void hide(); + +public slots: + void clear(); + void clearValidator(); + void clearEdit(); + virtual void setEditText( const TQString &); + +signals: + void activated( int index ); + void highlighted( int index ); + void activated( const TQString &); + void highlighted( const TQString &); + void textChanged( const TQString &); + +private slots: + void internalActivate( int ); + void internalHighlight( int ); + void internalClickTimeout(); + void returnPressed(); + +protected: + void paintEvent( TQPaintEvent * ); + void resizeEvent( TQResizeEvent * ); + void mousePressEvent( TQMouseEvent * ); + void mouseMoveEvent( TQMouseEvent * ); + void mouseReleaseEvent( TQMouseEvent * ); + void mouseDoubleClickEvent( TQMouseEvent * ); + void keyPressEvent( TQKeyEvent *e ); + void focusInEvent( TQFocusEvent *e ); + void focusOutEvent( TQFocusEvent *e ); +#ifndef TQT_NO_WHEELEVENT + void wheelEvent( TQWheelEvent *e ); +#endif + void styleChange( TQStyle& ); + + void updateMask(); + +private: + void setUpListBox(); + void setUpLineEdit(); + void popDownListBox(); + void reIndex(); + void currentChanged(); + int completionIndex( const TQString &, int ) const; + + TQComboBoxData *d; + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQComboBox( const TQComboBox & ); + TQComboBox &operator=( const TQComboBox & ); +#endif +}; + + +#endif // TQT_NO_COMBOBOX + +#endif // TQCOMBOBOX_H diff --git a/src/widgets/tqdial.cpp b/src/widgets/tqdial.cpp new file mode 100644 index 000000000..75793b5c1 --- /dev/null +++ b/src/widgets/tqdial.cpp @@ -0,0 +1,976 @@ +/**************************************************************************** +** +** Implementation of the dial widget +** +** Created : 979899 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqdial.h" + +#ifndef TQT_NO_DIAL + +#include "tqpainter.h" +#include "tqpointarray.h" +#include "tqcolor.h" +#include "ntqapplication.h" +#include "tqregion.h" +#include "tqbitmap.h" +#include "tqstyle.h" +#if defined(QT_ACCESSIBILITY_SUPPORT) +#include "ntqaccessible.h" +#endif + +#include // sin(), cos(), atan() +//### Forutsetter linking med math lib - Jfr kommentar i tqpainter_x11.cpp! + +static const double m_pi = 3.14159265358979323846; +static const double rad_factor = 180.0 / m_pi; + + +class TQDialPrivate +{ +public: + TQDialPrivate() + { + wrapping = FALSE; + tracking = TRUE; + doNotEmit = FALSE; + target = 3.7; + mousePressed = FALSE; + } + + bool wrapping; + bool tracking; + bool doNotEmit; + double target; + TQRect eraseArea; + bool eraseAreaValid; + bool showNotches; + bool onlyOutside; + bool mousePressed; + + TQPointArray lines; +}; + + +/*! + \class TQDial tqdial.h + + \brief The TQDial class provides a rounded range control (like a speedometer or potentiometer). + + \ingroup basic + \mainclass + + TQDial is used when the user needs to control a value within a + program-definable range, and the range either wraps around + (typically, 0..359 degrees) or the dialog layout needs a square + widget. + + Both API- and UI-wise, the dial is very similar to a \link TQSlider + slider. \endlink Indeed, when wrapping() is FALSE (the default) + there is no real difference between a slider and a dial. They + have the same signals, slots and member functions, all of which do + the same things. Which one you use depends only on your taste + and on the application. + + The dial initially emits valueChanged() signals continuously while + the slider is being moved; you can make it emit the signal less + often by calling setTracking(FALSE). dialMoved() is emitted + continuously even when tracking() is FALSE. + + The slider also emits dialPressed() and dialReleased() signals + when the mouse button is pressed and released. But note that the + dial's value can change without these signals being emitted; the + keyboard and wheel can be used to change the value. + + Unlike the slider, TQDial attempts to draw a "nice" number of + notches rather than one per lineStep(). If possible, the number + of notches drawn is one per lineStep(), but if there aren't enough + pixels to draw every one, TQDial will draw every second, third + etc., notch. notchSize() returns the number of units per notch, + hopefully a multiple of lineStep(); setNotchTarget() sets the + target distance between neighbouring notches in pixels. The + default is 3.75 pixels. + + Like the slider, the dial makes the TQRangeControl functions + setValue(), addLine(), subtractLine(), addPage() and + subtractPage() available as slots. + + The dial's keyboard interface is fairly simple: The left/up and + right/down arrow keys move by lineStep(), page up and page down by + pageStep() and Home and End to minValue() and maxValue(). + + + + \sa TQScrollBar TQSpinBox + \link guibooks.html#fowler GUI Design Handbook: Slider\endlink +*/ + + + + +/*! + Constructs a dial called \a name with parent \a parent. \a f is + propagated to the TQWidget constructor. It has the default range of + a TQRangeControl. +*/ + +TQDial::TQDial( TQWidget *parent, const char *name, WFlags f ) + : TQWidget( parent, name, f | WNoAutoErase ), TQRangeControl() +{ + d = new TQDialPrivate; + d->eraseAreaValid = FALSE; + d->showNotches = FALSE; + d->onlyOutside = FALSE; + setFocusPolicy( TQWidget::WheelFocus ); +} + + + +/*! + Constructs a dial called \a name with parent \a parent. The dial's + value can never be smaller than \a minValue or greater than \a + maxValue. Its page step size is \a pageStep, and its initial value + is \a value. + + \a value is forced to be within the legal range. +*/ + +TQDial::TQDial( int minValue, int maxValue, int pageStep, int value, + TQWidget *parent, const char *name ) + : TQWidget( parent, name, WNoAutoErase ), + TQRangeControl( minValue, maxValue, 1, pageStep, value ) +{ + d = new TQDialPrivate; + d->eraseAreaValid = FALSE; + d->showNotches = FALSE; + d->onlyOutside = FALSE; + setFocusPolicy( TQWidget::WheelFocus ); +} + +/*! + Destroys the dial. +*/ +TQDial::~TQDial() +{ + delete d; +} + + +void TQDial::setTracking( bool enable ) +{ + d->tracking = enable; +} + + +/*! + \property TQDial::tracking + \brief whether tracking is enabled + + If TRUE (the default), tracking is enabled. This means that the + arrow can be moved using the mouse; otherwise the arrow cannot be + moved with the mouse. +*/ + +bool TQDial::tracking() const +{ + return d ? d->tracking : TRUE; +} + +void TQDial::setValue( int newValue ) +{ // ### set doNotEmit? Matthias? + TQRangeControl::setValue( newValue ); +} + + +/*! + Increments the dial's value() by one lineStep(). +*/ + +void TQDial::addLine() +{ + TQRangeControl::addLine(); +} + + +/*! + Decrements the dial's value() by one lineStep(). +*/ + +void TQDial::subtractLine() +{ + TQRangeControl::subtractLine(); +} + + +/*! \reimp */ + +void TQDial::resizeEvent( TQResizeEvent * e ) +{ + d->lines.resize( 0 ); + TQWidget::resizeEvent( e ); +} + + +/*! + \reimp +*/ + +void TQDial::paintEvent( TQPaintEvent * e ) +{ + repaintScreen( &e->rect() ); +} + +/*! + Paints the dial using clip region \a cr. +*/ + +void TQDial::repaintScreen( const TQRect *cr ) +{ + TQPainter p; + p.begin( this ); + + bool resetClipping = FALSE; + + // calculate clip-region for erasing background + if ( cr ) { + p.setClipRect( *cr ); + } else if ( !d->onlyOutside && d->eraseAreaValid ) { + TQRegion reg = d->eraseArea; + double a; + reg = reg.subtract( calcArrow( a ) ); + p.setClipRegion( reg ); + resetClipping = TRUE; + } + + TQRect br( calcDial() ); + p.setPen( NoPen ); + // if ( style() == MotifStyle ) + // p.setBrush( colorGroup().brush( TQColorGroup::Mid ) ); + // else { + TQBrush b; + if ( colorGroup().brush( TQColorGroup::Light ).pixmap() ) + b = TQBrush( colorGroup().brush( TQColorGroup::Light ) ); + else + b = TQBrush( colorGroup().light(), Dense4Pattern ); + p.setBrush( b ); + p.setBackgroundMode( OpaqueMode ); + // } + + TQRect te = br; + te.setWidth(te.width()+2); + te.setHeight(te.height()+2); + // erase background of dial + if ( !d->onlyOutside ) { + p.drawEllipse( te ); + } + + // erase remaining space around the dial + TQRegion remaining( 0, 0, width(), height() ); + remaining = remaining.subtract( TQRegion( te, TQRegion::Ellipse ) ); + if ( p.hasClipping() ) + remaining = remaining.intersect( p.clipRegion() ); + erase(remaining); + + if ( resetClipping ) { + if ( cr ) + p.setClipRect( *cr ); + else + p.setClipRect( TQRect( 0, 0, width(), height() ) ); + } + + // draw notches + if ( d->showNotches ) { + calcLines(); + p.setPen( colorGroup().foreground() ); + p.drawLineSegments( d->lines ); + } + + // calculate and paint arrow + p.setPen( TQPen( colorGroup().dark() ) ); + p.drawArc( te, 60 * 16, 180 * 16 ); + p.setPen( TQPen( colorGroup().light() ) ); + p.drawArc( te, 240 * 16, 180 * 16 ); + + double a; + TQPointArray arrow( calcArrow( a ) ); + TQRect ea( arrow.boundingRect() ); + d->eraseArea = ea; + d->eraseAreaValid = TRUE; + + p.setPen( NoPen ); + p.setBrush( colorGroup().brush( TQColorGroup::Button ) ); + if ( !d->onlyOutside ) + p.drawPolygon( arrow ); + + a = angle( TQPoint( width() / 2, height() / 2 ), arrow[ 0 ] ); + p.setBrush( TQt::NoBrush ); + + // that's still a hack... + if ( a <= 0 || a > 200 ) { + p.setPen( colorGroup().light() ); + p.drawLine( arrow[ 2 ], arrow[ 0 ] ); + p.drawLine( arrow[ 1 ], arrow[ 2 ] ); + p.setPen( colorGroup().dark() ); + p.drawLine( arrow[ 0 ], arrow[ 1 ] ); + } else if ( a > 0 && a < 45 ) { + p.setPen( colorGroup().light() ); + p.drawLine( arrow[ 2 ], arrow[ 0 ] ); + p.setPen( colorGroup().dark() ); + p.drawLine( arrow[ 1 ], arrow[ 2 ] ); + p.drawLine( arrow[ 0 ], arrow[ 1 ] ); + } else if ( a >= 45 && a < 135 ) { + p.setPen( colorGroup().dark() ); + p.drawLine( arrow[ 2 ], arrow[ 0 ] ); + p.drawLine( arrow[ 1 ], arrow[ 2 ] ); + p.setPen( colorGroup().light() ); + p.drawLine( arrow[ 0 ], arrow[ 1 ] ); + } else if ( a >= 135 && a < 200 ) { + p.setPen( colorGroup().dark() ); + p.drawLine( arrow[ 2 ], arrow[ 0 ] ); + p.setPen( colorGroup().light() ); + p.drawLine( arrow[ 0 ], arrow[ 1 ] ); + p.drawLine( arrow[ 1 ], arrow[ 2 ] ); + } + + // draw focus rect around the dial + if ( hasFocus() ) { + p.setClipping( FALSE ); + br.setWidth( br.width() + 2 ); + br.setHeight( br.height() + 2 ); + if ( d->showNotches ) { + int r = TQMIN( width(), height() ) / 2; + br.moveBy( -r / 6, - r / 6 ); + br.setWidth( br.width() + r / 3 ); + br.setHeight( br.height() + r / 3 ); + } + // strange, but else we get redraw errors on Windows + p.end(); + p.begin( this ); + p.save(); + p.setPen( TQPen( colorGroup().background() ) ); + p.setBrush( NoBrush ); + p.drawRect( br ); + p.restore(); + style().drawPrimitive( TQStyle::PE_FocusRect, &p, br, colorGroup()); + } + p.end(); +} + + +/*! + \reimp +*/ + +void TQDial::keyPressEvent( TQKeyEvent * e ) +{ + switch ( e->key() ) { + case Key_Left: case Key_Down: + subtractLine(); + break; + case Key_Right: case Key_Up: + addLine(); + break; + case Key_Prior: + subtractPage(); + break; + case Key_Next: + addPage(); + break; + case Key_Home: + setValue( minValue() ); + break; + case Key_End: + setValue( maxValue() ); + break; + default: + e->ignore(); + break; + } +} + + +/*! + \reimp +*/ + +void TQDial::mousePressEvent( TQMouseEvent * e ) +{ + d->mousePressed = TRUE; + setValue( valueFromPoint( e->pos() ) ); + emit dialPressed(); +} + + +/*! + \reimp +*/ + +void TQDial::mouseReleaseEvent( TQMouseEvent * e ) +{ + d->mousePressed = FALSE; + setValue( valueFromPoint( e->pos() ) ); + emit dialReleased(); +} + + +/*! + \reimp +*/ + +void TQDial::mouseMoveEvent( TQMouseEvent * e ) +{ + if ( !d->mousePressed ) + return; + if ( !d->tracking || (e->state() & LeftButton) == 0 ) + return; + d->doNotEmit = TRUE; + setValue( valueFromPoint( e->pos() ) ); + emit dialMoved( value() ); + d->doNotEmit = FALSE; +} + + +/*! + \reimp +*/ +#ifndef TQT_NO_WHEELEVENT +void TQDial::wheelEvent( TQWheelEvent *e ) +{ + setValue( value() - e->delta() / 120 ); +} +#endif + +/*! + \reimp +*/ + +void TQDial::focusInEvent( TQFocusEvent * ) +{ + d->onlyOutside = TRUE; + repaintScreen(); + d->onlyOutside = FALSE; +} + + +/*! + \reimp +*/ + +void TQDial::focusOutEvent( TQFocusEvent * ) +{ + d->onlyOutside = TRUE; + repaintScreen(); + d->onlyOutside = FALSE; +} + +/*! + Reimplemented to ensure the display is correct and to emit the + valueChanged(int) signal when appropriate. +*/ + +void TQDial::valueChange() +{ + d->lines.resize( 0 ); + repaintScreen(); + if ( d->tracking || !d->doNotEmit ) { + emit valueChanged( value() ); +#if defined(QT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); +#endif + } +} + + +/*! + Reimplemented to ensure tick-marks are consistent with the new range. +*/ + +void TQDial::rangeChange() +{ + d->lines.resize( 0 ); + repaintScreen(); +} + + +/*! + \internal +*/ + +int TQDial::valueFromPoint( const TQPoint & p ) const +{ + double yy = (double)height()/2.0 - p.y(); + double xx = (double)p.x() - width()/2.0; + double a = (xx || yy) ? atan2(yy, xx) : 0; + + if ( a < m_pi/-2 ) + a = a + m_pi*2; + + int dist = 0; + int minv = minValue(), maxv = maxValue(); + + if ( minValue() < 0 ) { + dist = -minValue(); + minv = 0; + maxv = maxValue() + dist; + } + + int r = maxv - minv; + int v; + if ( d->wrapping ) + v = (int)(0.5 + minv + r*(m_pi*3/2-a)/(2*m_pi)); + else + v = (int)(0.5 + minv + r*(m_pi*4/3-a)/(m_pi*10/6)); + + if ( dist > 0 ) + v -= dist; + + return bound( v ); +} + + +/*! + \internal +*/ + +double TQDial::angle( const TQPoint &p1, const TQPoint &p2 ) const +{ + double _angle = 0.0; + + if ( p1.x() == p2.x() ) { + if ( p1.y() < p2.y() ) + _angle = 270.0; + else + _angle = 90.0; + } else { + double x1, x2, y1, y2; + + if ( p1.x() <= p2.x() ) { + x1 = p1.x(); y1 = p1.y(); + x2 = p2.x(); y2 = p2.y(); + } else { + x2 = p1.x(); y2 = p1.y(); + x1 = p2.x(); y1 = p2.y(); + } + + double m = -( y2 - y1 ) / ( x2 - x1 ); + _angle = atan( m ) * rad_factor; + + if ( p1.x() < p2.x() ) + _angle = 180.0 - _angle; + else + _angle = -_angle; + } + + return _angle; +} + +void TQDial::setWrapping( bool enable ) +{ + if ( d->wrapping == enable ) + return; + d->lines.resize( 0 ); + d->wrapping = enable; + d->eraseAreaValid = FALSE; + repaintScreen(); +} + + +/*! + \property TQDial::wrapping + \brief whether wrapping is enabled + + If TRUE, wrapping is enabled. This means that the arrow can be + turned around 360. Otherwise there is some space at the bottom of + the dial which is skipped by the arrow. + + This property's default is FALSE. +*/ + +bool TQDial::wrapping() const +{ + return d->wrapping; +} + + +/*! + \property TQDial::notchSize + \brief the current notch size + + The notch size is in range control units, not pixels, and if + possible it is a multiple of lineStep() that results in an + on-screen notch size near notchTarget(). + + \sa notchTarget() lineStep() +*/ + +int TQDial::notchSize() const +{ + // radius of the arc + int r = TQMIN( width(), height() )/2; + // length of the whole arc + int l = (int)(r*(d->wrapping ? 6 : 5)*m_pi/6); + // length of the arc from minValue() to minValue()+pageStep() + if ( maxValue() > minValue()+pageStep() ) + l = (int)(0.5 + l * pageStep() / (maxValue()-minValue())); + // length of a lineStep() arc + l = l * lineStep() / pageStep(); + if ( l < 1 ) + l = 1; + // how many times lineStep can be draw in d->target pixels + l = (int)(0.5 + d->target / l); + // we want notchSize() to be a non-zero multiple of lineStep() + if ( !l ) + l = 1; + return lineStep() * l; +} + +void TQDial::setNotchTarget( double target ) +{ + d->lines.resize( 0 ); + d->target = target; + d->eraseAreaValid = FALSE; + d->onlyOutside = TRUE; + repaintScreen(); + d->onlyOutside = FALSE; +} + + +/*! + \property TQDial::notchTarget + \brief the target number of pixels between notches + + The notch target is the number of pixels TQDial attempts to put + between each notch. + + The actual size may differ from the target size. +*/ + +double TQDial::notchTarget() const +{ + return d->target; +} + + +/*! + Increments the dial's value() by one pageStep() of steps. +*/ + +void TQDial::addPage() +{ + TQRangeControl::addPage(); +} + + +/*! + Decrements the dial's value() by one pageStep() of steps. +*/ + +void TQDial::subtractPage() +{ + TQRangeControl::subtractPage(); +} + + +/*! + \fn void TQDial::valueChanged( int value ) + + This signal is emitted whenever the dial's \a value changes. The + frequency of this signal is influenced by setTracking(). +*/ + +/*! + \fn void TQDial::dialPressed() + + This signal is emitted when the user begins mouse interaction with + the dial. + + \sa dialReleased() +*/ + +/*! + \fn void TQDial::dialMoved( int value ) + + This signal is emitted whenever the dial \a value changes. The + frequency of this signal is \e not influenced by setTracking(). + + \sa valueChanged() +*/ + +/*! + \fn void TQDial::dialReleased() + + This signal is emitted when the user ends mouse interaction with + the dial. + + \sa dialPressed() +*/ + +void TQDial::setNotchesVisible( bool b ) +{ + d->showNotches = b; + d->eraseAreaValid = FALSE; + d->onlyOutside = TRUE; + repaintScreen(); + d->onlyOutside = FALSE; +} + +/*! + \property TQDial::notchesVisible + \brief whether the notches are shown + + If TRUE, the notches are shown. If FALSE (the default) notches are + not shown. +*/ +bool TQDial::notchesVisible() const +{ + return d->showNotches; +} + +/*! + \reimp +*/ + +TQSize TQDial::minimumSizeHint() const +{ + return TQSize( 50, 50 ); +} + +/*! + \reimp +*/ + +TQSize TQDial::sizeHint() const +{ + return TQSize( 100, 100 ).expandedTo( TQApplication::globalStrut() ); +} + + + +/*! + \internal +*/ + +TQPointArray TQDial::calcArrow( double &a ) const +{ + int r = TQMIN( width(), height() ) / 2; + if ( maxValue() == minValue() ) + a = m_pi / 2; + else if ( d->wrapping ) + a = m_pi * 3 / 2 - ( value() - minValue() ) * 2 * m_pi / ( maxValue() - minValue() ); + else + a = ( m_pi * 8 - ( value() - minValue() ) * 10 * m_pi / ( maxValue() - minValue() ) ) / 6; + + int xc = width() / 2; + int yc = height() / 2; + + int len = r - calcBigLineSize() - 5; + if ( len < 5 ) + len = 5; + int back = len / 4; + if ( back < 1 ) + back = 1; + + TQPointArray arrow( 3 ); + arrow[0] = TQPoint( (int)( 0.5 + xc + len * cos(a) ), + (int)( 0.5 + yc -len * sin( a ) ) ); + arrow[1] = TQPoint( (int)( 0.5 + xc + back * cos( a + m_pi * 5 / 6 ) ), + (int)( 0.5 + yc - back * sin( a + m_pi * 5 / 6 ) ) ); + arrow[2] = TQPoint( (int)( 0.5 + xc + back * cos( a - m_pi * 5 / 6 ) ), + (int)( 0.5 + yc - back * sin( a - m_pi * 5 / 6 ) ) ); + return arrow; +} + +/*! + \internal +*/ + +TQRect TQDial::calcDial() const +{ + double r = TQMIN( width(), height() ) / 2.0; + double d_ = r / 6.0; + double dx = d_ + ( width() - 2 * r ) / 2.0 + 1; + double dy = d_ + ( height() - 2 * r ) / 2.0 + 1; + return TQRect( int(dx), int(dy), + int(r * 2 - 2 * d_ - 2), int(r * 2 - 2 * d_ - 2) ); +} + +/*! + \internal +*/ + +int TQDial::calcBigLineSize() const +{ + int r = TQMIN( width(), height() ) / 2; + int bigLineSize = r / 6; + if ( bigLineSize < 4 ) + bigLineSize = 4; + if ( bigLineSize > r / 2 ) + bigLineSize = r / 2; + return bigLineSize; +} + +/*! + \internal +*/ + +void TQDial::calcLines() +{ + if ( !d->lines.size() ) { + double r = TQMIN( width(), height() ) / 2.0; + int bigLineSize = calcBigLineSize(); + double xc = width() / 2.0; + double yc = height() / 2.0; + int ns = notchSize(); + int notches = ( maxValue() + ns - 1 - minValue() ) / ns; + d->lines.resize( 2 + 2 * notches ); + int smallLineSize = bigLineSize / 2; + int i; + for( i = 0; i <= notches; i++ ) { + double angle = d->wrapping + ? m_pi * 3 / 2 - i * 2 * m_pi / notches + : (m_pi * 8 - i * 10 * m_pi / notches) / 6; + + double s = sin( angle ); // sin/cos aren't defined as const... + double c = cos( angle ); + if ( i == 0 || ( ((ns * i ) % pageStep() ) == 0 ) ) { + d->lines[2*i] = TQPoint( (int)( xc + ( r - bigLineSize ) * c ), + (int)( yc - ( r - bigLineSize ) * s ) ); + d->lines[2*i+1] = TQPoint( (int)( xc + r * c ), + (int)( yc - r * s ) ); + } else { + d->lines[2*i] = TQPoint( (int)( xc + ( r - 1 - smallLineSize ) * c ), + (int)( yc - ( r - 1 - smallLineSize ) * s ) ); + d->lines[2*i+1] = TQPoint( (int)( xc + ( r - 1 ) * c ), + (int)( yc -( r - 1 ) * s ) ); + } + } + } +} + +/*! + \property TQDial::minValue + \brief the current minimum value + + When setting this property, the \l TQDial::maxValue is adjusted if + necessary to ensure that the range remains valid. + + \sa setRange() +*/ +int TQDial::minValue() const +{ + return TQRangeControl::minValue(); +} + +/*! + \property TQDial::maxValue + \brief the current maximum value + + When setting this property, the \l TQDial::minValue is adjusted if + necessary to ensure that the range remains valid. + + \sa setRange() +*/ +int TQDial::maxValue() const +{ + return TQRangeControl::maxValue(); +} + +void TQDial::setMinValue( int minVal ) +{ + TQRangeControl::setMinValue( minVal ); +} + +void TQDial::setMaxValue( int maxVal ) +{ + TQRangeControl::setMaxValue( maxVal ); +} + +/*! + \property TQDial::lineStep + \brief the current line step + + setLineStep() calls the virtual stepChange() function if the new + line step is different from the previous setting. + + \sa TQRangeControl::setSteps() pageStep setRange() +*/ + +int TQDial::lineStep() const +{ + return TQRangeControl::lineStep(); +} + +/*! + \property TQDial::pageStep + \brief the current page step + + setPageStep() calls the virtual stepChange() function if the new + page step is different from the previous setting. + + \sa stepChange() +*/ +int TQDial::pageStep() const +{ + return TQRangeControl::pageStep(); +} + +void TQDial::setLineStep( int i ) +{ + setSteps( i, pageStep() ); +} + +void TQDial::setPageStep( int i ) +{ + setSteps( lineStep(), i ); +} + +/*! + \property TQDial::value + \brief the current dial value + + This is guaranteed to be within the range + \l{TQDial::minValue}..\l{TQDial::maxValue}. + + \sa minValue maxValue +*/ + +int TQDial::value() const +{ + return TQRangeControl::value(); +} + +#endif // QT_FEATURE_DIAL diff --git a/src/widgets/tqdial.h b/src/widgets/tqdial.h new file mode 100644 index 000000000..7baf98e53 --- /dev/null +++ b/src/widgets/tqdial.h @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Definition of the dial widget +** +** Created : 990104 +** +** Copyright (C) 1999-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + + +#ifndef TQDIAL_H +#define TQDIAL_H + +#ifndef QT_H +#include "tqwidget.h" +#include "ntqrangecontrol.h" +#endif // QT_H + +#ifndef TQT_NO_DIAL + +class TQDialPrivate; + +class TQ_EXPORT TQDial: public TQWidget, public TQRangeControl +{ + TQ_OBJECT + TQ_PROPERTY( bool tracking READ tracking WRITE setTracking ) + TQ_PROPERTY( bool wrapping READ wrapping WRITE setWrapping ) + TQ_PROPERTY( int notchSize READ notchSize ) + TQ_PROPERTY( double notchTarget READ notchTarget WRITE setNotchTarget ) + TQ_PROPERTY( bool notchesVisible READ notchesVisible WRITE setNotchesVisible ) + TQ_PROPERTY( int minValue READ minValue WRITE setMinValue ) + TQ_PROPERTY( int maxValue READ maxValue WRITE setMaxValue ) + TQ_PROPERTY( int lineStep READ lineStep WRITE setLineStep ) + TQ_PROPERTY( int pageStep READ pageStep WRITE setPageStep ) + TQ_PROPERTY( int value READ value WRITE setValue ) + +public: + TQDial( TQWidget* parent=0, const char* name=0, WFlags f = 0 ); + TQDial( int minValue, int maxValue, int pageStep, int value, + TQWidget* parent=0, const char* name=0 ); + ~TQDial(); + + bool tracking() const; + + bool wrapping() const; + + int notchSize() const; + + virtual void setNotchTarget( double ); + double notchTarget() const; + + bool notchesVisible() const; + + TQSize sizeHint() const; + TQSize minimumSizeHint() const; + + int minValue() const; + int maxValue() const; + void setMinValue( int ); + void setMaxValue( int ); + int lineStep() const; + int pageStep() const; + void setLineStep( int ); + void setPageStep( int ); + int value() const; + +public slots: + virtual void setValue( int ); + void addLine(); + void subtractLine(); + void addPage(); + void subtractPage(); + virtual void setNotchesVisible( bool b ); + virtual void setWrapping( bool on ); + virtual void setTracking( bool enable ); + +signals: + void valueChanged( int value ); + void dialPressed(); + void dialMoved( int value ); + void dialReleased(); + +protected: + void resizeEvent( TQResizeEvent * ); + void paintEvent( TQPaintEvent * ); + + void keyPressEvent( TQKeyEvent * ); + void mousePressEvent( TQMouseEvent * ); + void mouseReleaseEvent( TQMouseEvent * ); + void mouseMoveEvent( TQMouseEvent * ); +#ifndef TQT_NO_WHEELEVENT + void wheelEvent( TQWheelEvent * ); +#endif + void focusInEvent( TQFocusEvent * ); + void focusOutEvent( TQFocusEvent * ); + + void valueChange(); + void rangeChange(); + + virtual void repaintScreen( const TQRect *cr = 0 ); + +private: + TQDialPrivate * d; + + int valueFromPoint( const TQPoint & ) const; + double angle( const TQPoint &, const TQPoint & ) const; + TQPointArray calcArrow( double &a ) const; + TQRect calcDial() const; + int calcBigLineSize() const; + void calcLines(); + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQDial( const TQDial & ); + TQDial &operator=( const TQDial & ); +#endif + +}; + +#endif // TQT_NO_DIAL + +#endif diff --git a/src/widgets/tqdialogbuttons.cpp b/src/widgets/tqdialogbuttons.cpp new file mode 100644 index 000000000..b20f70350 --- /dev/null +++ b/src/widgets/tqdialogbuttons.cpp @@ -0,0 +1,462 @@ +/**************************************************************************** +** +** Implementation of TQDialogButtons class +** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqdialogbuttons_p.h" +#ifndef TQT_NO_DIALOGBUTTONS + +#include +#include +#include +#include +#include +#ifndef TQT_NO_DIALOG +#include +#endif // TQT_NO_DIALOG +#include +#include +#include + +struct TQDialogButtonsPrivate +{ + TQMap text; + TQMap buttons; + TQGuardedPtr custom; + TQ_UINT32 enabled, visible; + TQDialogButtons::Button def; + TQt::Orientation orient; + bool questionMode; +}; + +#ifndef TQT_NO_DIALOG +TQDialogButtons::TQDialogButtons(TQDialog *parent, bool autoConnect, TQ_UINT32 buttons, + Orientation orient, const char *name ) : TQWidget(parent, name) +{ + init(buttons, orient); + if(parent && autoConnect) { + TQObject::connect(this, TQ_SIGNAL(acceptClicked()), parent, TQ_SLOT(accept())); + TQObject::connect(this, TQ_SIGNAL(rejectClicked()), parent, TQ_SLOT(reject())); + } +} +#endif // TQT_NO_DIALOG + +TQDialogButtons::TQDialogButtons(TQWidget *parent, TQ_UINT32 buttons, + Orientation orient, const char *name ) : TQWidget(parent, name) +{ + init(buttons, orient); +} + +void +TQDialogButtons::init(TQ_UINT32 buttons, Orientation orient) +{ + if(buttons == All) { + tqWarning("TQDialogButtons: cannot specify All by itself!"); + buttons = None; + } + d = new TQDialogButtonsPrivate; + d->questionMode = FALSE; + d->orient = orient; + d->def = (Button)style().styleHint(TQStyle::SH_DialogButtons_DefaultButton, this); + d->enabled = d->visible = buttons; +} + +TQDialogButtons::~TQDialogButtons() +{ + delete (TQWidget *)d->custom; + delete d; +} + +void +TQDialogButtons::setQuestionMode(bool b) +{ + d->questionMode = b; +} + +bool +TQDialogButtons::questionMode() const +{ + return d->questionMode; +} + +void +TQDialogButtons::setButtonEnabled(Button button, bool enabled) +{ + if(enabled) + d->enabled |= button; + else + d->enabled ^= button; + if(d->buttons.contains(button)) + d->buttons[button]->setEnabled(enabled); +} + +bool +TQDialogButtons::isButtonEnabled(Button button) const +{ + return ((int)(d->enabled & button)) == button; +} + +void +TQDialogButtons::setButtonVisible(Button button, bool visible) +{ + if(visible) { + if(d->buttons.contains(button)) + d->buttons[button]->show(); + d->visible |= button; + } else { + if(d->buttons.contains(button)) + d->buttons[button]->hide(); + d->visible ^= button; + } + layoutButtons(); +} + +bool +TQDialogButtons::isButtonVisible(Button button) const +{ + return ((int)(d->visible & button)) == button; +} + +TQ_UINT32 +TQDialogButtons::visibleButtons() const +{ + return d->visible; +} + +void +TQDialogButtons::addWidget(TQWidget *w) +{ + TQBoxLayout *lay = NULL; + if(!d->custom) { + d->custom = new TQWidget(this, "dialog_custom_area"); + if(orientation() == Horizontal) + lay = new TQHBoxLayout(d->custom); + else + lay = new TQVBoxLayout(d->custom); + layoutButtons(); + } else { + lay = (TQBoxLayout*)d->custom->layout(); + } + if(w->parent() != d->custom) + w->reparent(d->custom, 0, TQPoint(0, 0), TRUE); + lay->addWidget(w); +} + +void +TQDialogButtons::setDefaultButton(Button button) +{ + if(!((int)(d->visible & button) == button)) { + tqWarning("TQDialogButtons: Button '%d' is not visible (so cannot be default)", button); + return; + } + if(d->def != button) { +#ifndef TQT_NO_PROPERTIES + if(d->buttons.contains(d->def)) + d->buttons[d->def]->setProperty("default", TQVariant(false)); +#endif + d->def = button; +#ifndef TQT_NO_PROPERTIES + if(d->buttons.contains(d->def)) + d->buttons[d->def]->setProperty("default", TQVariant(false)); +#endif + } +} + +TQDialogButtons::Button +TQDialogButtons::defaultButton() const +{ + return d->def; +} + +void +TQDialogButtons::setButtonText(Button button, const TQString &str) +{ + d->text[button] = str; +#ifndef TQT_NO_PROPERTIES + if(d->buttons.contains(button)) + d->buttons[button]->setProperty("text", TQVariant(str)); +#endif + layoutButtons(); +} + +TQString +TQDialogButtons::buttonText(Button b) const +{ + if(d->text.contains(b)) + return d->text[b]; + return TQString(); //null if it is default.. +} + +void +TQDialogButtons::setOrientation(Orientation orient) +{ + if(d->orient != orient) { + d->orient = orient; + if(d->custom && d->custom->layout()) + ((TQBoxLayout*)d->custom->layout())->setDirection(orient == Horizontal ? TQBoxLayout::LeftToRight : + TQBoxLayout::TopToBottom); + layoutButtons(); + } +} + +TQt::Orientation +TQDialogButtons::orientation() const +{ + return d->orient; +} + +TQWidget * +TQDialogButtons::createButton(Button b) +{ + TQPushButton *ret = new TQPushButton(this, "tqdialog_button"); + TQObject::connect(ret, TQ_SIGNAL(clicked()), this, TQ_SLOT(handleClicked())); + if(d->text.contains(b)) { + ret->setText(d->text[b]); + } else { + switch(b) { + case All: { + TQString txt = buttonText(defaultButton()); + if(txt.isNull()) { + if(defaultButton() == Accept) { + if(questionMode()) + txt = tr("Yes to All"); + else + txt = tr("OK to All"); + } else { + if(questionMode()) + txt = tr("No to All"); + else + txt = tr("Cancel All"); + } + } else { + txt += tr(" to All"); //ick, I can't really do this!! + } + ret->setText(txt); + break; } + case Accept: + if(questionMode()) + ret->setText(tr("Yes")); + else + ret->setText(tr("OK")); + break; + case Reject: + if(questionMode()) + ret->setText(tr("No")); + else + ret->setText(tr("Cancel")); + break; + case Apply: + ret->setText(tr("Apply")); + break; + case Ignore: + ret->setText(tr("Ignore")); + break; + case Retry: + ret->setText(tr("Retry")); + break; + case Abort: + ret->setText(tr("Abort")); + break; + case Help: + ret->setText(tr("Help")); + break; + default: + break; + } + } + return ret; +} + +void +TQDialogButtons::handleClicked() +{ + const TQObject *s = sender(); + if(!s) + return; + + for(TQMapIterator it = d->buttons.begin(); it != d->buttons.end(); ++it) { + if(it.data() == s) { + emit clicked((TQDialogButtons::Button)it.key()); + switch(it.key()) { + case Retry: + emit retryClicked(); + break; + case Ignore: + emit ignoreClicked(); + break; + case Abort: + emit abortClicked(); + break; + case All: + emit allClicked(); + break; + case Accept: + emit acceptClicked(); + break; + case Reject: + emit rejectClicked(); + break; + case Apply: + emit applyClicked(); + break; + case Help: + emit helpClicked(); + break; + default: + break; + } + return; + } + } +} + +void +TQDialogButtons::resizeEvent(TQResizeEvent *) +{ + layoutButtons(); +} + +void +TQDialogButtons::showEvent(TQShowEvent *) +{ + layoutButtons(); +} + +void +TQDialogButtons::styleChanged(TQStyle &old) +{ + layoutButtons(); + TQWidget::styleChange(old); +} + +void +TQDialogButtons::layoutButtons() +{ + if(!isVisible()) //nah.. + return; + + TQStyle::SubRect rects[] = { + TQStyle::SR_DialogButtonAccept, TQStyle::SR_DialogButtonReject, + TQStyle::SR_DialogButtonApply, TQStyle::SR_DialogButtonHelp, + TQStyle::SR_DialogButtonCustom, TQStyle::SR_DialogButtonAll, + TQStyle::SR_DialogButtonRetry, TQStyle::SR_DialogButtonIgnore, + TQStyle::SR_DialogButtonAbort }; + for(unsigned int i = 0; i < (sizeof(rects) / sizeof(rects[0])); i++) { + TQWidget *w = NULL; + if(rects[i] == TQStyle::SR_DialogButtonCustom) { + w = d->custom; + } else { + Button b = None; + if(rects[i] == TQStyle::SR_DialogButtonApply) + b = Apply; + else if(rects[i] == TQStyle::SR_DialogButtonAll) + b = All; + else if(rects[i] == TQStyle::SR_DialogButtonAccept) + b = Accept; + else if(rects[i] == TQStyle::SR_DialogButtonReject) + b = Reject; + else if(rects[i] == TQStyle::SR_DialogButtonHelp) + b = Help; + else if(rects[i] == TQStyle::SR_DialogButtonRetry) + b = Retry; + else if(rects[i] == TQStyle::SR_DialogButtonAbort) + b = Abort; + else if(rects[i] == TQStyle::SR_DialogButtonIgnore) + b = Ignore; + if(b != None) { + if(d->buttons.contains(b)) { + w = d->buttons[b]; + if(!(d->visible & b)) { + w->hide(); + continue; + } + } else if(d->visible & b) { + w = createButton(b); + d->buttons.insert(b, w); + } else { + continue; + } + if(w) { + if(b == d->def) { + w->setFocus(); +#ifndef TQT_NO_PROPERTIES + w->setProperty("default", TQVariant(true)); +#endif + } + w->setEnabled(d->enabled & b); + } + } + } + if(w) { + w->show(); + w->setGeometry(style().subRect(rects[i], this)); + } + } +} + +TQSize +TQDialogButtons::sizeHint() const +{ + constPolish(); + TQSize s; + if(d->custom) + s = d->custom->sizeHint(); + return (style().sizeFromContents(TQStyle::CT_DialogButtons, this, s. + expandedTo(TQApplication::globalStrut()))); +} + +TQSize +TQDialogButtons::sizeHint(TQDialogButtons::Button button) const +{ + TQWidget *w = NULL; + if(d->visible & button) { + if(!d->buttons.contains(button)) { + TQDialogButtons *that = (TQDialogButtons*)this; //ick, constness.. + w = that->createButton(button); + that->d->buttons.insert(button, w); + } else { + w = d->buttons[button]; + } + } + return w->sizeHint(); +} + +TQSize +TQDialogButtons::minimumSizeHint() const +{ + return sizeHint(); +} +#endif diff --git a/src/widgets/tqdialogbuttons_p.h b/src/widgets/tqdialogbuttons_p.h new file mode 100644 index 000000000..a5667245f --- /dev/null +++ b/src/widgets/tqdialogbuttons_p.h @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Definition of TQDialogButtons class. +** +** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQDIALOGBUTTONS_P_H +#define TQDIALOGBUTTONS_P_H + +#ifndef QT_H +#ifndef QT_H +#include "tqwidget.h" +#endif // QT_H +#endif + +#ifndef TQT_NO_DIALOGBUTTONS +struct TQDialogButtonsPrivate; + +class +TQDialogButtons : public TQWidget +{ + TQ_OBJECT +public: + enum Button { None=0, Accept=0x01, Reject=0x02, Help=0x04, Apply=0x08, All=0x10, Abort=0x20, Retry=0x40, Ignore=0x80 }; +#ifndef TQT_NO_DIALOG + TQDialogButtons(TQDialog *parent, bool autoConnect = TRUE, TQ_UINT32 buttons = Accept | Reject, + Orientation orient = Horizontal, const char *name = NULL); +#endif // TQT_NO_DIALOG + TQDialogButtons(TQWidget *parent, TQ_UINT32 buttons = Accept | Reject, + Orientation orient = Horizontal, const char *name = NULL); + ~TQDialogButtons(); + + void setQuestionMode(bool); + bool questionMode() const; + + void setButtonEnabled(Button button, bool enabled); + bool isButtonEnabled(Button) const; + + inline void showButton(Button b) { setButtonVisible(b, TRUE) ; } + inline void hideButton(Button b) { setButtonVisible(b, FALSE); } + virtual void setButtonVisible(Button, bool visible); + bool isButtonVisible(Button) const; + TQ_UINT32 visibleButtons() const; + + void addWidget(TQWidget *); + + virtual void setDefaultButton(Button); + Button defaultButton() const; + + virtual void setButtonText(Button, const TQString &); + TQString buttonText(Button) const; + + void setOrientation(Orientation); + Orientation orientation() const; + + virtual TQSize sizeHint(Button) const; + TQSize minimumSizeHint() const; + TQSize sizeHint() const; + +protected: + void layoutButtons(); + virtual TQWidget *createButton(Button); + + void showEvent(TQShowEvent *); + void resizeEvent(TQResizeEvent *); + void styleChanged(TQStyle &); + +private slots: + void handleClicked(); + +signals: + void clicked(Button); + void acceptClicked(); + void rejectClicked(); + void helpClicked(); + void applyClicked(); + void allClicked(); + void retryClicked(); + void ignoreClicked(); + void abortClicked(); + +private: + TQDialogButtonsPrivate *d; + void init(TQ_UINT32, Orientation); +}; +#endif //TQT_NO_DIALOGBUTTONS +#endif //TQDIALOGBUTTONS_P_H diff --git a/src/widgets/tqiconview.h b/src/widgets/tqiconview.h index bffaad207..1be94b651 100644 --- a/src/widgets/tqiconview.h +++ b/src/widgets/tqiconview.h @@ -42,7 +42,7 @@ #define TQICONVIEW_H #ifndef QT_H -#include "ntqscrollview.h" +#include "tqscrollview.h" #include "tqstring.h" #include "tqrect.h" #include "tqpoint.h" diff --git a/src/widgets/tqlcdnumber.cpp b/src/widgets/tqlcdnumber.cpp new file mode 100644 index 000000000..e6dbf453c --- /dev/null +++ b/src/widgets/tqlcdnumber.cpp @@ -0,0 +1,1170 @@ +/**************************************************************************** +** +** Implementation of TQLCDNumber class +** +** Created : 940518 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqlcdnumber.h" +#ifndef TQT_NO_LCDNUMBER +#include "tqbitarray.h" +#include "tqpainter.h" + + +/*! + \class TQLCDNumber tqlcdnumber.h + + \brief The TQLCDNumber widget displays a number with LCD-like digits. + + \ingroup basic + \mainclass + + It can display a number in just about any size. It can display + decimal, hexadecimal, octal or binary numbers. It is easy to + connect to data sources using the display() slot, which is + overloaded to take any of five argument types. + + There are also slots to change the base with setMode() and the + decimal point with setSmallDecimalPoint(). + + TQLCDNumber emits the overflow() signal when it is asked to display + something beyond its range. The range is set by setNumDigits(), + but setSmallDecimalPoint() also influences it. If the display is + set to hexadecimal, octal or binary, the integer equivalent of the + value is displayed. + + These digits and other symbols can be shown: 0/O, 1, 2, 3, 4, 5/S, + 6, 7, 8, 9/g, minus, decimal point, A, B, C, D, E, F, h, H, L, o, + P, r, u, U, Y, colon, degree sign (which is specified as single + quote in the string) and space. TQLCDNumber substitutes spaces for + illegal characters. + + It is not possible to retrieve the contents of a TQLCDNumber + object, although you can retrieve the numeric value with value(). + If you really need the text, we recommend that you connect the + signals that feed the display() slot to another slot as well and + store the value there. + + Incidentally, TQLCDNumber is the very oldest part of TQt, tracing + back to a BASIC program on the \link + http://www.nvg.ntnu.no/sinclair/computers/zxspectrum/zxspectrum.htm + Sinclair Spectrum\endlink. + + + + \sa TQLabel, TQFrame +*/ + +/*! + \enum TQLCDNumber::Mode + + This type determines how numbers are shown. + + \value Hex Hexadecimal + \value Dec Decimal + \value Oct Octal + \value Bin Binary + + If the display is set to hexadecimal, octal or binary, the integer + equivalent of the value is displayed. +*/ + +/*! + \enum TQLCDNumber::SegmentStyle + + This type determines the visual appearance of the TQLCDNumber + widget. + + \value Outline gives raised segments filled with the background brush. + \value Filled gives raised segments filled with the foreground brush. + \value Flat gives flat segments filled with the foreground brush. +*/ + + + +/*! + \fn void TQLCDNumber::overflow() + + This signal is emitted whenever the TQLCDNumber is asked to display + a too-large number or a too-long string. + + It is never emitted by setNumDigits(). +*/ + + +static TQString int2string( int num, int base, int ndigits, bool *oflow ) +{ + TQString s; + bool negative; + if ( num < 0 ) { + negative = TRUE; + num = -num; + } else { + negative = FALSE; + } + switch( base ) { + case TQLCDNumber::HEX: + s.sprintf( "%*x", ndigits, num ); + break; + case TQLCDNumber::DEC: + s.sprintf( "%*i", ndigits, num ); + break; + case TQLCDNumber::OCT: + s.sprintf( "%*o", ndigits, num ); + break; + case TQLCDNumber::BIN: + { + char buf[42]; + char *p = &buf[41]; + uint n = num; + int len = 0; + *p = '\0'; + do { + *--p = (char)((n&1)+'0'); + n >>= 1; + len++; + } while ( n != 0 ); + len = ndigits - len; + if ( len > 0 ) + s.fill( ' ', len ); + s += TQString::fromLatin1(p); + } + break; + } + if ( negative ) { + for ( int i=0; i<(int)s.length(); i++ ) { + if ( s[i] != ' ' ) { + if ( i != 0 ) { + s[i-1] = '-'; + } else { + s.insert( 0, '-' ); + } + break; + } + } + } + if ( oflow ) + *oflow = (int)s.length() > ndigits; + return s; +} + + +static TQString double2string( double num, int base, int ndigits, bool *oflow ) +{ + TQString s; + if ( base != TQLCDNumber::DEC ) { + bool of = num >= 2147483648.0 || num < -2147483648.0; + if ( of ) { // oops, integer overflow + if ( oflow ) + *oflow = TRUE; + return s; + } + s = int2string( (int)num, base, ndigits, 0 ); + } else { // decimal base + int nd = ndigits; + do { + s.sprintf( "%*.*g", ndigits, nd, num ); + int i = s.find('e'); + if ( i > 0 && s[i+1]=='+' ) { + s[i] = ' '; + s[i+1] = 'e'; + } + } while (nd-- && (int)s.length() > ndigits); + } + if ( oflow ) + *oflow = (int)s.length() > ndigits; + return s; +} + + +static const char *getSegments( char ch ) // gets list of segments for ch +{ + static const char segments[30][8] = + { { 0, 1, 2, 4, 5, 6,99, 0}, // 0 0 / O + { 2, 5,99, 0, 0, 0, 0, 0}, // 1 1 + { 0, 2, 3, 4, 6,99, 0, 0}, // 2 2 + { 0, 2, 3, 5, 6,99, 0, 0}, // 3 3 + { 1, 2, 3, 5,99, 0, 0, 0}, // 4 4 + { 0, 1, 3, 5, 6,99, 0, 0}, // 5 5 / S + { 0, 1, 3, 4, 5, 6,99, 0}, // 6 6 + { 0, 2, 5,99, 0, 0, 0, 0}, // 7 7 + { 0, 1, 2, 3, 4, 5, 6,99}, // 8 8 + { 0, 1, 2, 3, 5, 6,99, 0}, // 9 9 / g + { 3,99, 0, 0, 0, 0, 0, 0}, // 10 - + { 7,99, 0, 0, 0, 0, 0, 0}, // 11 . + { 0, 1, 2, 3, 4, 5,99, 0}, // 12 A + { 1, 3, 4, 5, 6,99, 0, 0}, // 13 B + { 0, 1, 4, 6,99, 0, 0, 0}, // 14 C + { 2, 3, 4, 5, 6,99, 0, 0}, // 15 D + { 0, 1, 3, 4, 6,99, 0, 0}, // 16 E + { 0, 1, 3, 4,99, 0, 0, 0}, // 17 F + { 1, 3, 4, 5,99, 0, 0, 0}, // 18 h + { 1, 2, 3, 4, 5,99, 0, 0}, // 19 H + { 1, 4, 6,99, 0, 0, 0, 0}, // 20 L + { 3, 4, 5, 6,99, 0, 0, 0}, // 21 o + { 0, 1, 2, 3, 4,99, 0, 0}, // 22 P + { 3, 4,99, 0, 0, 0, 0, 0}, // 23 r + { 4, 5, 6,99, 0, 0, 0, 0}, // 24 u + { 1, 2, 4, 5, 6,99, 0, 0}, // 25 U + { 1, 2, 3, 5, 6,99, 0, 0}, // 26 Y + { 8, 9,99, 0, 0, 0, 0, 0}, // 27 : + { 0, 1, 2, 3,99, 0, 0, 0}, // 28 ' + {99, 0, 0, 0, 0, 0, 0, 0} }; // 29 empty + + if (ch >= '0' && ch <= '9') + return segments[ch - '0']; + if (ch >= 'A' && ch <= 'F') + return segments[ch - 'A' + 12]; + if (ch >= 'a' && ch <= 'f') + return segments[ch - 'a' + 12]; + + int n; + switch ( ch ) { + case '-': + n = 10; break; + case 'O': + n = 0; break; + case 'g': + n = 9; break; + case '.': + n = 11; break; + case 'h': + n = 18; break; + case 'H': + n = 19; break; + case 'l': + case 'L': + n = 20; break; + case 'o': + n = 21; break; + case 'p': + case 'P': + n = 22; break; + case 'r': + case 'R': + n = 23; break; + case 's': + case 'S': + n = 5; break; + case 'u': + n = 24; break; + case 'U': + n = 25; break; + case 'y': + case 'Y': + n = 26; break; + case ':': + n = 27; break; + case '\'': + n = 28; break; + default: + n = 29; break; + } + return segments[n]; +} + + +/*! + Constructs an LCD number, sets the number of digits to 5, the base + to decimal, the decimal point mode to 'small' and the frame style + to a raised box. The segmentStyle() is set to \c Outline. + + The \a parent and \a name arguments are passed to the TQFrame + constructor. + + \sa setNumDigits(), setSmallDecimalPoint() +*/ + +TQLCDNumber::TQLCDNumber( TQWidget *parent, const char *name ) + : TQFrame( parent, name ) +{ + ndigits = 5; + init(); +} + + +/*! + Constructs an LCD number, sets the number of digits to \a + numDigits, the base to decimal, the decimal point mode to 'small' + and the frame style to a raised box. The segmentStyle() is set to + \c Outline. + + The \a parent and \a name arguments are passed to the TQFrame + constructor. + + \sa setNumDigits(), setSmallDecimalPoint() +*/ + +TQLCDNumber::TQLCDNumber( uint numDigits, TQWidget *parent, const char *name ) + : TQFrame( parent, name ) +{ + ndigits = numDigits; + init(); +} + +/*! + \internal +*/ + +void TQLCDNumber::init() +{ + setFrameStyle( TQFrame::Box | TQFrame::Raised ); + val = 0; + base = DEC; + smallPoint = FALSE; + setNumDigits( ndigits ); + setSegmentStyle( Outline ); + d = 0; + setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Minimum ) ); +} + +/*! + Destroys the LCD number. +*/ + +TQLCDNumber::~TQLCDNumber() +{ +} + + +/*! + \property TQLCDNumber::numDigits + \brief the current number of digits displayed + + Corresponds to the current number of digits. If \l + TQLCDNumber::smallDecimalPoint is FALSE, the decimal point occupies + one digit position. + + \sa numDigits, smallDecimalPoint +*/ + +void TQLCDNumber::setNumDigits( int numDigits ) +{ + if ( numDigits > 99 ) { +#if defined(QT_CHECK_RANGE) + tqWarning( "TQLCDNumber::setNumDigits: (%s) Max 99 digits allowed", + name( "unnamed" ) ); +#endif + numDigits = 99; + } + if (numDigits < 0 ) { +#if defined(QT_CHECK_RANGE) + tqWarning( "TQLCDNumber::setNumDigits: (%s) Min 0 digits allowed", + name( "unnamed" ) ); +#endif + numDigits = 0; + } + if ( digitStr.isNull() ) { // from constructor + ndigits = numDigits; + digitStr.fill( ' ', ndigits ); + points.fill( 0, ndigits ); + digitStr[ndigits - 1] = '0'; // "0" is the default number + } else { + bool doDisplay = ndigits == 0; + if ( numDigits == ndigits ) // no change + return; + int i; + int dif; + if ( numDigits > ndigits ) { // expand + dif = numDigits - ndigits; + TQString buf; + buf.fill( ' ', dif ); + digitStr.insert( 0, buf ); + points.resize( numDigits ); + for ( i=numDigits-1; i>=dif; i-- ) + points.setBit( i, points.testBit(i-dif) ); + for ( i=0; i=0; i-- ) { + buffer[ndigits - 1 - index + i] = buffer[i]; + newPoints.setBit( ndigits - 1 - index + i, + newPoints.testBit(i) ); + } + for( i=0; i xSegLen ? xSegLen : ySegLen; + int xAdvance = segLen*( 5 + digitSpace )/5; + int xOffset = ( width() - ndigits*xAdvance + segLen/5 )/2; + int yOffset = ( height() - segLen*2 )/2; + + for ( int i=0; itestBit(i) ? '.' : ' '; + if ( newString ) { + char oldPoint = points.testBit(i) ? '.' : ' '; + drawDigit( pos, p, segLen, newPoint, oldPoint ); + } else { + drawDigit( pos, p, segLen, newPoint ); + } + } + } + if ( newString ) { + digitStr = s; + if ( (int)digitStr.length() > ndigits ) + digitStr.truncate( ndigits ); + if ( newPoints ) + points = *newPoints; + } +} + + +/*! + \internal +*/ + +void TQLCDNumber::drawDigit( const TQPoint &pos, TQPainter &p, int segLen, + char newCh, char oldCh ) +{ +// Draws and/or erases segments to change display of a single digit +// from oldCh to newCh + + char updates[18][2]; // can hold 2 times number of segments, only + // first 9 used if segment table is correct + int nErases; + int nUpdates; + const char *segs; + int i,j; + + const char erase = 0; + const char draw = 1; + const char leaveAlone = 2; + + segs = getSegments(oldCh); + for ( nErases=0; segs[nErases] != 99; nErases++ ) { + updates[nErases][0] = erase; // get segments to erase to + updates[nErases][1] = segs[nErases]; // remove old char + } + nUpdates = nErases; + segs = getSegments(newCh); + for(i = 0 ; segs[i] != 99 ; i++) { + for ( j=0; j +#endif +#if defined(QT_ACCESSIBILITY_SUPPORT) +#include "ntqaccessible.h" +#endif + +#ifndef TQT_NO_ACCEL +#include "ntqkeysequence.h" +#define ACCEL_KEY(k) "\t" + TQString(TQKeySequence( TQt::CTRL | TQt::Key_ ## k )) +#else +#define ACCEL_KEY(k) "\t" + TQString("Ctrl+" #k) +#endif + +#if defined(Q_OS_LINUX) +#define LINUX_MEMLOCK_LIMIT_BYTES 16384 +#define LINUX_MEMLOCK_LIMIT_CHARACTERS LINUX_MEMLOCK_LIMIT_BYTES/sizeof(TQChar) +#endif + +#define innerMargin 1 + +struct TQLineEditPrivate : public TQt +{ + TQLineEditPrivate( TQLineEdit *q ) + : q(q), cursor(0), cursorTimer(0), tripleClickTimer(0), frame(1), + cursorVisible(0), separator(0), readOnly(0), modified(0), + direction(TQChar::DirON), dragEnabled(1), alignment(0), + echoMode(0), textDirty(0), selDirty(0), validInput(1), + ascent(0), maxLength(32767), menuId(0), + hscroll(0), validator(0), maskData(0), + undoState(0), selstart(0), selend(0), + imstart(0), imend(0), imselstart(0), imselend(0) +#ifndef TQT_NO_DRAGANDDROP + ,dndTimer(0) +#endif + {} + void init( const TQString&); + + TQLineEdit *q; + TQString text; + int cursor; + int cursorTimer; + TQPoint tripleClick; + int tripleClickTimer; + uint frame : 1; + uint cursorVisible : 1; + uint separator : 1; + uint readOnly : 1; + uint modified : 1; + uint direction : 5; + uint dragEnabled : 1; + uint alignment : 3; + uint echoMode : 2; + uint textDirty : 1; + uint selDirty : 1; + uint validInput : 1; + int ascent; + int maxLength; + int menuId; + int hscroll; + TQChar passwordChar; // obsolete + + void finishChange( int validateFromState = -1, bool setModified = TRUE ); + + const TQValidator* validator; + struct MaskInputData { + enum Casemode { NoCaseMode, Upper, Lower }; + TQChar maskChar; // either the separator char or the inputmask + bool separator; + Casemode caseMode; + }; + TQString inputMask; + TQChar blank; + MaskInputData *maskData; + inline int nextMaskBlank( int pos ) { + int c = findInMask( pos, TRUE, FALSE ); + separator |= ( c != pos ); + return ( c != -1 ? c : maxLength ); + } + inline int prevMaskBlank( int pos ) { + int c = findInMask( pos, FALSE, FALSE ); + separator |= ( c != pos ); + return ( c != -1 ? c : 0 ); + } + + void setCursorVisible( bool visible ); + + + // undo/redo handling + enum CommandType { Separator, Insert, Remove, Delete, RemoveSelection, DeleteSelection }; + struct Command { + inline Command(){} + inline Command( CommandType type, int pos, TQChar c ) + :type(type),c(c),pos(pos){} + uint type : 4; + TQChar c; + int pos; + }; + int undoState; + TQValueVector history; + void addCommand( const Command& cmd ); + void insert( const TQString& s ); + void del( bool wasBackspace = FALSE ); + void remove( int pos ); + + inline void separate() { separator = TRUE; } + inline void undo( int until = -1 ) { + if ( !isUndoAvailable() ) + return; + deselect(); + while ( undoState && undoState > until ) { + Command& cmd = history[--undoState]; + switch ( cmd.type ) { + case Insert: + text.remove( cmd.pos, 1); + cursor = cmd.pos; + break; + case Remove: + case RemoveSelection: + text.insert( cmd.pos, cmd.c ); + cursor = cmd.pos + 1; + break; + case Delete: + case DeleteSelection: + text.insert( cmd.pos, cmd.c ); + cursor = cmd.pos; + break; + case Separator: + continue; + } + if ( until < 0 && undoState ) { + Command& next = history[undoState-1]; + if ( next.type != cmd.type && next.type < RemoveSelection + && !( cmd.type >= RemoveSelection && next.type != Separator ) ) + break; + } + } + modified = ( undoState != 0 ); + textDirty = TRUE; + } + inline void redo() { + if ( !isRedoAvailable() ) + return; + deselect(); + while ( undoState < (int)history.size() ) { + Command& cmd = history[undoState++]; + switch ( cmd.type ) { + case Insert: + text.insert( cmd.pos, cmd.c ); + cursor = cmd.pos + 1; + break; + case Remove: + case Delete: + case RemoveSelection: + case DeleteSelection: + text.remove( cmd.pos, 1 ); + cursor = cmd.pos; + break; + case Separator: + continue; + } + if ( undoState < (int)history.size() ) { + Command& next = history[undoState]; + if ( next.type != cmd.type && cmd.type < RemoveSelection + && !( next.type >= RemoveSelection && cmd.type != Separator ) ) + break; + } + } + textDirty = TRUE; + } + inline bool isUndoAvailable() const { return !readOnly && undoState; } + inline bool isRedoAvailable() const { return !readOnly && undoState < (int)history.size(); } + + // bidi + inline bool isRightToLeft() const { return direction==TQChar::DirON?text.isRightToLeft():(direction==TQChar::DirR); } + + // selection + int selstart, selend; + inline bool allSelected() const { return !text.isEmpty() && selstart == 0 && selend == (int)text.length(); } + inline bool hasSelectedText() const { return !text.isEmpty() && selend > selstart; } + inline void deselect() { selDirty |= (selend > selstart); selstart = selend = 0; } + void removeSelectedText(); +#ifndef TQT_NO_CLIPBOARD + void copy( bool clipboard = TRUE ) const; +#endif + inline bool inSelection( int x ) const + { if ( selstart >= selend ) return FALSE; + int pos = xToPos( x, TQTextItem::OnCharacters ); return pos >= selstart && pos < selend; } + + // masking + void parseInputMask( const TQString &maskFields ); + bool isValidInput( TQChar key, TQChar mask ) const; + TQString maskString( uint pos, const TQString &str, bool clear = FALSE ) const; + TQString clearString( uint pos, uint len ) const; + TQString stripString( const TQString &str ) const; + int findInMask( int pos, bool forward, bool findSeparator, TQChar searchChar = TQChar() ) const; + + // input methods + int imstart, imend, imselstart, imselend; + bool composeMode() const { return preeditLength(); } + bool hasIMSelection() const { return imSelectionLength(); } + int preeditLength() const { return ( imend - imstart ); } + int imSelectionLength() const { return ( imselend - imselstart ); } + + // complex text layout + TQTextLayout textLayout; + void updateTextLayout(); + void moveCursor( int pos, bool mark = FALSE ); + void setText( const TQString& txt ); + int xToPosInternal( int x, TQTextItem::CursorPosition ) const; + int xToPos( int x, TQTextItem::CursorPosition = TQTextItem::BetweenCharacters ) const; + inline int visualAlignment() const { return alignment ? alignment : int( isRightToLeft() ? AlignRight : AlignLeft ); } + TQRect cursorRect() const; + void updateMicroFocusHint(); + +#ifndef TQT_NO_DRAGANDDROP + // drag and drop + TQPoint dndPos; + int dndTimer; + bool drag(); +#endif +}; + + +/*! + \class TQLineEdit + \brief The TQLineEdit widget is a one-line text editor. + + \ingroup basic + \mainclass + + A line edit allows the user to enter and edit a single line of + plain text with a useful collection of editing functions, + including undo and redo, cut and paste, and drag and drop. + + By changing the echoMode() of a line edit, it can also be used as + a "write-only" field, for inputs such as passwords. + + The length of the text can be constrained to maxLength(). The text + can be arbitrarily constrained using a validator() or an + inputMask(), or both. + + A related class is TQTextEdit which allows multi-line, rich-text + editing. + + You can change the text with setText() or insert(). The text is + retrieved with text(); the displayed text (which may be different, + see \l{EchoMode}) is retrieved with displayText(). Text can be + selected with setSelection() or selectAll(), and the selection can + be cut(), copy()ied and paste()d. The text can be aligned with + setAlignment(). + + When the text changes the textChanged() signal is emitted; when + the Return or Enter key is pressed the returnPressed() signal is + emitted. Note that if there is a validator set on the line edit, + the returnPressed() signal will only be emitted if the validator + returns \c Acceptable. + + By default, TQLineEdits have a frame as specified by the Windows + and Motif style guides; you can turn it off by calling + setFrame(FALSE). + + The default key bindings are described below. The line edit also + provides a context menu (usually invoked by a right mouse click) + that presents some of these editing options. + \target desc + \table + \header \i Keypress \i Action + \row \i Left Arrow \i Moves the cursor one character to the left. + \row \i Shift+Left Arrow \i Moves and selects text one character to the left. + \row \i Right Arrow \i Moves the cursor one character to the right. + \row \i Shift+Right Arrow \i Moves and selects text one character to the right. + \row \i Home \i Moves the cursor to the beginning of the line. + \row \i End \i Moves the cursor to the end of the line. + \row \i Backspace \i Deletes the character to the left of the cursor. + \row \i Ctrl+Backspace \i Deletes the word to the left of the cursor. + \row \i Delete \i Deletes the character to the right of the cursor. + \row \i Ctrl+Delete \i Deletes the word to the right of the cursor. + \row \i Ctrl+A \i Moves the cursor to the beginning of the line. + \row \i Ctrl+B \i Moves the cursor one character to the left. + \row \i Ctrl+C \i Copies the selected text to the clipboard. + (Windows also supports Ctrl+Insert for this operation.) + \row \i Ctrl+D \i Deletes the character to the right of the cursor. + \row \i Ctrl+E \i Moves the cursor to the end of the line. + \row \i Ctrl+F \i Moves the cursor one character to the right. + \row \i Ctrl+H \i Deletes the character to the left of the cursor. + \row \i Ctrl+K \i Deletes to the end of the line. + \row \i Ctrl+V \i Pastes the clipboard text into line edit. + (Windows also supports Shift+Insert for this operation.) + \row \i Ctrl+X \i Deletes the selected text and copies it to the clipboard. + (Windows also supports Shift+Delete for this operation.) + \row \i Ctrl+Z \i Undoes the last operation. + \row \i Ctrl+Y \i Redoes the last undone operation. + \endtable + + Any other key sequence that represents a valid character, will + cause the character to be inserted into the line edit. + + + + \sa TQTextEdit TQLabel TQComboBox + \link guibooks.html#fowler GUI Design Handbook: Field, Entry\endlink +*/ + + +/*! + \fn void TQLineEdit::textChanged( const TQString& ) + + This signal is emitted whenever the text changes. The argument is + the new text. +*/ + +/*! + \fn void TQLineEdit::selectionChanged() + + This signal is emitted whenever the selection changes. + + \sa hasSelectedText(), selectedText() +*/ + +/*! + \fn void TQLineEdit::lostFocus() + + This signal is emitted when the line edit has lost focus. + + \sa hasFocus(), TQWidget::focusInEvent(), TQWidget::focusOutEvent() +*/ + + + +/*! + Constructs a line edit with no text. + + The maximum text length is set to 32767 characters. + + The \a parent and \a name arguments are sent to the TQWidget constructor. + + \sa setText(), setMaxLength() +*/ + +TQLineEdit::TQLineEdit( TQWidget* parent, const char* name ) + : TQFrame( parent, name, WNoAutoErase ), d(new TQLineEditPrivate( this )) +{ + d->init( TQString::null ); +} + +/*! + Constructs a line edit containing the text \a contents. + + The cursor position is set to the end of the line and the maximum + text length to 32767 characters. + + The \a parent and \a name arguments are sent to the TQWidget + constructor. + + \sa text(), setMaxLength() +*/ + +TQLineEdit::TQLineEdit( const TQString& contents, TQWidget* parent, const char* name ) + : TQFrame( parent, name, WNoAutoErase ), d(new TQLineEditPrivate( this )) +{ + d->init( contents ); +} + +/*! + Constructs a line edit with an input \a inputMask and the text \a + contents. + + The cursor position is set to the end of the line and the maximum + text length is set to the length of the mask (the number of mask + characters and separators). + + The \a parent and \a name arguments are sent to the TQWidget + constructor. + + \sa setMask() text() +*/ +TQLineEdit::TQLineEdit( const TQString& contents, const TQString &inputMask, TQWidget* parent, const char* name ) + : TQFrame( parent, name, WNoAutoErase ), d(new TQLineEditPrivate( this )) +{ + d->parseInputMask( inputMask ); + if ( d->maskData ) { + TQString ms = d->maskString( 0, contents ); + d->init( ms + d->clearString( ms.length(), d->maxLength - ms.length() ) ); + d->cursor = d->nextMaskBlank( ms.length() ); + } else { + d->init( contents ); + } +} + +/*! + Destroys the line edit. +*/ + +TQLineEdit::~TQLineEdit() +{ + if ((d->echoMode == NoEcho) || (d->echoMode == Password) || (d->echoMode == PasswordThreeStars)) { + d->text.fill(TQChar(0)); +#if defined(Q_OS_LINUX) + munlock(d->text.d->unicode, LINUX_MEMLOCK_LIMIT_BYTES); +#endif + } + delete [] d->maskData; + delete d; +} + + +/*! + \property TQLineEdit::text + \brief the line edit's text + + Note that setting this property clears the selection, clears the + undo/redo history, moves the cursor to the end of the line and + resets the \c modified property to FALSE. The text is not + validated when inserted with setText(). + + The text is truncated to maxLength() length. + + \sa insert() +*/ +TQString TQLineEdit::text() const +{ + TQString res = d->text; + if ( d->maskData ) + res = d->stripString( d->text ); + return ( res.isNull() ? TQString::fromLatin1("") : res ); +} + +void TQLineEdit::setText( const TQString& text) +{ + resetInputContext(); + d->setText( text ); + d->modified = FALSE; + d->finishChange( -1, FALSE ); +} + + +/*! + \property TQLineEdit::displayText + \brief the displayed text + + If \c EchoMode is \c Normal this returns the same as text(); if + \c EchoMode is \c Password it returns a string of asterisks + text().length() characters long, e.g. "******"; if \c EchoMode is + \c NoEcho returns an empty string, "". + + \sa setEchoMode() text() EchoMode +*/ + +TQString TQLineEdit::displayText() const +{ + if ( d->echoMode == NoEcho ) { + return TQString::fromLatin1(""); + } + TQString res = d->text; + if ( d->echoMode == Password ) { + res.fill( passwordChar() ); + } + else if ( d->echoMode == PasswordThreeStars ) { + res.fill( passwordChar(), res.length()*3 ); + } + return ( res.isNull() ? TQString::fromLatin1("") : res ); +} + + +/*! + \property TQLineEdit::maxLength + \brief the maximum permitted length of the text + + If the text is too long, it is truncated at the limit. + + If truncation occurs any selected text will be unselected, the + cursor position is set to 0 and the first part of the string is + shown. + + If the line edit has an input mask, the mask defines the maximum + string length. + + \sa inputMask +*/ + +int TQLineEdit::maxLength() const +{ + return d->maxLength; +} + +void TQLineEdit::setMaxLength( int maxLength ) +{ + if ( d->maskData ) + return; + d->maxLength = maxLength; + setText( d->text ); +} + + + +/*! + \property TQLineEdit::frame + \brief whether the line edit draws itself with a frame + + If enabled (the default) the line edit draws itself inside a + two-pixel frame, otherwise the line edit draws itself without any + frame. +*/ +bool TQLineEdit::frame() const +{ + return frameShape() != NoFrame; +} + + +void TQLineEdit::setFrame( bool enable ) +{ + setFrameStyle( enable ? ( LineEditPanel | Sunken ) : NoFrame ); +} + + +/*! + \enum TQLineEdit::EchoMode + + This enum type describes how a line edit should display its + contents. + + \value Normal Display characters as they are entered. This is the + default. + \value NoEcho Do not display anything. This may be appropriate + for passwords where even the length of the + password should be kept secret. + \value Password Display asterisks instead of the characters + actually entered. + + \sa setEchoMode() echoMode() +*/ + + +/*! + \property TQLineEdit::echoMode + \brief the line edit's echo mode + + The initial setting is \c Normal, but TQLineEdit also supports \c + NoEcho and \c Password modes. + + The widget's display and the ability to copy or drag the text is + affected by this setting. + + \sa EchoMode displayText() +*/ + +TQLineEdit::EchoMode TQLineEdit::echoMode() const +{ + return (EchoMode) d->echoMode; +} + +void TQLineEdit::setEchoMode( EchoMode mode ) +{ + if (mode == (EchoMode)d->echoMode) { + return; + } +#if defined(Q_OS_LINUX) + if (((mode == NoEcho) || (mode == Password) || (mode == PasswordThreeStars)) && ((EchoMode)d->echoMode == Normal)) { + if ((uint)d->maxLength > (LINUX_MEMLOCK_LIMIT_CHARACTERS-1)) { + d->maxLength = LINUX_MEMLOCK_LIMIT_CHARACTERS-1; + } + d->text.reserve(LINUX_MEMLOCK_LIMIT_CHARACTERS); + mlock(d->text.d->unicode, LINUX_MEMLOCK_LIMIT_BYTES); + d->text.setSecurityUnPaged(true); + } + else { + d->text.setSecurityUnPaged(false); + munlock(d->text.d->unicode, LINUX_MEMLOCK_LIMIT_BYTES); + } +#endif + d->echoMode = mode; + d->updateTextLayout(); + setInputMethodEnabled( ( mode == Normal ) || ( mode == Password) ); + update(); +} + + + +/*! + Returns a pointer to the current input validator, or 0 if no + validator has been set. + + \sa setValidator() +*/ + +const TQValidator * TQLineEdit::validator() const +{ + return d->validator; +} + +/*! + Sets this line edit to only accept input that the validator, \a v, + will accept. This allows you to place any arbitrary constraints on + the text which may be entered. + + If \a v == 0, setValidator() removes the current input validator. + The initial setting is to have no input validator (i.e. any input + is accepted up to maxLength()). + + \sa validator() TQIntValidator TQDoubleValidator TQRegExpValidator +*/ + +void TQLineEdit::setValidator( const TQValidator *v ) +{ + if ( d->validator ) + disconnect( (TQObject*)d->validator, TQ_SIGNAL( destroyed() ), + this, TQ_SLOT( clearValidator() ) ); + d->validator = v; + if ( d->validator ) + connect( (TQObject*)d->validator, TQ_SIGNAL( destroyed() ), + this, TQ_SLOT( clearValidator() ) ); +} + + + +/*! + Returns a recommended size for the widget. + + The width returned, in pixels, is usually enough for about 15 to + 20 characters. +*/ + +TQSize TQLineEdit::sizeHint() const +{ + constPolish(); + TQFontMetrics fm( font() ); + int h = TQMAX(fm.lineSpacing(), 14) + 2*innerMargin; + int w = fm.width( 'x' ) * 17; // "some" + int m = frameWidth() * 2; + return (style().sizeFromContents(TQStyle::CT_LineEdit, this, + TQSize( w + m, h + m ). + expandedTo(TQApplication::globalStrut()))); +} + + +/*! + Returns a minimum size for the line edit. + + The width returned is enough for at least one character. +*/ + +TQSize TQLineEdit::minimumSizeHint() const +{ + constPolish(); + TQFontMetrics fm = fontMetrics(); + int h = fm.height() + TQMAX( 2*innerMargin, fm.leading() ); + int w = fm.maxWidth(); + int m = frameWidth() * 2; + return TQSize( w + m, h + m ); +} + + +/*! + \property TQLineEdit::cursorPosition + \brief the current cursor position for this line edit + + Setting the cursor position causes a repaint when appropriate. +*/ + +int TQLineEdit::cursorPosition() const +{ + return d->cursor; +} + + +void TQLineEdit::setCursorPosition( int pos ) +{ + if (pos < 0) + pos = 0; + + if ( pos <= (int) d->text.length() ) + d->moveCursor( pos ); +} + + +/*! \obsolete Use setText(), setCursorPosition() and setSelection() instead. +*/ + +bool TQLineEdit::validateAndSet( const TQString &newText, int newPos, + int newMarkAnchor, int newMarkDrag ) +{ + int priorState = d->undoState; + d->selstart = 0; + d->selend = d->text.length(); + d->removeSelectedText(); + d->insert( newText ); + d->finishChange( priorState ); + if ( d->undoState > priorState ) { + d->cursor = newPos; + d->selstart = TQMIN( newMarkAnchor, newMarkDrag ); + d->selend = TQMAX( newMarkAnchor, newMarkDrag ); + d->updateMicroFocusHint(); + update(); + return TRUE; + } + return FALSE; +} + + +/*! + \property TQLineEdit::alignment + \brief the alignment of the line edit + + Possible Values are \c TQt::AlignAuto, \c TQt::AlignLeft, \c + TQt::AlignRight and \c TQt::AlignHCenter. + + Attempting to set the alignment to an illegal flag combination + does nothing. + + \sa TQt::AlignmentFlags +*/ + +int TQLineEdit::alignment() const +{ + return d->alignment; +} + +void TQLineEdit::setAlignment( int flag ) +{ + d->alignment = flag & 0x7; + update(); +} + + +/*! + Moves the cursor forward \a steps characters. If \a mark is TRUE + each character moved over is added to the selection; if \a mark is + FALSE the selection is cleared. + + \sa cursorBackward() +*/ + +void TQLineEdit::cursorForward( bool mark, int steps ) +{ + int cursor = d->cursor; + if ( steps > 0 ) { + while( steps-- ) + cursor = d->textLayout.nextCursorPosition( cursor ); + } else if ( steps < 0 ) { + while ( steps++ ) + cursor = d->textLayout.previousCursorPosition( cursor ); + } + d->moveCursor( cursor, mark ); +} + + +/*! + Moves the cursor back \a steps characters. If \a mark is TRUE each + character moved over is added to the selection; if \a mark is + FALSE the selection is cleared. + + \sa cursorForward() +*/ +void TQLineEdit::cursorBackward( bool mark, int steps ) +{ + cursorForward( mark, -steps ); +} + +/*! + Moves the cursor one word forward. If \a mark is TRUE, the word is + also selected. + + \sa cursorWordBackward() +*/ +void TQLineEdit::cursorWordForward( bool mark ) +{ + d->moveCursor( d->textLayout.nextCursorPosition(d->cursor, TQTextLayout::SkipWords), mark ); +} + +/*! + Moves the cursor one word backward. If \a mark is TRUE, the word + is also selected. + + \sa cursorWordForward() +*/ + +void TQLineEdit::cursorWordBackward( bool mark ) +{ + d->moveCursor( d->textLayout.previousCursorPosition(d->cursor, TQTextLayout::SkipWords), mark ); +} + + +/*! + If no text is selected, deletes the character to the left of the + text cursor and moves the cursor one position to the left. If any + text is selected, the cursor is moved to the beginning of the + selected text and the selected text is deleted. + + \sa del() +*/ +void TQLineEdit::backspace() +{ + int priorState = d->undoState; + if ( d->hasSelectedText() ) { + d->removeSelectedText(); + } else if ( d->cursor ) { + --d->cursor; + if ( d->maskData ) + d->cursor = d->prevMaskBlank( d->cursor ); + d->del( TRUE ); + } + d->finishChange( priorState ); +} + +/*! + If no text is selected, deletes the character to the right of the + text cursor. If any text is selected, the cursor is moved to the + beginning of the selected text and the selected text is deleted. + + \sa backspace() +*/ + +void TQLineEdit::del() +{ + int priorState = d->undoState; + if ( d->hasSelectedText() ) { + d->removeSelectedText(); + } else { + int n = d->textLayout.nextCursorPosition( d->cursor ) - d->cursor; + while ( n-- ) + d->del(); + } + d->finishChange( priorState ); +} + +/*! + Moves the text cursor to the beginning of the line unless it is + already there. If \a mark is TRUE, text is selected towards the + first position; otherwise, any selected text is unselected if the + cursor is moved. + + \sa end() +*/ + +void TQLineEdit::home( bool mark ) +{ + d->moveCursor( 0, mark ); +} + +/*! + Moves the text cursor to the end of the line unless it is already + there. If \a mark is TRUE, text is selected towards the last + position; otherwise, any selected text is unselected if the cursor + is moved. + + \sa home() +*/ + +void TQLineEdit::end( bool mark ) +{ + d->moveCursor( d->text.length(), mark ); +} + + +/*! + \property TQLineEdit::modified + \brief whether the line edit's contents has been modified by the user + + The modified flag is never read by TQLineEdit; it has a default value + of FALSE and is changed to TRUE whenever the user changes the line + edit's contents. + + This is useful for things that need to provide a default value but + do not start out knowing what the default should be (perhaps it + depends on other fields on the form). Start the line edit without + the best default, and when the default is known, if modified() + returns FALSE (the user hasn't entered any text), insert the + default value. + + Calling clearModified() or setText() resets the modified flag to + FALSE. +*/ + +bool TQLineEdit::isModified() const +{ + return d->modified; +} + +/*! + Resets the modified flag to FALSE. + + \sa isModified() +*/ +void TQLineEdit::clearModified() +{ + d->modified = FALSE; + d->history.clear(); + d->undoState = 0; +} + +/*! + \obsolete + \property TQLineEdit::edited + \brief whether the line edit has been edited. Use modified instead. +*/ +bool TQLineEdit::edited() const { return d->modified; } +void TQLineEdit::setEdited( bool on ) { d->modified = on; } + +/*! + \property TQLineEdit::hasSelectedText + \brief whether there is any text selected + + hasSelectedText() returns TRUE if some or all of the text has been + selected by the user; otherwise returns FALSE. + + \sa selectedText() +*/ + + +bool TQLineEdit::hasSelectedText() const +{ + return d->hasSelectedText(); +} + +/*! + \property TQLineEdit::selectedText + \brief the selected text + + If there is no selected text this property's value is + TQString::null. + + \sa hasSelectedText() +*/ + +TQString TQLineEdit::selectedText() const +{ + if ( d->hasSelectedText() ) + return d->text.mid( d->selstart, d->selend - d->selstart ); + return TQString::null; +} + +/*! + selectionStart() returns the index of the first selected character in the + line edit or -1 if no text is selected. + + \sa selectedText() +*/ + +int TQLineEdit::selectionStart() const +{ + return d->hasSelectedText() ? d->selstart : -1; +} + +/*! \obsolete use selectedText(), selectionStart() */ +bool TQLineEdit::getSelection( int *start, int *end ) +{ + if ( d->hasSelectedText() && start && end ) { + *start = d->selstart; + *end = d->selend; + return TRUE; + } + return FALSE; +} + + +/*! + Selects text from position \a start and for \a length characters. + + Note that this function sets the cursor's position to the end of + the selection regardless of its current position. + + \sa deselect() selectAll() getSelection() cursorForward() cursorBackward() +*/ + +void TQLineEdit::setSelection( int start, int length ) +{ + if ( start < 0 || start > (int)d->text.length() || length < 0 ) { + d->selstart = d->selend = 0; + } else { + d->selstart = start; + d->selend = TQMIN( start + length, (int)d->text.length() ); + d->cursor = d->selend; + } + update(); +} + + +/*! + \property TQLineEdit::undoAvailable + \brief whether undo is available +*/ + +bool TQLineEdit::isUndoAvailable() const +{ + return d->isUndoAvailable(); +} + +/*! + \property TQLineEdit::redoAvailable + \brief whether redo is available +*/ + +bool TQLineEdit::isRedoAvailable() const +{ + return d->isRedoAvailable(); +} + +/*! + \property TQLineEdit::dragEnabled + \brief whether the lineedit starts a drag if the user presses and + moves the mouse on some selected text +*/ + +bool TQLineEdit::dragEnabled() const +{ + return d->dragEnabled; +} + +void TQLineEdit::setDragEnabled( bool b ) +{ + d->dragEnabled = b; +} + +/*! + \property TQLineEdit::acceptableInput + \brief whether the input satisfies the inputMask and the + validator. + + \sa setInputMask(), setValidator() +*/ +bool TQLineEdit::hasAcceptableInput() const +{ +#ifndef TQT_NO_VALIDATOR + TQString text = d->text; + int cursor = d->cursor; + if ( d->validator && d->validator->validate( text, cursor ) != TQValidator::Acceptable ) + return FALSE; +#endif + + if ( !d->maskData ) + return TRUE; + + if ( d->text.length() != (uint)d->maxLength ) + return FALSE; + + for ( uint i=0; i < (uint)d->maxLength; i++) { + if ( d->maskData[i].separator ) { + if ( d->text[(int)i] != d->maskData[i].maskChar ) + return FALSE; + } else { + if ( !d->isValidInput( d->text[(int)i], d->maskData[i].maskChar ) ) + return FALSE; + } + } + return TRUE; +} + + +/*! + \property TQLineEdit::inputMask + \brief The validation input mask + + If no mask is set, inputMask() returns TQString::null. + + Sets the TQLineEdit's validation mask. Validators can be used + instead of, or in conjunction with masks; see setValidator(). + + Unset the mask and return to normal TQLineEdit operation by passing + an empty string ("") or just calling setInputMask() with no + arguments. + + The mask format understands these mask characters: + \table + \header \i Character \i Meaning + \row \i \c A \i ASCII alphabetic character required. A-Z, a-z. + \row \i \c a \i ASCII alphabetic character permitted but not required. + \row \i \c N \i ASCII alphanumeric character required. A-Z, a-z, 0-9. + \row \i \c n \i ASCII alphanumeric character permitted but not required. + \row \i \c X \i Any character required. + \row \i \c x \i Any character permitted but not required. + \row \i \c 9 \i ASCII digit required. 0-9. + \row \i \c 0 \i ASCII digit permitted but not required. + \row \i \c D \i ASCII digit required. 1-9. + \row \i \c d \i ASCII digit permitted but not required (1-9). + \row \i \c # \i ASCII digit or plus/minus sign permitted but not required. + \row \i \c > \i All following alphabetic characters are uppercased. + \row \i \c < \i All following alphabetic characters are lowercased. + \row \i \c ! \i Switch off case conversion. + \row \i \\ \i Use \\ to escape the special + characters listed above to use them as + separators. + \endtable + + The mask consists of a string of mask characters and separators, + optionally followed by a semi-colon and the character used for + blanks: the blank characters are always removed from the text + after editing. The default blank character is space. + + Examples: + \table + \header \i Mask \i Notes + \row \i \c 000.000.000.000;_ \i IP address; blanks are \c{_}. + \row \i \c 0000-00-00 \i ISO Date; blanks are \c space + \row \i \c >AAAAA-AAAAA-AAAAA-AAAAA-AAAAA;# \i License number; + blanks are \c - and all (alphabetic) characters are converted to + uppercase. + \endtable + + To get range control (e.g. for an IP address) use masks together + with \link setValidator() validators\endlink. + + \sa maxLength +*/ +TQString TQLineEdit::inputMask() const +{ + return ( d->maskData ? d->inputMask + ';' + d->blank : TQString::null ); +} + +void TQLineEdit::setInputMask( const TQString &inputMask ) +{ + d->parseInputMask( inputMask ); + if ( d->maskData ) + d->moveCursor( d->nextMaskBlank( 0 ) ); +} + +/*! + Selects all the text (i.e. highlights it) and moves the cursor to + the end. This is useful when a default value has been inserted + because if the user types before clicking on the widget, the + selected text will be deleted. + + \sa setSelection() deselect() +*/ + +void TQLineEdit::selectAll() +{ + d->selstart = d->selend = d->cursor = 0; + d->moveCursor( d->text.length(), TRUE ); +} + +/*! + Deselects any selected text. + + \sa setSelection() selectAll() +*/ + +void TQLineEdit::deselect() +{ + d->deselect(); + d->finishChange(); +} + + +/*! + This slot is equivalent to setValidator(0). +*/ + +void TQLineEdit::clearValidator() +{ + setValidator( 0 ); +} + +/*! + Deletes any selected text, inserts \a newText, and validates the + result. If it is valid, it sets it as the new contents of the line + edit. +*/ +void TQLineEdit::insert( const TQString &newText ) +{ +// q->resetInputContext(); //#### FIX ME IN QT + int priorState = d->undoState; + d->removeSelectedText(); + d->insert( newText ); + d->finishChange( priorState ); +} + +/*! + Clears the contents of the line edit. +*/ +void TQLineEdit::clear() +{ + int priorState = d->undoState; + resetInputContext(); + d->selstart = 0; + d->selend = d->text.length(); + d->removeSelectedText(); + d->separate(); + d->finishChange( priorState ); +} + +/*! + Undoes the last operation if undo is \link + TQLineEdit::undoAvailable available\endlink. Deselects any current + selection, and updates the selection start to the current cursor + position. +*/ +void TQLineEdit::undo() +{ + resetInputContext(); + d->undo(); + d->finishChange( -1, FALSE ); +} + +/*! + Redoes the last operation if redo is \link + TQLineEdit::redoAvailable available\endlink. +*/ +void TQLineEdit::redo() +{ + resetInputContext(); + d->redo(); + d->finishChange(); +} + + +/*! + \property TQLineEdit::readOnly + \brief whether the line edit is read only. + + In read-only mode, the user can still copy the text to the + clipboard or drag-and-drop the text (if echoMode() is \c Normal), + but cannot edit it. + + TQLineEdit does not show a cursor in read-only mode. + + \sa setEnabled() +*/ + +bool TQLineEdit::isReadOnly() const +{ + return d->readOnly; +} + +void TQLineEdit::setReadOnly( bool enable ) +{ + d->readOnly = enable; +#ifndef TQT_NO_CURSOR + setCursor( enable ? arrowCursor : ibeamCursor ); +#endif + update(); +} + + +#ifndef TQT_NO_CLIPBOARD +/*! + Copies the selected text to the clipboard and deletes it, if there + is any, and if echoMode() is \c Normal. + + If the current validator disallows deleting the selected text, + cut() will copy without deleting. + + \sa copy() paste() setValidator() +*/ + +void TQLineEdit::cut() +{ + if ( hasSelectedText() ) { + copy(); + del(); + } +} + + +/*! + Copies the selected text to the clipboard, if there is any, and if + echoMode() is \c Normal. + + \sa cut() paste() +*/ + +void TQLineEdit::copy() const +{ + d->copy(); +} + +/*! + Inserts the clipboard's text at the cursor position, deleting any + selected text, providing the line edit is not \link + TQLineEdit::readOnly read-only\endlink. + + If the end result would not be acceptable to the current + \link setValidator() validator\endlink, nothing happens. + + \sa copy() cut() +*/ + +void TQLineEdit::paste() +{ + insert( TQApplication::clipboard()->text( TQClipboard::Clipboard ) ); +} + +void TQLineEditPrivate::copy( bool clipboard ) const +{ + TQString t = q->selectedText(); + if ( !t.isEmpty() && echoMode == TQLineEdit::Normal ) { + q->disconnect( TQApplication::clipboard(), TQ_SIGNAL(selectionChanged()), q, 0); + TQApplication::clipboard()->setText( t, clipboard ? TQClipboard::Clipboard : TQClipboard::Selection ); + q->connect( TQApplication::clipboard(), TQ_SIGNAL(selectionChanged()), + q, TQ_SLOT(clipboardChanged()) ); + } +} + +#endif // !TQT_NO_CLIPBOARD + +/*!\reimp +*/ + +void TQLineEdit::resizeEvent( TQResizeEvent *e ) +{ + TQFrame::resizeEvent( e ); +} + +/*! \reimp +*/ +bool TQLineEdit::event( TQEvent * e ) +{ + if ( e->type() == TQEvent::AccelOverride && !d->readOnly ) { + TQKeyEvent* ke = (TQKeyEvent*) e; + if ( ke->state() == NoButton || ke->state() == ShiftButton + || ke->state() == Keypad ) { + if ( ke->key() < Key_Escape ) { + ke->accept(); + } else { + switch ( ke->key() ) { + case Key_Delete: + case Key_Home: + case Key_End: + case Key_Backspace: + case Key_Left: + case Key_Right: + ke->accept(); + default: + break; + } + } + } else if ( ke->state() & ControlButton ) { + switch ( ke->key() ) { +// Those are too frequently used for application functionality +/* case Key_A: + case Key_B: + case Key_D: + case Key_E: + case Key_F: + case Key_H: + case Key_K: +*/ + case Key_C: + case Key_V: + case Key_X: + case Key_Y: + case Key_Z: + case Key_Left: + case Key_Right: +#if defined (TQ_WS_WIN) + case Key_Insert: + case Key_Delete: +#endif + ke->accept(); + default: + break; + } + } + } else if ( e->type() == TQEvent::Timer ) { + // should be timerEvent, is here for binary compatibility + int timerId = ((TQTimerEvent*)e)->timerId(); + if ( timerId == d->cursorTimer ) { + if(!hasSelectedText() || style().styleHint( TQStyle::SH_BlinkCursorWhenTextSelected )) + d->setCursorVisible( !d->cursorVisible ); +#ifndef TQT_NO_DRAGANDDROP + } else if ( timerId == d->dndTimer ) { + if( !d->drag() ) + return TRUE; +#endif + } else if ( timerId == d->tripleClickTimer ) { + killTimer( d->tripleClickTimer ); + d->tripleClickTimer = 0; + } + } + return TQWidget::event( e ); +} + +/*! \reimp +*/ +void TQLineEdit::mousePressEvent( TQMouseEvent* e ) +{ + if ( sendMouseEventToInputContext( e ) ) + return; + if ( e->button() == RightButton ) + return; + if ( d->tripleClickTimer && ( e->pos() - d->tripleClick ).manhattanLength() < + TQApplication::startDragDistance() ) { + selectAll(); + return; + } + bool mark = e->state() & ShiftButton; + int cursor = d->xToPos( e->pos().x() ); +#ifndef TQT_NO_DRAGANDDROP + if ( !mark && d->dragEnabled && d->echoMode == Normal && + e->button() == LeftButton && d->inSelection( e->pos().x() ) ) { + d->cursor = cursor; + d->updateMicroFocusHint(); + update(); + d->dndPos = e->pos(); + if ( !d->dndTimer ) + d->dndTimer = startTimer( TQApplication::startDragTime() ); + } else +#endif + { + d->moveCursor( cursor, mark ); + } +} + +/*! \reimp +*/ +void TQLineEdit::mouseMoveEvent( TQMouseEvent * e ) +{ + if ( sendMouseEventToInputContext( e ) ) + return; +#ifndef TQT_NO_CURSOR + if ( ( e->state() & MouseButtonMask ) == 0 ) { + if ( !d->readOnly && d->dragEnabled +#ifndef TQT_NO_WHATSTHIS + && !TQWhatsThis::inWhatsThisMode() +#endif + ) + setCursor( ( d->inSelection( e->pos().x() ) ? arrowCursor : ibeamCursor ) ); + } +#endif + + if ( e->state() & LeftButton ) { +#ifndef TQT_NO_DRAGANDDROP + if ( d->dndTimer ) { + if ( ( d->dndPos - e->pos() ).manhattanLength() > TQApplication::startDragDistance() ) + d->drag(); + } else +#endif + { + d->moveCursor( d->xToPos( e->pos().x() ), TRUE ); + } + } +} + +/*! \reimp +*/ +void TQLineEdit::mouseReleaseEvent( TQMouseEvent* e ) +{ + if ( sendMouseEventToInputContext( e ) ) + return; +#ifndef TQT_NO_DRAGANDDROP + if ( e->button() == LeftButton ) { + if ( d->dndTimer ) { + killTimer( d->dndTimer ); + d->dndTimer = 0; + deselect(); + return; + } + } +#endif +#ifndef TQT_NO_CLIPBOARD + if (TQApplication::clipboard()->supportsSelection() ) { + if ( e->button() == LeftButton ) { + d->copy( FALSE ); + } else if ( !d->readOnly && e->button() == MidButton ) { + d->deselect(); + insert( TQApplication::clipboard()->text( TQClipboard::Selection ) ); + } + } +#endif +} + +/*! \reimp +*/ +void TQLineEdit::mouseDoubleClickEvent( TQMouseEvent* e ) +{ + if ( sendMouseEventToInputContext( e ) ) + return; + if ( e->button() == TQt::LeftButton ) { + deselect(); + d->cursor = d->xToPos( e->pos().x() ); + d->cursor = d->textLayout.previousCursorPosition( d->cursor, TQTextLayout::SkipWords ); + // ## text layout should support end of words. + int end = d->textLayout.nextCursorPosition( d->cursor, TQTextLayout::SkipWords ); + while ( end > d->cursor && d->text[end-1].isSpace() ) + --end; + d->moveCursor( end, TRUE ); + d->tripleClickTimer = startTimer( TQApplication::doubleClickInterval() ); + d->tripleClick = e->pos(); + } +} + +/*! + \fn void TQLineEdit::returnPressed() + + This signal is emitted when the Return or Enter key is pressed. + Note that if there is a validator() or inputMask() set on the line + edit, the returnPressed() signal will only be emitted if the input + follows the inputMask() and the validator() returns \c Acceptable. +*/ + +/*! + Converts key press event \a e into a line edit action. + + If Return or Enter is pressed and the current text is valid (or + can be \link TQValidator::fixup() made valid\endlink by the + validator), the signal returnPressed() is emitted. + + The default key bindings are listed in the \link #desc detailed + description.\endlink +*/ + +void TQLineEdit::keyPressEvent( TQKeyEvent * e ) +{ + d->setCursorVisible( TRUE ); + if ( e->key() == Key_Enter || e->key() == Key_Return ) { + const TQValidator * v = d->validator; + if ( hasAcceptableInput() ) { + emit returnPressed(); + } +#ifndef TQT_NO_VALIDATOR + else if ( v && v->validate( d->text, d->cursor ) != TQValidator::Acceptable ) { + TQString vstr = d->text; + v->fixup( vstr ); + if ( vstr != d->text ) { + setText( vstr ); + if ( hasAcceptableInput() ) + emit returnPressed(); + } + } +#endif + e->ignore(); + return; + } + if ( !d->readOnly ) { + TQString t = e->text(); + if ( !t.isEmpty() && (!e->ascii() || e->ascii()>=32) && + e->key() != Key_Delete && + e->key() != Key_Backspace ) { +#ifdef TQ_WS_X11 + extern bool tqt_hebrew_keyboard_hack; + if ( tqt_hebrew_keyboard_hack ) { + // the X11 keyboard layout is broken and does not reverse + // braces correctly. This is a hack to get halfway correct + // behaviour + if ( d->isRightToLeft() ) { + TQChar *c = (TQChar *)t.unicode(); + int l = t.length(); + while( l-- ) { + if ( c->mirrored() ) + *c = c->mirroredChar(); + c++; + } + } + } +#endif + insert( t ); + return; + } + } + bool unknown = FALSE; + if ( e->state() & ControlButton ) { + switch ( e->key() ) { + case Key_A: +#if defined(TQ_WS_X11) + home( e->state() & ShiftButton ); +#else + selectAll(); +#endif + break; + case Key_B: + cursorForward( e->state() & ShiftButton, -1 ); + break; +#ifndef TQT_NO_CLIPBOARD + case Key_C: + copy(); + break; +#endif + case Key_D: + if ( !d->readOnly ) { + del(); + } + break; + case Key_E: + end( e->state() & ShiftButton ); + break; + case Key_F: + cursorForward( e->state() & ShiftButton, 1 ); + break; + case Key_H: + if ( !d->readOnly ) { + backspace(); + } + break; + case Key_K: + if ( !d->readOnly ) { + int priorState = d->undoState; + d->deselect(); + while ( d->cursor < (int) d->text.length() ) + d->del(); + d->finishChange( priorState ); + } + break; +#if defined(TQ_WS_X11) + case Key_U: + if ( !d->readOnly ) + clear(); + break; +#endif +#ifndef TQT_NO_CLIPBOARD + case Key_V: + if ( !d->readOnly ) + paste(); + break; + case Key_X: + if ( !d->readOnly && d->hasSelectedText() && echoMode() == Normal ) { + copy(); + del(); + } + break; +#if defined (TQ_WS_WIN) + case Key_Insert: + copy(); + break; +#endif +#endif + case Key_Delete: + if ( !d->readOnly ) { + cursorWordForward( TRUE ); + del(); + } + break; + case Key_Backspace: + if ( !d->readOnly ) { + cursorWordBackward( TRUE ); + del(); + } + break; + case Key_Right: + case Key_Left: + if ( d->isRightToLeft() == (e->key() == Key_Right) ) { + if (( echoMode() == Normal ) || ( echoMode() == Password )) + cursorWordBackward( e->state() & ShiftButton ); + else + home( e->state() & ShiftButton ); + } else { + if (( echoMode() == Normal ) || ( echoMode() == Password )) + cursorWordForward( e->state() & ShiftButton ); + else + end( e->state() & ShiftButton ); + } + break; + case Key_Z: + if ( !d->readOnly ) { + if(e->state() & ShiftButton) + redo(); + else + undo(); + } + break; + case Key_Y: + if ( !d->readOnly ) + redo(); + break; + default: + unknown = TRUE; + } + } else { // ### check for *no* modifier + switch ( e->key() ) { + case Key_Shift: + // ### TODO + break; + case Key_Left: + case Key_Right: { + int step = (d->isRightToLeft() == (e->key() == Key_Right)) ? -1 : 1; + cursorForward( e->state() & ShiftButton, step ); + } + break; + case Key_Backspace: + if ( !d->readOnly ) { + backspace(); + } + break; + case Key_Home: +#ifdef TQ_WS_MACX + case Key_Up: +#endif + home( e->state() & ShiftButton ); + break; + case Key_End: +#ifdef TQ_WS_MACX + case Key_Down: +#endif + end( e->state() & ShiftButton ); + break; + case Key_Delete: + if ( !d->readOnly ) { +#if defined (TQ_WS_WIN) + if ( e->state() & ShiftButton ) { + cut(); + break; + } +#endif + del(); + } + break; +#if defined (TQ_WS_WIN) + case Key_Insert: + if ( !d->readOnly && e->state() & ShiftButton ) + paste(); + else + unknown = TRUE; + break; +#endif + case Key_F14: // Undo key on Sun keyboards + if ( !d->readOnly ) + undo(); + break; +#ifndef TQT_NO_CLIPBOARD + case Key_F16: // Copy key on Sun keyboards + copy(); + break; + case Key_F18: // Paste key on Sun keyboards + if ( !d->readOnly ) + paste(); + break; + case Key_F20: // Cut key on Sun keyboards + if ( !d->readOnly && hasSelectedText() && echoMode() == Normal ) { + copy(); + del(); + } + break; +#endif + default: + unknown = TRUE; + } + } + if ( e->key() == Key_Direction_L || e->key() == Key_Direction_R ) { + d->direction = (e->key() == Key_Direction_L) ? TQChar::DirL : TQChar::DirR; + d->updateTextLayout(); + update(); + } + + if ( unknown ) + e->ignore(); +} + + +/*! + This function is not intended as polymorphic usage. Just a shared code + fragment that calls TQWidget::sendMouseEventToInputContext() easily for this + class. + */ +bool TQLineEdit::sendMouseEventToInputContext( TQMouseEvent *e ) +{ +#ifndef TQT_NO_IM + if ( d->composeMode() ) { + int cursor = d->xToPosInternal( e->pos().x(), TQTextItem::OnCharacters ); + int mousePos = cursor - d->imstart; + if ( mousePos >= 0 && mousePos < d->preeditLength() ) { + TQWidget::sendMouseEventToInputContext( mousePos, e->type(), + e->button(), e->state() ); + } else if ( e->type() != TQEvent::MouseMove ) { + // send button events on out of preedit + TQWidget::sendMouseEventToInputContext( -1, e->type(), + e->button(), e->state() ); + } + return TRUE; + } +#endif + return FALSE; +} + + +/*! \reimp + */ +void TQLineEdit::imStartEvent( TQIMEvent *e ) +{ + if ( d->readOnly ) { + e->ignore(); + return; + } + d->removeSelectedText(); + d->updateMicroFocusHint(); + d->imstart = d->imend = d->imselstart = d->imselend = d->cursor; +} + +/*! \reimp + */ +void TQLineEdit::imComposeEvent( TQIMEvent *e ) +{ + if ( d->readOnly ) { + e->ignore(); + return; + } + d->text.replace( d->imstart, d->imend - d->imstart, e->text() ); + d->imend = d->imstart + e->text().length(); + d->imselstart = d->imstart + e->cursorPos(); + d->imselend = d->imselstart + e->selectionLength(); + d->cursor = d->imstart + e->cursorPos(); + d->updateTextLayout(); + d->updateMicroFocusHint(); + update(); +} + +/*! \reimp + */ +void TQLineEdit::imEndEvent( TQIMEvent *e ) +{ + if ( d->readOnly) { + e->ignore(); + return; + } + d->text.remove( d->imstart, d->imend - d->imstart ); + d->cursor = d->imselstart = d->imselend = d->imend = d->imstart; + d->textDirty = TRUE; + insert( e->text() ); +} + +/*!\reimp +*/ + +void TQLineEdit::focusInEvent( TQFocusEvent* ) +{ + if ( TQFocusEvent::reason() == TQFocusEvent::Tab || + TQFocusEvent::reason() == TQFocusEvent::Backtab || + TQFocusEvent::reason() == TQFocusEvent::Shortcut ) + d->maskData ? d->moveCursor( d->nextMaskBlank( 0 ) ) : selectAll(); + if ( !d->cursorTimer ) { + int cft = TQApplication::cursorFlashTime(); + d->cursorTimer = cft ? startTimer( cft/2 ) : -1; + } + if( !hasSelectedText() || style().styleHint( TQStyle::SH_BlinkCursorWhenTextSelected ) ) + d->setCursorVisible( TRUE ); + if ( d->hasIMSelection() ) + d->cursor = d->imselstart; + d->updateMicroFocusHint(); +} + +/*!\reimp +*/ + +void TQLineEdit::focusOutEvent( TQFocusEvent* ) +{ + if ( TQFocusEvent::reason() != TQFocusEvent::ActiveWindow && + TQFocusEvent::reason() != TQFocusEvent::Popup ) + deselect(); + d->setCursorVisible( FALSE ); + if ( d->cursorTimer > 0 ) + killTimer( d->cursorTimer ); + d->cursorTimer = 0; + if (TQFocusEvent::reason() != TQFocusEvent::Popup) + emit lostFocus(); +} + +/*!\reimp +*/ +void TQLineEdit::drawContents( TQPainter *p ) +{ + const TQColorGroup& cg = colorGroup(); + TQRect cr = contentsRect(); + TQFontMetrics fm = fontMetrics(); + TQRect lineRect( cr.x() + innerMargin, cr.y() + (cr.height() - fm.height() + 1) / 2, + cr.width() - 2*innerMargin, fm.height() ); + TQBrush bg = TQBrush( paletteBackgroundColor() ); + if ( paletteBackgroundPixmap() ) + bg = TQBrush( cg.background(), *paletteBackgroundPixmap() ); + else if ( !isEnabled() ) + bg = cg.brush( TQColorGroup::Background ); + TQPoint brushOrigin = p->brushOrigin(); + p->save(); + p->setClipRegion( TQRegion(cr) - lineRect ); + p->setBrushOrigin(brushOrigin - backgroundOffset()); + p->fillRect( cr, bg ); + p->restore(); + TQSharedDoubleBuffer buffer( p, lineRect.x(), lineRect.y(), + lineRect.width(), lineRect.height(), + hasFocus() ? TQSharedDoubleBuffer::Force : 0 ); + p = buffer.painter(); + brushOrigin = p->brushOrigin(); + p->setBrushOrigin(brushOrigin - backgroundOffset()); + p->fillRect( lineRect, bg ); + p->setBrushOrigin(brushOrigin); + + // locate cursor position + int cix = 0; + TQTextItem ci = d->textLayout.findItem( d->cursor ); + if ( ci.isValid() ) { + if ( d->cursor != (int)d->text.length() && d->cursor == ci.from() + ci.length() + && ci.isRightToLeft() != d->isRightToLeft() ) + ci = d->textLayout.findItem( d->cursor + 1 ); + cix = ci.x() + ci.cursorToX( d->cursor - ci.from() ); + } + + // horizontal scrolling + int minLB = TQMAX( 0, -fm.minLeftBearing() ); + int minRB = TQMAX( 0, -fm.minRightBearing() ); + int widthUsed = d->textLayout.widthUsed() + 1 + minRB; + if ( (minLB + widthUsed) <= lineRect.width() ) { + switch ( d->visualAlignment() ) { + case AlignRight: + d->hscroll = widthUsed - lineRect.width() + 1; + break; + case AlignHCenter: + d->hscroll = ( widthUsed - lineRect.width() ) / 2; + break; + default: + d->hscroll = 0; + break; + } + d->hscroll -= minLB; + } else if ( cix - d->hscroll >= lineRect.width() ) { + d->hscroll = cix - lineRect.width() + 1; + } else if ( cix - d->hscroll < 0 ) { + d->hscroll = cix; + } else if ( widthUsed - d->hscroll < lineRect.width() ) { + d->hscroll = widthUsed - lineRect.width() + 1; + } else if (d->hscroll < 0) { + d->hscroll = 0; + } + // This updateMicroFocusHint() is corresponding to update() at + // IMCompose event. Although the function is invoked from various + // other points, some situations such as "candidate selection on + // AlignHCenter'ed text" need this invocation because + // updateMicroFocusHint() requires updated contentsRect(), and + // there are no other chances in such situation that invoke the + // function. + d->updateMicroFocusHint(); + // the y offset is there to keep the baseline constant in case we have script changes in the text. + TQPoint topLeft = lineRect.topLeft() - TQPoint(d->hscroll, d->ascent-fm.ascent()); + + // draw text, selections and cursors + p->setPen( cg.text() ); + bool supressCursor = d->readOnly, hasRightToLeft = d->isRightToLeft(); + int textflags = 0; + if ( font().underline() ) + textflags |= TQt::Underline; + if ( font().strikeOut() ) + textflags |= TQt::StrikeOut; + if ( font().overline() ) + textflags |= TQt::Overline; + + for ( int i = 0; i < d->textLayout.numItems(); i++ ) { + TQTextItem ti = d->textLayout.itemAt( i ); + hasRightToLeft |= ti.isRightToLeft(); + int tix = topLeft.x() + ti.x(); + int first = ti.from(); + int last = ti.from() + ti.length() - 1; + + // text and selection + if ( d->selstart < d->selend && (last >= d->selstart && first < d->selend ) ) { + TQRect highlight = TQRect( TQPoint( tix + ti.cursorToX( TQMAX( d->selstart - first, 0 ) ), + lineRect.top() ), + TQPoint( tix + ti.cursorToX( TQMIN( d->selend - first, last - first + 1 ) ) - 1, + lineRect.bottom() ) ).normalize(); + p->save(); + p->setClipRegion( TQRegion( lineRect ) - highlight, TQPainter::CoordPainter ); + p->drawTextItem( topLeft, ti, textflags ); + p->setClipRect( lineRect & highlight, TQPainter::CoordPainter ); + p->fillRect( highlight, cg.highlight() ); + p->setPen( cg.highlightedText() ); + p->drawTextItem( topLeft, ti, textflags ); + p->restore(); + } else { + p->drawTextItem( topLeft, ti, textflags ); + } + + // input method edit area + if ( d->composeMode() && (last >= d->imstart && first < d->imend ) ) { + TQRect highlight = TQRect( TQPoint( tix + ti.cursorToX( TQMAX( d->imstart - first, 0 ) ), lineRect.top() ), + TQPoint( tix + ti.cursorToX( TQMIN( d->imend - first, last - first + 1 ) )-1, lineRect.bottom() ) ).normalize(); + p->save(); + p->setClipRect( lineRect & highlight, TQPainter::CoordPainter ); + + int h1, s1, v1, h2, s2, v2; + cg.color( TQColorGroup::Base ).hsv( &h1, &s1, &v1 ); + cg.color( TQColorGroup::Background ).hsv( &h2, &s2, &v2 ); + TQColor imCol; + imCol.setHsv( h1, s1, ( v1 + v2 ) / 2 ); + p->fillRect( highlight, imCol ); + p->drawTextItem( topLeft, ti, textflags ); + // draw preedit's underline + if (d->imend - d->imstart > 0) { + p->setPen( cg.text() ); + p->drawLine( highlight.bottomLeft(), highlight.bottomRight() ); + } + p->restore(); + } + + // input method selection + if ( d->hasIMSelection() && (last >= d->imselstart && first < d->imselend ) ) { + TQRect highlight = TQRect( TQPoint( tix + ti.cursorToX( TQMAX( d->imselstart - first, 0 ) ), lineRect.top() ), + TQPoint( tix + ti.cursorToX( TQMIN( d->imselend - first, last - first + 1 ) )-1, lineRect.bottom() ) ).normalize(); + p->save(); + p->setClipRect( lineRect & highlight, TQPainter::CoordPainter ); + p->fillRect( highlight, cg.text() ); + p->setPen( paletteBackgroundColor() ); + p->drawTextItem( topLeft, ti, textflags ); + p->restore(); + supressCursor = TRUE; + } + + // overwrite cursor + if ( d->cursorVisible && d->maskData && + d->selend <= d->selstart && (last >= d->cursor && first <= d->cursor ) ) { + TQRect highlight = TQRect( TQPoint( tix + ti.cursorToX( TQMAX( d->cursor - first, 0 ) ), lineRect.top() ), + TQPoint( tix + ti.cursorToX( TQMIN( d->cursor + 1 - first, last - first + 1 ) )-1, lineRect.bottom() ) ).normalize(); + p->save(); + p->setClipRect( lineRect & highlight, TQPainter::CoordPainter ); + p->fillRect( highlight, cg.text() ); + p->setPen( paletteBackgroundColor() ); + p->drawTextItem( topLeft, ti, textflags ); + p->restore(); + supressCursor = TRUE; + } + } + + // draw cursor + // + // Asian users regard IM selection text as cursor on candidate + // selection phase of input method, so ordinary cursor should be + // invisible if IM selection text exists. + if ( d->cursorVisible && !supressCursor && !d->hasIMSelection() && (d->echoMode != PasswordThreeStars) ) { + TQPoint from( topLeft.x() + cix, lineRect.top() ); + TQPoint to = from + TQPoint( 0, lineRect.height() ); + p->drawLine( from, to ); + if ( hasRightToLeft ) { + bool rtl = ci.isValid() ? ci.isRightToLeft() : TRUE; + to = from + TQPoint( (rtl ? -2 : 2), 2 ); + p->drawLine( from, to ); + from.ry() += 4; + p->drawLine( from, to ); + } + } + buffer.end(); +} + + +#ifndef TQT_NO_DRAGANDDROP +/*!\reimp +*/ +void TQLineEdit::dragMoveEvent( TQDragMoveEvent *e ) +{ + if ( !d->readOnly && TQTextDrag::canDecode(e) ) { + e->acceptAction(); + d->cursor = d->xToPos( e->pos().x() ); + d->cursorVisible = TRUE; + update(); + } +} + +/*!\reimp */ +void TQLineEdit::dragEnterEvent( TQDragEnterEvent * e ) +{ + TQLineEdit::dragMoveEvent( e ); +} + +/*!\reimp */ +void TQLineEdit::dragLeaveEvent( TQDragLeaveEvent *) +{ + if ( d->cursorVisible ) { + d->cursorVisible = FALSE; + update(); + } +} + +/*!\reimp */ +void TQLineEdit::dropEvent( TQDropEvent* e ) +{ + TQString str; + // try text/plain + TQCString plain = "plain"; + bool decoded = TQTextDrag::decode(e, str, plain); + // otherwise we'll accept any kind of text (like text/uri-list) + if (! decoded) + decoded = TQTextDrag::decode(e, str); + + if ( decoded && !d->readOnly ) { + if ( e->source() == this && e->action() == TQDropEvent::Copy ) + deselect(); + d->cursor =d->xToPos( e->pos().x() ); + int selStart = d->cursor; + int oldSelStart = d->selstart; + int oldSelEnd = d->selend; + d->cursorVisible = FALSE; + e->acceptAction(); + insert( str ); + if ( e->source() == this ) { + if ( e->action() == TQDropEvent::Move ) { + if ( selStart > oldSelStart && selStart <= oldSelEnd ) + setSelection( oldSelStart, str.length() ); + else if ( selStart > oldSelEnd ) + setSelection( selStart - str.length(), str.length() ); + else + setSelection( selStart, str.length() ); + } else { + setSelection( selStart, str.length() ); + } + } + } else { + e->ignore(); + update(); + } +} + +bool TQLineEditPrivate::drag() +{ + q->killTimer( dndTimer ); + dndTimer = 0; + TQTextDrag *tdo = new TQTextDrag( q->selectedText(), q ); + + TQGuardedPtr gptr = q; + bool r = tdo->drag(); + if ( !gptr ) + return FALSE; + + // ### fix the check TQDragObject::target() != q in TQt4 (should not be needed) + if ( r && !readOnly && TQDragObject::target() != q ) { + int priorState = undoState; + removeSelectedText(); + finishChange( priorState ); + } +#ifndef TQT_NO_CURSOR + q->setCursor( readOnly ? arrowCursor : ibeamCursor ); +#endif + return TRUE; +} + +#endif // TQT_NO_DRAGANDDROP + +enum { IdUndo, IdRedo, IdSep1, IdCut, IdCopy, IdPaste, IdClear, IdSep2, IdSelectAll }; + +/*!\reimp +*/ +void TQLineEdit::contextMenuEvent( TQContextMenuEvent * e ) +{ +#ifndef TQT_NO_POPUPMENU +#ifndef TQT_NO_IM + if ( d->composeMode() ) + return; +#endif + d->separate(); + TQPopupMenu *menu = createPopupMenu(); + if (!menu) + return; + TQGuardedPtr popup = menu; + TQGuardedPtr that = this; + TQPoint pos = e->reason() == TQContextMenuEvent::Mouse ? e->globalPos() : + mapToGlobal( TQPoint(e->pos().x(), 0) ) + TQPoint( width() / 2, height() / 2 ); + int r = popup->exec( pos ); + delete (TQPopupMenu*)popup; + if ( that && d->menuId ) { + switch ( d->menuId - r ) { + case IdClear: clear(); break; + case IdSelectAll: selectAll(); break; + case IdUndo: undo(); break; + case IdRedo: redo(); break; +#ifndef TQT_NO_CLIPBOARD + case IdCut: cut(); break; + case IdCopy: copy(); break; + case IdPaste: paste(); break; +#endif + default: + ; // nothing selected or lineedit destroyed. Be careful. + } + } +#endif //TQT_NO_POPUPMENU +} + +/*! + This function is called to create the popup menu which is shown + when the user clicks on the line edit with the right mouse button. + If you want to create a custom popup menu, reimplement this + function and return the popup menu you create. The popup menu's + ownership is transferred to the caller. +*/ + +TQPopupMenu *TQLineEdit::createPopupMenu() +{ +#ifndef TQT_NO_POPUPMENU + TQPopupMenu *popup = new TQPopupMenu( this, "qt_edit_menu" ); + int id = d->menuId = popup->insertItem( tr( "&Undo" ) + ACCEL_KEY( Z ) ); + popup->insertItem( tr( "&Redo" ) + ACCEL_KEY( Y ) ); + popup->insertSeparator(); + popup->insertItem( tr( "Cu&t" ) + ACCEL_KEY( X ) ); + popup->insertItem( tr( "&Copy" ) + ACCEL_KEY( C ) ); + popup->insertItem( tr( "&Paste" ) + ACCEL_KEY( V ) ); + popup->insertItem( tr( "Clear" ) ); + popup->insertSeparator(); + popup->insertItem( tr( "Select All" ) +#ifndef TQ_WS_X11 + + ACCEL_KEY( A ) +#endif + ); + +#ifndef TQT_NO_IM + TQInputContext *qic = getInputContext(); + if ( qic ) + qic->addMenusTo( popup ); +#endif + + popup->setItemEnabled( id - IdUndo, d->isUndoAvailable() ); + popup->setItemEnabled( id - IdRedo, d->isRedoAvailable() ); +#ifndef TQT_NO_CLIPBOARD + popup->setItemEnabled( id - IdCut, !d->readOnly && d->hasSelectedText() ); + popup->setItemEnabled( id - IdCopy, d->hasSelectedText() ); + popup->setItemEnabled( id - IdPaste, !d->readOnly && !TQApplication::clipboard()->text().isEmpty() ); +#else + popup->setItemVisible( id - IdCut, FALSE ); + popup->setItemVisible( id - IdCopy, FALSE ); + popup->setItemVisible( id - IdPaste, FALSE ); +#endif + popup->setItemEnabled( id - IdClear, !d->readOnly && !d->text.isEmpty() ); + popup->setItemEnabled( id - IdSelectAll, !d->text.isEmpty() && !d->allSelected() ); + return popup; +#else + return 0; +#endif +} + +/*! \reimp */ +void TQLineEdit::windowActivationChange( bool b ) +{ + //### remove me with WHighlightSelection attribute + if ( palette().active() != palette().inactive() ) + update(); + TQWidget::windowActivationChange( b ); +} + +/*! \reimp */ + +void TQLineEdit::setPalette( const TQPalette & p ) +{ + //### remove me with WHighlightSelection attribute + TQWidget::setPalette( p ); + update(); +} + +/*! \reimp */ +void TQLineEdit::setFont( const TQFont & f ) +{ + TQWidget::setFont( f ); + d->updateTextLayout(); +} + +/*! \obsolete +*/ +int TQLineEdit::characterAt( int xpos, TQChar *chr ) const +{ + int pos = d->xToPos( xpos + contentsRect().x() - d->hscroll + innerMargin ); + if ( chr && pos < (int) d->text.length() ) + *chr = d->text.at( pos ); + return pos; +} + +/*! + \internal + + Sets the password character to \a c. + + \sa passwordChar() +*/ + +void TQLineEdit::setPasswordChar( TQChar c ) +{ + d->passwordChar = c; +} + +/*! + \internal + + Returns the password character. + + \sa setPasswordChar() +*/ +TQChar TQLineEdit::passwordChar() const +{ + return ( d->passwordChar.isNull() ? TQChar( style().styleHint( TQStyle::SH_LineEdit_PasswordCharacter, this ) ) : d->passwordChar ); +} + +void TQLineEdit::clipboardChanged() +{ +} + +void TQLineEditPrivate::init( const TQString& txt ) +{ +#ifndef TQT_NO_CURSOR + q->setCursor( readOnly ? arrowCursor : ibeamCursor ); +#endif + q->setFocusPolicy( TQWidget::StrongFocus ); + q->setInputMethodEnabled( TRUE ); + // Specifies that this widget can use more, but is able to survive on + // less, horizontal space; and is fixed vertically. + q->setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed ) ); + q->setBackgroundMode( PaletteBase ); + q->setKeyCompression( TRUE ); + q->setMouseTracking( TRUE ); + q->setAcceptDrops( TRUE ); + q->setFrame( TRUE ); + text = txt; + updateTextLayout(); + cursor = text.length(); +} + +void TQLineEditPrivate::updateTextLayout() +{ + // replace all non-printable characters with spaces (to avoid + // drawing boxes when using fonts that don't have glyphs for such + // characters) + const TQString &displayText = q->displayText(); + TQString str(displayText.unicode(), displayText.length()); + TQChar* uc = (TQChar*)str.unicode(); + for (int i = 0; i < (int)str.length(); ++i) { + if (! uc[i].isPrint()) + uc[i] = TQChar(0x0020); + } + textLayout.setText( str, q->font() ); + textLayout.setDirection((TQChar::Direction)direction); + textLayout.beginLayout(TQTextLayout::SingleLine); + textLayout.beginLine( INT_MAX ); + while ( !textLayout.atEnd() ) + textLayout.addCurrentItem(); + ascent = 0; + textLayout.endLine(0, 0, TQt::AlignLeft|TQt::SingleLine, &ascent); +} + +int TQLineEditPrivate::xToPosInternal( int x, TQTextItem::CursorPosition betweenOrOn ) const +{ + x-= q->contentsRect().x() - hscroll + innerMargin; + for ( int i = 0; i < textLayout.numItems(); ++i ) { + TQTextItem ti = textLayout.itemAt( i ); + TQRect tir = ti.rect(); + if ( x >= tir.left() && x <= tir.right() ) + return ti.xToCursor( x - tir.x(), betweenOrOn ) + ti.from(); + } + return x < 0 ? -1 : text.length(); +} + +int TQLineEditPrivate::xToPos( int x, TQTextItem::CursorPosition betweenOrOn ) const +{ + int pos = xToPosInternal( x, betweenOrOn ); + return ( pos < 0 ) ? 0 : pos; +} + + +TQRect TQLineEditPrivate::cursorRect() const +{ + TQRect cr = q->contentsRect(); + int cix = cr.x() - hscroll + innerMargin; + TQTextItem ci = textLayout.findItem( cursor ); + if ( ci.isValid() ) { + if ( cursor != (int)text.length() && cursor == ci.from() + ci.length() + && ci.isRightToLeft() != isRightToLeft() ) + ci = textLayout.findItem( cursor + 1 ); + cix += ci.x() + ci.cursorToX( cursor - ci.from() ); + } + int ch = q->fontMetrics().height(); + return TQRect( cix-4, cr.y() + ( cr.height() - ch + 1) / 2, 8, ch + 1 ); +} + +void TQLineEditPrivate::updateMicroFocusHint() +{ + // To reduce redundant microfocus update notification, we remember + // the old rect and update the microfocus if actual update is + // required. The rect o is intentionally static because some + // notifyee requires the microfocus information as global update + // rather than per notifyee update to place shared widget around + // microfocus. + static TQRect o; + if ( q->hasFocus() ) { + TQRect r = cursorRect(); + if ( o != r ) { + o = r; + q->setMicroFocusHint( r.x(), r.y(), r.width(), r.height() ); + } + } +} + +void TQLineEditPrivate::moveCursor( int pos, bool mark ) +{ + if ( pos != cursor ) + separate(); + if ( maskData && pos > cursor ) + pos = nextMaskBlank( pos ); + else if ( maskData && pos < cursor ) + pos = prevMaskBlank( pos ); + bool fullUpdate = mark || hasSelectedText(); + if ( mark ) { + int anchor; + if ( selend > selstart && cursor == selstart ) + anchor = selend; + else if ( selend > selstart && cursor == selend ) + anchor = selstart; + else + anchor = cursor; + selstart = TQMIN( anchor, pos ); + selend = TQMAX( anchor, pos ); + } else { + deselect(); + } + if ( fullUpdate ) { + cursor = pos; + q->update(); + } else { + setCursorVisible( FALSE ); + cursor = pos; + setCursorVisible( TRUE ); + } + updateMicroFocusHint(); + if ( mark && !q->style().styleHint( TQStyle::SH_BlinkCursorWhenTextSelected ) ) + setCursorVisible( FALSE ); + if ( mark || selDirty ) { + selDirty = FALSE; + emit q->selectionChanged(); + } +} + +void TQLineEditPrivate::finishChange( int validateFromState, bool setModified ) +{ + bool lineDirty = selDirty; + if ( textDirty ) { + // do validation + bool wasValidInput = validInput; + validInput = TRUE; +#ifndef TQT_NO_VALIDATOR + if ( validator && validateFromState >= 0 ) { + TQString textCopy = text; + int cursorCopy = cursor; + validInput = ( validator->validate( textCopy, cursorCopy ) != TQValidator::Invalid ); + if ( validInput ) { + if ( text != textCopy ) { + q->setText( textCopy ); + cursor = cursorCopy; + return; + } + cursor = cursorCopy; + } + } +#endif + if ( validateFromState >= 0 && wasValidInput && !validInput ) { + undo( validateFromState ); + history.resize( undoState ); + validInput = TRUE; + textDirty = setModified = FALSE; + } + updateTextLayout(); + updateMicroFocusHint(); + lineDirty |= textDirty; + if ( setModified ) + modified = TRUE; + if ( textDirty ) { + textDirty = FALSE; + emit q->textChanged( maskData ? stripString(text) : text ); + } +#if defined(QT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( q, 0, TQAccessible::ValueChanged ); +#endif + } + if ( selDirty ) { + selDirty = FALSE; + emit q->selectionChanged(); + } + if ( lineDirty || !setModified ) + q->update(); +} + +void TQLineEditPrivate::setText( const TQString& txt ) +{ + deselect(); + TQString oldText = text; + if ( maskData ) { + text = maskString( 0, txt, TRUE ); + text += clearString( text.length(), maxLength - text.length() ); + } else { + text = txt.isEmpty() ? txt : txt.left( maxLength ); + } + history.clear(); + undoState = 0; + cursor = text.length(); + textDirty = ( oldText != text ); +} + + +void TQLineEditPrivate::setCursorVisible( bool visible ) +{ + if ( (bool)cursorVisible == visible ) + return; + if ( cursorTimer ) + cursorVisible = visible; + TQRect r = cursorRect(); + if ( maskData || !q->contentsRect().contains( r ) ) + q->update(); + else + q->update( r ); +} + +void TQLineEditPrivate::addCommand( const Command& cmd ) +{ + if ( separator && undoState && history[undoState-1].type != Separator ) { + history.resize( undoState + 2 ); + history[undoState++] = Command( Separator, 0, 0 ); + } else { + history.resize( undoState + 1); + } + separator = FALSE; + history[ undoState++ ] = cmd; +} + +void TQLineEditPrivate::insert( const TQString& s ) +{ + if ( maskData ) { + TQString ms = maskString( cursor, s ); + for ( int i = 0; i < (int) ms.length(); ++i ) { + addCommand ( Command( DeleteSelection, cursor+i, text.at(cursor+i) ) ); + addCommand( Command( Insert, cursor+i, ms.at(i) ) ); + } + text.replace( cursor, ms.length(), ms ); + cursor += ms.length(); + cursor = nextMaskBlank( cursor ); + } else { + int remaining = maxLength - text.length(); + text.insert( cursor, s.left(remaining) ); + for ( int i = 0; i < (int) s.left(remaining).length(); ++i ) + addCommand( Command( Insert, cursor++, s.at(i) ) ); + } + textDirty = TRUE; +} + +void TQLineEditPrivate::del( bool wasBackspace ) +{ + if ( cursor < (int) text.length() ) { + addCommand ( Command( (CommandType)((maskData?2:0)+(wasBackspace?Remove:Delete)), cursor, text.at(cursor) ) ); + if ( maskData ) { + text.replace( cursor, 1, clearString( cursor, 1 ) ); + addCommand( Command( Insert, cursor, text.at( cursor ) ) ); + } else { + text.remove( cursor, 1 ); + } + textDirty = TRUE; + } +} + +void TQLineEditPrivate::removeSelectedText() +{ + if ( selstart < selend && selend <= (int) text.length() ) { + separate(); + int i ; + if ( selstart <= cursor && cursor < selend ) { + // cursor is within the selection. Split up the commands + // to be able to restore the correct cursor position + for ( i = cursor; i >= selstart; --i ) + addCommand ( Command( DeleteSelection, i, text.at(i) ) ); + for ( i = selend - 1; i > cursor; --i ) + addCommand ( Command( DeleteSelection, i - cursor + selstart - 1, text.at(i) ) ); + } else { + for ( i = selend-1; i >= selstart; --i ) + addCommand ( Command( RemoveSelection, i, text.at(i) ) ); + } + if ( maskData ) { + text.replace( selstart, selend - selstart, clearString( selstart, selend - selstart ) ); + for ( int i = 0; i < selend - selstart; ++i ) + addCommand( Command( Insert, selstart + i, text.at( selstart + i ) ) ); + } else { + text.remove( selstart, selend - selstart ); + } + if ( cursor > selstart ) + cursor -= TQMIN( cursor, selend ) - selstart; + deselect(); + textDirty = TRUE; + } +} + +void TQLineEditPrivate::parseInputMask( const TQString &maskFields ) +{ + if ( maskFields.isEmpty() || maskFields.section( ';', 0, 0 ).isEmpty() ) { + if ( maskData ) { + delete [] maskData; + maskData = 0; + maxLength = 32767; + q->setText( TQString::null ); + } + return; + } + + inputMask = maskFields.section( ';', 0, 0 ); + blank = maskFields.section( ';', 1, 1 ).at(0); + if ( blank.isNull() ) + blank = ' '; + + // calculate maxLength / maskData length + maxLength = 0; + TQChar c = 0; + uint i; + for ( i=0; i 0 && inputMask.at( i-1 ) == '\\' ) { + maxLength++; + continue; + } + if ( c != '\\' && c != '!' && + c != '<' && c != '>' && + c != '{' && c != '}' && + c != '[' && c != ']' ) + maxLength++; + } + + delete [] maskData; + maskData = new MaskInputData[ maxLength ]; + + MaskInputData::Casemode m = MaskInputData::NoCaseMode; + c = 0; + bool s; + bool escape = FALSE; + int index = 0; + for ( i = 0; i < inputMask.length(); i++ ) { + c = inputMask.at(i); + if ( escape ) { + s = TRUE; + maskData[ index ].maskChar = c; + maskData[ index ].separator = s; + maskData[ index ].caseMode = m; + index++; + escape = FALSE; + } else if ( c == '<' || c == '>' || c == '!') { + switch ( c ) { + case '<': + m = MaskInputData::Lower; + break; + case '>': + m = MaskInputData::Upper; + break; + case '!': + m = MaskInputData::NoCaseMode; + break; + } + } else if ( c != '{' && c != '}' && c != '[' && c != ']' ) { + switch ( c ) { + case 'A': + case 'a': + case 'N': + case 'n': + case 'X': + case 'x': + case '9': + case '0': + case 'D': + case 'd': + case '#': + s = FALSE; + break; + case '\\': + escape = TRUE; + default: + s = TRUE; + break; + } + + if ( !escape ) { + maskData[ index ].maskChar = c; + maskData[ index ].separator = s; + maskData[ index ].caseMode = m; + index++; + } + } + } + q->setText( TQString::null ); +} + + +/* checks if the key is valid compared to the inputMask */ +bool TQLineEditPrivate::isValidInput( TQChar key, TQChar mask ) const +{ + switch ( mask ) { + case 'A': + if ( key.isLetter() && key != blank ) + return TRUE; + break; + case 'a': + if ( key.isLetter() || key == blank ) + return TRUE; + break; + case 'N': + if ( key.isLetterOrNumber() && key != blank ) + return TRUE; + break; + case 'n': + if ( key.isLetterOrNumber() || key == blank ) + return TRUE; + break; + case 'X': + if ( key.isPrint() && key != blank ) + return TRUE; + break; + case 'x': + if ( key.isPrint() || key == blank ) + return TRUE; + break; + case '9': + if ( key.isNumber() && key != blank ) + return TRUE; + break; + case '0': + if ( key.isNumber() || key == blank ) + return TRUE; + break; + case 'D': + if ( key.isNumber() && key.digitValue() > 0 && key != blank ) + return TRUE; + break; + case 'd': + if ( (key.isNumber() && key.digitValue() > 0) || key == blank ) + return TRUE; + break; + case '#': + if ( key.isNumber() || key == '+' || key == '-' || key == blank ) + return TRUE; + break; + default: + break; + } + return FALSE; +} + +/* + Applies the inputMask on \a str starting from position \a pos in the mask. \a clear + specifies from where characters should be gotten when a separator is met in \a str - TRUE means + that blanks will be used, FALSE that previous input is used. + Calling this when no inputMask is set is undefined. +*/ +TQString TQLineEditPrivate::maskString( uint pos, const TQString &str, bool clear) const +{ + if ( pos >= (uint)maxLength ) + return TQString::fromLatin1(""); + + TQString fill; + fill = clear ? clearString( 0, maxLength ) : text; + + uint strIndex = 0; + TQString s = TQString::fromLatin1(""); + int i = pos; + while ( i < maxLength ) { + if ( strIndex < str.length() ) { + if ( maskData[ i ].separator ) { + s += maskData[ i ].maskChar; + if ( str[(int)strIndex] == maskData[ i ].maskChar ) + strIndex++; + ++i; + } else { + if ( isValidInput( str[(int)strIndex], maskData[ i ].maskChar ) ) { + switch ( maskData[ i ].caseMode ) { + case MaskInputData::Upper: + s += str[(int)strIndex].upper(); + break; + case MaskInputData::Lower: + s += str[(int)strIndex].lower(); + break; + default: + s += str[(int)strIndex]; + } + ++i; + } else { + // search for separator first + int n = findInMask( i, TRUE, TRUE, str[(int)strIndex] ); + if ( n != -1 ) { + if ( str.length() != 1 || i == 0 || (i > 0 && (!maskData[i-1].separator || maskData[i-1].maskChar != str[(int)strIndex])) ) { + s += fill.mid( i, n-i+1 ); + i = n + 1; // update i to find + 1 + } + } else { + // search for valid blank if not + n = findInMask( i, TRUE, FALSE, str[(int)strIndex] ); + if ( n != -1 ) { + s += fill.mid( i, n-i ); + switch ( maskData[ n ].caseMode ) { + case MaskInputData::Upper: + s += str[(int)strIndex].upper(); + break; + case MaskInputData::Lower: + s += str[(int)strIndex].lower(); + break; + default: + s += str[(int)strIndex]; + } + i = n + 1; // updates i to find + 1 + } + } + } + strIndex++; + } + } else + break; + } + + return s; +} + + + +/* + Returns a "cleared" string with only separators and blank chars. + Calling this when no inputMask is set is undefined. +*/ +TQString TQLineEditPrivate::clearString( uint pos, uint len ) const +{ + if ( pos >= (uint)maxLength ) + return TQString::null; + + TQString s; + int end = TQMIN( (uint)maxLength, pos + len ); + for ( int i=pos; i= maxLength || pos < 0 ) + return -1; + + int end = forward ? maxLength : -1; + int step = forward ? 1 : -1; + int i = pos; + + while ( i != end ) { + if ( findSeparator ) { + if ( maskData[ i ].separator && maskData[ i ].maskChar == searchChar ) + return i; + } else { + if ( !maskData[ i ].separator ) { + if ( searchChar.isNull() ) + return i; + else if ( isValidInput( searchChar, maskData[ i ].maskChar ) ) + return i; + } + } + i += step; + } + return -1; +} + + +#endif // TQT_NO_LINEEDIT diff --git a/src/widgets/tqlineedit.h b/src/widgets/tqlineedit.h new file mode 100644 index 000000000..f5bf18c68 --- /dev/null +++ b/src/widgets/tqlineedit.h @@ -0,0 +1,218 @@ +/********************************************************************** +** +** Definition of TQLineEdit widget class +** +** Created : 941011 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQLINEEDIT_H +#define TQLINEEDIT_H + +struct TQLineEditPrivate; + +class TQValidator; +class TQPopupMenu; + +#ifndef QT_H +#include "ntqframe.h" +#include "tqstring.h" +#endif // QT_H + +#ifndef TQT_NO_LINEEDIT + +class TQTextParagraph; +class TQTextCursor; + +class TQ_EXPORT TQLineEdit : public TQFrame +{ + TQ_OBJECT + TQ_ENUMS( EchoMode ) + TQ_PROPERTY( TQString text READ text WRITE setText ) + TQ_PROPERTY( int maxLength READ maxLength WRITE setMaxLength ) + TQ_PROPERTY( bool frame READ frame WRITE setFrame ) + TQ_PROPERTY( EchoMode echoMode READ echoMode WRITE setEchoMode ) + TQ_PROPERTY( TQString displayText READ displayText ) + TQ_PROPERTY( int cursorPosition READ cursorPosition WRITE setCursorPosition ) + TQ_PROPERTY( Alignment alignment READ alignment WRITE setAlignment ) + TQ_PROPERTY( bool edited READ edited WRITE setEdited DESIGNABLE false ) + TQ_PROPERTY( bool modified READ isModified ) + TQ_PROPERTY( bool hasSelectedText READ hasSelectedText ) + TQ_PROPERTY( TQString selectedText READ selectedText ) + TQ_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled ) + TQ_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly ) + TQ_PROPERTY( bool undoAvailable READ isUndoAvailable ) + TQ_PROPERTY( bool redoAvailable READ isRedoAvailable ) + TQ_PROPERTY( TQString inputMask READ inputMask WRITE setInputMask ) + TQ_PROPERTY( bool acceptableInput READ hasAcceptableInput ) + +public: + TQLineEdit( TQWidget* parent, const char* name=0 ); + TQLineEdit( const TQString &, TQWidget* parent, const char* name=0 ); + TQLineEdit( const TQString &, const TQString &, TQWidget* parent, const char* name=0 ); + ~TQLineEdit(); + + TQString text() const; + + TQString displayText() const; + + int maxLength() const; + + bool frame() const; + + enum EchoMode { Normal, NoEcho, Password, PasswordThreeStars }; + EchoMode echoMode() const; + + bool isReadOnly() const; + + const TQValidator * validator() const; + + TQSize sizeHint() const; + TQSize minimumSizeHint() const; + + int cursorPosition() const; + bool validateAndSet( const TQString &, int, int, int ); // obsolete + + int alignment() const; + + void cursorForward( bool mark, int steps = 1 ); + void cursorBackward( bool mark, int steps = 1 ); + void cursorWordForward( bool mark ); + void cursorWordBackward( bool mark ); + void backspace(); + void del(); + void home( bool mark ); + void end( bool mark ); + + bool isModified() const; + void clearModified(); + + bool edited() const; // obsolete, use isModified() + void setEdited( bool ); // obsolete, use clearModified() + + bool hasSelectedText() const; + TQString selectedText() const; + int selectionStart() const; + + bool isUndoAvailable() const; + bool isRedoAvailable() const; + + bool dragEnabled() const; + + TQString inputMask() const; + void setInputMask( const TQString &inputMask ); + bool hasAcceptableInput() const; + +public slots: + virtual void setText( const TQString &); + virtual void selectAll(); + virtual void deselect(); + virtual void clearValidator(); + virtual void insert( const TQString &); + virtual void clear(); + virtual void undo(); + virtual void redo(); + virtual void setMaxLength( int ); + virtual void setFrame( bool ); + virtual void setEchoMode( EchoMode ); + virtual void setReadOnly( bool ); + virtual void setValidator( const TQValidator * ); + virtual void setFont( const TQFont & ); + virtual void setPalette( const TQPalette & ); + virtual void setSelection( int, int ); + virtual void setCursorPosition( int ); + virtual void setAlignment( int flag ); +#ifndef TQT_NO_CLIPBOARD + virtual void cut(); + virtual void copy() const; + virtual void paste(); +#endif + virtual void setDragEnabled( bool b ); + +signals: + void textChanged( const TQString &); + void returnPressed(); + void lostFocus(); + void selectionChanged(); + +protected: + bool event( TQEvent * ); + void mousePressEvent( TQMouseEvent * ); + void mouseMoveEvent( TQMouseEvent * ); + void mouseReleaseEvent( TQMouseEvent * ); + void mouseDoubleClickEvent( TQMouseEvent * ); + void keyPressEvent( TQKeyEvent * ); + void imStartEvent( TQIMEvent * ); + void imComposeEvent( TQIMEvent * ); + void imEndEvent( TQIMEvent * ); + void focusInEvent( TQFocusEvent * ); + void focusOutEvent( TQFocusEvent * ); + void resizeEvent( TQResizeEvent * ); + void drawContents( TQPainter * ); +#ifndef TQT_NO_DRAGANDDROP + void dragEnterEvent( TQDragEnterEvent * ); + void dragMoveEvent( TQDragMoveEvent *e ); + void dragLeaveEvent( TQDragLeaveEvent *e ); + void dropEvent( TQDropEvent * ); +#endif + void contextMenuEvent( TQContextMenuEvent * ); + bool sendMouseEventToInputContext( TQMouseEvent *e ); + virtual TQPopupMenu *createPopupMenu(); + void windowActivationChange( bool ); + +private slots: + void clipboardChanged(); + +public: + void setPasswordChar( TQChar c ); // internal obsolete + TQChar passwordChar() const; // obsolete internal + int characterAt( int, TQChar* ) const; // obsolete + bool getSelection( int *, int * ); // obsolete + +private: + friend struct TQLineEditPrivate; + TQLineEditPrivate * d; + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQLineEdit( const TQLineEdit & ); + TQLineEdit &operator=( const TQLineEdit & ); +#endif +}; + + +#endif // TQT_NO_LINEEDIT + +#endif // TQLINEEDIT_H diff --git a/src/widgets/tqmainwindow.cpp b/src/widgets/tqmainwindow.cpp index 7b66839db..cda9afcb3 100644 --- a/src/widgets/tqmainwindow.cpp +++ b/src/widgets/tqmainwindow.cpp @@ -54,7 +54,7 @@ #include "tqpopupmenu.h" #include "tqtoolbar.h" #include "tqstatusbar.h" -#include "ntqscrollview.h" +#include "tqscrollview.h" #include "tqtooltip.h" #include "tqdatetime.h" #include "tqwhatsthis.h" diff --git a/src/widgets/tqpushbutton.cpp b/src/widgets/tqpushbutton.cpp new file mode 100644 index 000000000..105bae12a --- /dev/null +++ b/src/widgets/tqpushbutton.cpp @@ -0,0 +1,762 @@ +/**************************************************************************** +** +** Implementation of TQPushButton class +** +** Created : 940221 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqpushbutton.h" +#ifndef TQT_NO_PUSHBUTTON +#include "tqdialog.h" +#include "tqfontmetrics.h" +#include "tqpainter.h" +#include "ntqdrawutil.h" +#include "tqpixmap.h" +#include "tqbitmap.h" +#include "tqpopupmenu.h" +#include "ntqguardedptr.h" +#include "ntqapplication.h" +#include "tqtoolbar.h" +#include "tqstyle.h" +#if defined(QT_ACCESSIBILITY_SUPPORT) +#include "ntqaccessible.h" +#endif + +/*! + \class TQPushButton tqpushbutton.h + \brief The TQPushButton widget provides a command button. + + \ingroup basic + \mainclass + + The push button, or command button, is perhaps the most commonly + used widget in any graphical user interface. Push (click) a button + to command the computer to perform some action, or to answer a + question. Typical buttons are OK, Apply, Cancel, Close, Yes, No + and Help. + + A command button is rectangular and typically displays a text + label describing its action. An underlined character in the label + (signified by preceding it with an ampersand in the text) + indicates an accelerator key, e.g. + \code + TQPushButton *pb = new TQPushButton( "&Download", this ); + \endcode + In this example the accelerator is \e{Alt+D}, and the label text + will be displayed as Download. + + Push buttons can display a textual label or a pixmap, and + optionally a small icon. These can be set using the constructors + and changed later using setText(), setPixmap() and setIconSet(). + If the button is disabled the appearance of the text or pixmap and + iconset will be manipulated with respect to the GUI style to make + the button look "disabled". + + A push button emits the signal clicked() when it is activated by + the mouse, the Spacebar or by a keyboard accelerator. Connect to + this signal to perform the button's action. Push buttons also + provide less commonly used signals, for example, pressed() and + released(). + + Command buttons in dialogs are by default auto-default buttons, + i.e. they become the default push button automatically when they + receive the keyboard input focus. A default button is a push + button that is activated when the user presses the Enter or Return + key in a dialog. You can change this with setAutoDefault(). Note + that auto-default buttons reserve a little extra space which is + necessary to draw a default-button indicator. If you do not want + this space around your buttons, call setAutoDefault(FALSE). + + Being so central, the button widget has grown to accommodate a + great many variations in the past decade. The Microsoft style + guide now shows about ten different states of Windows push buttons + and the text implies that there are dozens more when all the + combinations of features are taken into consideration. + + The most important modes or states are: + \list + \i Available or not (grayed out, disabled). + \i Standard push button, toggling push button or menu button. + \i On or off (only for toggling push buttons). + \i Default or normal. The default button in a dialog can generally + be "clicked" using the Enter or Return key. + \i Auto-repeat or not. + \i Pressed down or not. + \endlist + + As a general rule, use a push button when the application or + dialog window performs an action when the user clicks on it (such + as Apply, Cancel, Close and Help) \e and when the widget is + supposed to have a wide, rectangular shape with a text label. + Small, typically square buttons that change the state of the + window rather than performing an action (such as the buttons in + the top-right corner of the TQFileDialog) are not command buttons, + but tool buttons. TQt provides a special class (TQToolButton) for + these buttons. + + If you need toggle behavior (see setToggleButton()) or a button + that auto-repeats the activation signal when being pushed down + like the arrows in a scroll bar (see setAutoRepeat()), a command + button is probably not what you want. When in doubt, use a tool + button. + + A variation of a command button is a menu button. These provide + not just one command, but several, since when they are clicked + they pop up a menu of options. Use the method setPopup() to + associate a popup menu with a push button. + + Other classes of buttons are option buttons (see TQRadioButton) and + check boxes (see TQCheckBox). + + + + In TQt, the TQButton abstract base class provides most of the modes + and other API, and TQPushButton provides GUI logic. See TQButton for + more information about the API. + + \important text, setText, text, pixmap, setPixmap, accel, setAccel, + isToggleButton, setDown, isDown, isOn, state, autoRepeat, + isExclusiveToggle, group, setAutoRepeat, toggle, pressed, released, + clicked, toggled, state stateChanged + + \sa TQToolButton, TQRadioButton TQCheckBox + \link guibooks.html#fowler GUI Design Handbook: Push Button\endlink +*/ + +/*! + \property TQPushButton::autoDefault + \brief whether the push button is the auto default button + + If this property is set to TRUE then the push button is the auto + default button in a dialog. + + In some GUI styles a default button is drawn with an extra frame + around it, up to 3 pixels or more. TQt automatically keeps this + space free around auto-default buttons, i.e. auto-default buttons + may have a slightly larger size hint. + + This property's default is TRUE for buttons that have a TQDialog + parent; otherwise it defaults to FALSE. + + See the \l default property for details of how \l default and + auto-default interact. +*/ + +/*! + \property TQPushButton::autoMask + \brief whether the button is automatically masked + + \sa TQWidget::setAutoMask() +*/ + +/*! + \property TQPushButton::default + \brief whether the push button is the default button + + If this property is set to TRUE then the push button will be + pressed if the user presses the Enter (or Return) key in a dialog. + + Regardless of focus, if the user presses Enter: If there is a + default button the default button is pressed; otherwise, if + there are one or more \l autoDefault buttons the first \l autoDefault + button that is next in the tab order is pressed. If there are no + default or \l autoDefault buttons only pressing Space on a button + with focus, mouse clicking, or using an accelerator will press a + button. + + In a dialog, only one push button at a time can be the default + button. This button is then displayed with an additional frame + (depending on the GUI style). + + The default button behavior is provided only in dialogs. Buttons + can always be clicked from the keyboard by pressing Enter (or + Return) or the Spacebar when the button has focus. + + This property's default is FALSE. +*/ + +/*! + \property TQPushButton::flat + \brief whether the border is disabled + + This property's default is FALSE. +*/ + +/*! + \property TQPushButton::iconSet + \brief the icon set on the push button + + This property will return 0 if the push button has no iconset. +*/ + +/*! + \property TQPushButton::on + \brief whether the push button is toggled + + This property should only be set for toggle push buttons. The + default value is FALSE. + + \sa isOn(), toggle(), toggled(), isToggleButton() +*/ + +/*! + \property TQPushButton::toggleButton + \brief whether the button is a toggle button + + Toggle buttons have an on/off state similar to \link TQCheckBox + check boxes. \endlink A push button is initially not a toggle + button. + + \sa setOn(), toggle(), isToggleButton() toggled() +*/ + +/*! \property TQPushButton::menuButton + \brief whether the push button has a menu button on it + \obsolete + + If this property is set to TRUE, then a down arrow is drawn on the push + button to indicate that a menu will pop up if the user clicks on the + arrow. +*/ + +class TQPushButtonPrivate +{ +public: + TQPushButtonPrivate() + :iconset( 0 ) + {} + ~TQPushButtonPrivate() + { +#ifndef TQT_NO_ICONSET + delete iconset; +#endif + } +#ifndef TQT_NO_POPUPMENU + TQGuardedPtr popup; +#endif + TQIconSet* iconset; +}; + + +/*! + Constructs a push button with no text. + + The \a parent and \a name arguments are sent on to the TQWidget + constructor. +*/ + +TQPushButton::TQPushButton( TQWidget *parent, const char *name ) + : TQButton( parent, name ) +{ + init(); +} + +/*! + Constructs a push button called \a name with the parent \a parent + and the text \a text. +*/ + +TQPushButton::TQPushButton( const TQString &text, TQWidget *parent, + const char *name ) + : TQButton( parent, name ) +{ + init(); + setText( text ); +} + + +/*! + Constructs a push button with an \a icon and a \a text. + + Note that you can also pass a TQPixmap object as an icon (thanks to + the implicit type conversion provided by C++). + + The \a parent and \a name arguments are sent to the TQWidget + constructor. +*/ +#ifndef TQT_NO_ICONSET +TQPushButton::TQPushButton( const TQIconSet& icon, const TQString &text, + TQWidget *parent, const char *name ) + : TQButton( parent, name ) +{ + init(); + setText( text ); + setIconSet( icon ); +} +#endif + + +/*! + Destroys the push button. +*/ +TQPushButton::~TQPushButton() +{ + delete d; +} + +void TQPushButton::init() +{ + d = 0; + defButton = FALSE; + lastEnabled = FALSE; + hasMenuArrow = FALSE; + flt = FALSE; +#ifndef TQT_NO_DIALOG + autoDefButton = ::tqt_cast(topLevelWidget()) != 0; +#else + autoDefButton = FALSE; +#endif + setBackgroundMode( PaletteButton ); + setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) ); +} + + +/* + Makes the push button a toggle button if \a enable is TRUE or a normal + push button if \a enable is FALSE. + + Toggle buttons have an on/off state similar to \link TQCheckBox check + boxes. \endlink A push button is initially not a toggle button. + + \sa setOn(), toggle(), isToggleButton() toggled() +*/ + +void TQPushButton::setToggleButton( bool enable ) +{ + TQButton::setToggleButton( enable ); +} + + +/* + Switches a toggle button on if \a enable is TRUE or off if \a enable is + FALSE. + \sa isOn(), toggle(), toggled(), isToggleButton() +*/ + +void TQPushButton::setOn( bool enable ) +{ + if ( !isToggleButton() ) + return; + TQButton::setOn( enable ); +} + +void TQPushButton::setAutoDefault( bool enable ) +{ + if ( (bool)autoDefButton == enable ) + return; + autoDefButton = enable; + update(); + updateGeometry(); +} + + +void TQPushButton::setDefault( bool enable ) +{ + if ( (bool)defButton == enable ) + return; // no change + defButton = enable; +#ifndef TQT_NO_DIALOG + if ( defButton && ::tqt_cast(topLevelWidget()) ) + ((TQDialog*)topLevelWidget())->setMainDefault( this ); +#endif + update(); +#if defined(QT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( this, 0, TQAccessible::StateChanged ); +#endif +} + + +/*! + \reimp +*/ +TQSize TQPushButton::sizeHint() const +{ + constPolish(); + + int w = 0, h = 0; + + // calculate contents size... +#ifndef TQT_NO_ICONSET + if ( iconSet() && !iconSet()->isNull() ) { + int iw = iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ).width() + 4; + int ih = iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ).height(); + w += iw; + h = TQMAX( h, ih ); + } +#endif + if ( isMenuButton() ) + w += style().pixelMetric(TQStyle::PM_MenuButtonIndicator, this); + + if ( pixmap() ) { + TQPixmap *pm = (TQPixmap *)pixmap(); + w += pm->width(); + h += pm->height(); + } else { + TQString s( text() ); + bool empty = s.isEmpty(); + if ( empty ) + s = TQString::fromLatin1("XXXX"); + TQFontMetrics fm = fontMetrics(); + TQSize sz = fm.size( ShowPrefix, s ); + if(!empty || !w) + w += sz.width(); + if(!empty || !h) + h = TQMAX(h, sz.height()); + } + + return (style().sizeFromContents(TQStyle::CT_PushButton, this, TQSize(w, h)). + expandedTo(TQApplication::globalStrut())); +} + + +/*! + \reimp +*/ +void TQPushButton::move( int x, int y ) +{ + TQWidget::move( x, y ); +} + +/*! + \reimp +*/ +void TQPushButton::move( const TQPoint &p ) +{ + move( p.x(), p.y() ); +} + +/*! + \reimp +*/ +void TQPushButton::resize( int w, int h ) +{ + TQWidget::resize( w, h ); +} + +/*! + \reimp +*/ +void TQPushButton::resize( const TQSize &s ) +{ + resize( s.width(), s.height() ); +} + +/*! + \reimp +*/ +void TQPushButton::setGeometry( int x, int y, int w, int h ) +{ + TQWidget::setGeometry( x, y, w, h ); +} + +/*! + \reimp +*/ +void TQPushButton::setGeometry( const TQRect &r ) +{ + TQWidget::setGeometry( r ); +} + +/*! + \reimp + */ +void TQPushButton::resizeEvent( TQResizeEvent * ) +{ + if ( autoMask() ) + updateMask(); +} + +/*! + \reimp +*/ +void TQPushButton::drawButton( TQPainter *paint ) +{ + int diw = 0; + if ( isDefault() || autoDefault() ) { + diw = style().pixelMetric(TQStyle::PM_ButtonDefaultIndicator, this); + + if ( diw > 0 ) { + if (backgroundMode() == X11ParentRelative) { + erase( 0, 0, width(), diw ); + erase( 0, 0, diw, height() ); + erase( 0, height() - diw, width(), diw ); + erase( width() - diw, 0, diw, height() ); + } else if ( parentWidget() && parentWidget()->backgroundPixmap() ){ + // pseudo tranparency + paint->drawTiledPixmap( 0, 0, width(), diw, + *parentWidget()->backgroundPixmap(), + x(), y() ); + paint->drawTiledPixmap( 0, 0, diw, height(), + *parentWidget()->backgroundPixmap(), + x(), y() ); + paint->drawTiledPixmap( 0, height()-diw, width(), diw, + *parentWidget()->backgroundPixmap(), + x(), y()+height() ); + paint->drawTiledPixmap( width()-diw, 0, diw, height(), + *parentWidget()->backgroundPixmap(), + x()+width(), y() ); + } else { + paint->fillRect( 0, 0, width(), diw, + colorGroup().brush(TQColorGroup::Background) ); + paint->fillRect( 0, 0, diw, height(), + colorGroup().brush(TQColorGroup::Background) ); + paint->fillRect( 0, height()-diw, width(), diw, + colorGroup().brush(TQColorGroup::Background) ); + paint->fillRect( width()-diw, 0, diw, height(), + colorGroup().brush(TQColorGroup::Background) ); + } + + } + } + + TQStyle::SFlags flags = TQStyle::Style_Default; + if (isEnabled()) + flags |= TQStyle::Style_Enabled; + if (hasFocus()) + flags |= TQStyle::Style_HasFocus; + if (isDown()) + flags |= TQStyle::Style_Down; + if (isOn()) + flags |= TQStyle::Style_On; + if (! isFlat() && ! isDown()) + flags |= TQStyle::Style_Raised; + if (isDefault()) + flags |= TQStyle::Style_ButtonDefault; + if (hasMouse()) + flags |= TQStyle::Style_MouseOver; + + style().drawControl(TQStyle::CE_PushButton, paint, this, rect(), colorGroup(), flags); + drawButtonLabel( paint ); + + lastEnabled = isEnabled(); +} + + +/*! + \reimp +*/ +void TQPushButton::drawButtonLabel( TQPainter *paint ) +{ + + TQStyle::SFlags flags = TQStyle::Style_Default; + if (isEnabled()) + flags |= TQStyle::Style_Enabled; + if (hasFocus()) + flags |= TQStyle::Style_HasFocus; + if (isDown()) + flags |= TQStyle::Style_Down; + if (isOn()) + flags |= TQStyle::Style_On; + if (! isFlat() && ! isDown()) + flags |= TQStyle::Style_Raised; + if (isDefault()) + flags |= TQStyle::Style_ButtonDefault; + + style().drawControl(TQStyle::CE_PushButtonLabel, paint, this, + style().subRect(TQStyle::SR_PushButtonContents, this), + colorGroup(), flags); +} + + +/*! + \reimp + */ +void TQPushButton::updateMask() +{ + TQBitmap bm( size() ); + bm.fill( color0 ); + + { + TQPainter p( &bm, this ); + style().drawControlMask(TQStyle::CE_PushButton, &p, this, rect()); + } + + setMask( bm ); +} + +/*! + \reimp +*/ +void TQPushButton::focusInEvent( TQFocusEvent *e ) +{ + if (autoDefButton && !defButton) { + defButton = TRUE; +#ifndef TQT_NO_DIALOG + if ( defButton && ::tqt_cast(topLevelWidget()) ) + ((TQDialog*)topLevelWidget())->setDefault( this ); +#endif + } + TQButton::focusInEvent( e ); +} + +/*! + \reimp +*/ +void TQPushButton::focusOutEvent( TQFocusEvent *e ) +{ +#ifndef TQT_NO_DIALOG + if ( defButton && autoDefButton ) { + if ( ::tqt_cast(topLevelWidget()) ) + ((TQDialog*)topLevelWidget())->setDefault( 0 ); + } +#endif + + TQButton::focusOutEvent( e ); +#ifndef TQT_NO_POPUPMENU + if ( popup() && popup()->isVisible() ) // restore pressed status + setDown( TRUE ); +#endif +} + + +#ifndef TQT_NO_POPUPMENU +/*! + Associates the popup menu \a popup with this push button. This + turns the button into a menu button. + + Ownership of the popup menu is \e not transferred to the push + button. + + \sa popup() +*/ +void TQPushButton::setPopup( TQPopupMenu* popup ) +{ + if ( !d ) + d = new TQPushButtonPrivate; + if ( popup && !d->popup ) + connect( this, TQ_SIGNAL( pressed() ), this, TQ_SLOT( popupPressed() ) ); + + d->popup = popup; + setIsMenuButton( popup != 0 ); +} +#endif //TQT_NO_POPUPMENU +#ifndef TQT_NO_ICONSET +void TQPushButton::setIconSet( const TQIconSet& icon ) +{ + if ( !d ) + d = new TQPushButtonPrivate; + if ( !icon.isNull() ) { + if ( d->iconset ) + *d->iconset = icon; + else + d->iconset = new TQIconSet( icon ); + } else if ( d->iconset) { + delete d->iconset; + d->iconset = 0; + } + + update(); + updateGeometry(); +} + + +TQIconSet* TQPushButton::iconSet() const +{ + return d ? d->iconset : 0; +} +#endif // TQT_NO_ICONSET +#ifndef TQT_NO_POPUPMENU +/*! + Returns the button's associated popup menu or 0 if no popup menu + has been set. + + \sa setPopup() +*/ +TQPopupMenu* TQPushButton::popup() const +{ + return d ? (TQPopupMenu*)d->popup : 0; +} + +void TQPushButton::popupPressed() +{ + TQPopupMenu* popup = d ? (TQPopupMenu*) d->popup : 0; + TQGuardedPtr that = this; + if ( isDown() && popup ) { + bool horizontal = TRUE; + bool topLeft = TRUE; // ### always TRUE +#ifndef TQT_NO_TOOLBAR + TQToolBar *tb = ::tqt_cast(parentWidget()); + if ( tb && tb->orientation() == Vertical ) + horizontal = FALSE; +#endif + if ( horizontal ) { + if ( topLeft ) { + if ( mapToGlobal( TQPoint( 0, rect().bottom() ) ).y() + popup->sizeHint().height() <= tqApp->desktop()->height() ) + popup->exec( mapToGlobal( rect().bottomLeft() ) ); + else + popup->exec( mapToGlobal( rect().topLeft() - TQPoint( 0, popup->sizeHint().height() ) ) ); + } else { + TQSize sz( popup->sizeHint() ); + TQPoint p = mapToGlobal( rect().topLeft() ); + p.ry() -= sz.height(); + popup->exec( p ); + } + } else { + if ( topLeft ) { + if ( mapToGlobal( TQPoint( rect().right(), 0 ) ).x() + popup->sizeHint().width() <= tqApp->desktop()->width() ) + popup->exec( mapToGlobal( rect().topRight() ) ); + else + popup->exec( mapToGlobal( rect().topLeft() - TQPoint( popup->sizeHint().width(), 0 ) ) ); + } else { + TQSize sz( popup->sizeHint() ); + TQPoint p = mapToGlobal( rect().topLeft() ); + p.rx() -= sz.width(); + popup->exec( p ); + } + } + if (that) + setDown( FALSE ); + } +} +#endif + +void TQPushButton::setFlat( bool f ) +{ + flt = f; + update(); +} + +bool TQPushButton::isFlat() const +{ + return flt; +} + +/*! + \obsolete + \fn virtual void TQPushButton::setIsMenuButton( bool enable ) +*/ + +#endif diff --git a/src/widgets/tqpushbutton.h b/src/widgets/tqpushbutton.h new file mode 100644 index 000000000..13b76e9fe --- /dev/null +++ b/src/widgets/tqpushbutton.h @@ -0,0 +1,149 @@ +/**************************************************************************** +** +** Definition of TQPushButton class +** +** Created : 940221 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQPUSHBUTTON_H +#define TQPUSHBUTTON_H + +#ifndef QT_H +#include "ntqbutton.h" +#include "tqiconset.h" +#endif // QT_H + +#ifndef TQT_NO_PUSHBUTTON +class TQPushButtonPrivate; +class TQPopupMenu; + +class TQ_EXPORT TQPushButton : public TQButton +{ + TQ_OBJECT + + TQ_PROPERTY( bool autoDefault READ autoDefault WRITE setAutoDefault ) + TQ_PROPERTY( bool default READ isDefault WRITE setDefault ) + TQ_PROPERTY( bool menuButton READ isMenuButton DESIGNABLE false ) + TQ_PROPERTY( TQIconSet iconSet READ iconSet WRITE setIconSet ) + TQ_OVERRIDE( bool toggleButton WRITE setToggleButton ) + TQ_OVERRIDE( bool on WRITE setOn ) + TQ_PROPERTY( bool flat READ isFlat WRITE setFlat ) + TQ_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true ) + +public: + TQPushButton( TQWidget *parent, const char* name=0 ); + TQPushButton( const TQString &text, TQWidget *parent, const char* name=0 ); +#ifndef TQT_NO_ICONSET + TQPushButton( const TQIconSet& icon, const TQString &text, TQWidget *parent, const char* name=0 ); +#endif + ~TQPushButton(); + + TQSize sizeHint() const; + + void move( int x, int y ); + void move( const TQPoint &p ); + void resize( int w, int h ); + void resize( const TQSize & ); + void setGeometry( int x, int y, int w, int h ); + + void setGeometry( const TQRect & ); + + void setToggleButton( bool ); + + bool autoDefault() const { return autoDefButton; } + virtual void setAutoDefault( bool autoDef ); + bool isDefault() const { return defButton; } + virtual void setDefault( bool def ); + + virtual void setIsMenuButton( bool enable ) { // obsolete functions + if ( (bool)hasMenuArrow == enable ) + return; + hasMenuArrow = enable ? 1 : 0; + update(); + updateGeometry(); + } + bool isMenuButton() const { return hasMenuArrow; } + +#ifndef TQT_NO_POPUPMENU + void setPopup( TQPopupMenu* popup ); + TQPopupMenu* popup() const; +#endif +#ifndef TQT_NO_ICONSET + void setIconSet( const TQIconSet& ); + TQIconSet* iconSet() const; +#endif + void setFlat( bool ); + bool isFlat() const; + +public slots: + virtual void setOn( bool ); + +protected: + void drawButton( TQPainter * ); + void drawButtonLabel( TQPainter * ); + void focusInEvent( TQFocusEvent * ); + void focusOutEvent( TQFocusEvent * ); + void resizeEvent( TQResizeEvent * ); + void updateMask(); +private slots: +#ifndef TQT_NO_POPUPMENU + void popupPressed(); +#endif +private: + void init(); + + uint autoDefButton : 1; + uint defButton : 1; + uint flt : 1; + uint reserved : 1; // UNUSED + uint lastEnabled : 1; // UNUSED + uint hasMenuArrow : 1; + + TQPushButtonPrivate* d; + + friend class TQDialog; + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQPushButton( const TQPushButton & ); + TQPushButton &operator=( const TQPushButton & ); +#endif +}; + + +#endif // TQT_NO_PUSHBUTTON + +#endif // TQPUSHBUTTON_H diff --git a/src/widgets/tqradiobutton.cpp b/src/widgets/tqradiobutton.cpp new file mode 100644 index 000000000..263c17f20 --- /dev/null +++ b/src/widgets/tqradiobutton.cpp @@ -0,0 +1,358 @@ +/**************************************************************************** +** +** Implementation of TQRadioButton class +** +** Created : 940222 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqradiobutton.h" +#ifndef TQT_NO_RADIOBUTTON +#include "ntqbuttongroup.h" +#include "tqpainter.h" +#include "ntqdrawutil.h" +#include "tqpixmap.h" +#include "tqpixmapcache.h" +#include "tqbitmap.h" +#include "tqtextstream.h" +#include "ntqapplication.h" +#include "tqstyle.h" + +/*! + \class TQRadioButton tqradiobutton.h + \brief The TQRadioButton widget provides a radio button with a text or pixmap label. + + \ingroup basic + \mainclass + + TQRadioButton and TQCheckBox are both option buttons. That is, they + can be switched on (checked) or off (unchecked). The classes + differ in how the choices for the user are restricted. Check boxes + define "many of many" choices, whereas radio buttons provide a + "one of many" choice. In a group of radio buttons only one radio + button at a time can be checked; if the user selects another + button, the previously selected button is switched off. + + The easiest way to implement a "one of many" choice is simply to + put the radio buttons into TQButtonGroup. + + Whenever a button is switched on or off it emits the signal + toggled(). Connect to this signal if you want to trigger an action + each time the button changes state. Otherwise, use isChecked() to + see if a particular button is selected. + + Just like TQPushButton, a radio button can display text or a + pixmap. The text can be set in the constructor or with setText(); + the pixmap is set with setPixmap(). + + + + \important text, setText, text, pixmap, setPixmap, accel, setAccel, isToggleButton, setDown, isDown, isOn, state, autoRepeat, isExclusiveToggle, group, setAutoRepeat, toggle, pressed, released, clicked, toggled, state stateChanged + + \sa TQPushButton TQToolButton + \link guibooks.html#fowler GUI Design Handbook: Radio Button\endlink +*/ + +/*! + \property TQRadioButton::checked \brief Whether the radio button is + checked + + This property will not effect any other radio buttons unless they + have been placed in the same TQButtonGroup. The default value is + FALSE (unchecked). +*/ + +/*! + \property TQRadioButton::autoMask \brief whether the radio button + is automatically masked + + \sa TQWidget::setAutoMask() +*/ + +/*! + Constructs a radio button with no text. + + The \a parent and \a name arguments are sent on to the TQWidget + constructor. +*/ + +TQRadioButton::TQRadioButton( TQWidget *parent, const char *name ) + : TQButton( parent, name, WNoAutoErase | WMouseNoMask ) +{ + init(); +} + +/*! + Constructs a radio button with the text \a text. + + The \a parent and \a name arguments are sent on to the TQWidget + constructor. +*/ + +TQRadioButton::TQRadioButton( const TQString &text, TQWidget *parent, + const char *name ) + : TQButton( parent, name, WNoAutoErase | WMouseNoMask ) +{ + init(); + setText( text ); +} + + +/* + Initializes the radio button. +*/ + +void TQRadioButton::init() +{ + setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) ); + setToggleButton( TRUE ); +#ifndef TQT_NO_BUTTONGROUP + TQButtonGroup *bgrp = ::tqt_cast(parentWidget()); + if ( bgrp ) + bgrp->setRadioButtonExclusive( TRUE ); +#endif +} + +void TQRadioButton::setChecked( bool check ) +{ + setOn( check ); +} + + + + +/*! + \reimp +*/ +TQSize TQRadioButton::sizeHint() const +{ + // Any more complex, and we will use style().itemRect() + // NB: TQCheckBox::sizeHint() is similar + constPolish(); + + TQPainter p(this); + TQSize sz = style().itemRect(&p, TQRect(0, 0, 1, 1), ShowPrefix, FALSE, + pixmap(), text()).size(); + + return (style().sizeFromContents(TQStyle::CT_RadioButton, this, sz). + expandedTo(TQApplication::globalStrut())); +} + + +/*! + \reimp +*/ +bool TQRadioButton::hitButton( const TQPoint &pos ) const +{ + TQRect r = + TQStyle::visualRect( style().subRect( TQStyle::SR_RadioButtonFocusRect, + this ), this ); + if ( tqApp->reverseLayout() ) { + r.setRight( width() ); + } else { + r.setLeft( 0 ); + } + return r.contains( pos ); +} + + +/*! + \reimp +*/ +void TQRadioButton::drawButton( TQPainter *paint ) +{ + TQPainter *p = paint; + TQRect irect = TQStyle::visualRect( style().subRect(TQStyle::SR_RadioButtonIndicator, this), this ); + const TQColorGroup &cg = colorGroup(); + +#if !defined( TQT_NO_TEXTSTREAM ) && !defined( TQ_WS_MACX ) +# define SAVE_RADIOBUTTON_PIXMAPS +#endif +#if defined(SAVE_RADIOBUTTON_PIXMAPS) + TQString pmkey; // pixmap key + int kf = 0; + if ( isDown() ) + kf |= 1; + if ( isOn() ) + kf |= 2; + if ( isEnabled() ) + kf |= 4; + if( isActiveWindow() ) + kf |= 8; + if ( hasMouse() ) + kf |= 16; + if ( hasFocus() ) + kf |= 32; + + TQTextOStream os(&pmkey); + os << "$qt_radio_" << style().className() << "_" + << palette().serialNumber() << "_" << irect.width() << "x" << irect.height() << "_" << kf; + TQPixmap *pm = TQPixmapCache::find( pmkey ); + if ( pm ) { // pixmap exists + drawButtonLabel( p ); + p->drawPixmap( irect.topLeft(), *pm ); + return; + } + bool use_pm = TRUE; + TQPainter pmpaint; + int wx, wy; + if ( use_pm ) { + pm = new TQPixmap( irect.size() ); // create new pixmap + TQ_CHECK_PTR( pm ); + pm->fill(paletteBackgroundColor()); + TQPainter::redirect(this, pm); + pmpaint.begin(this); + p = &pmpaint; // draw in pixmap + wx = irect.x(); // save x,y coords + wy = irect.y(); + irect.moveTopLeft(TQPoint(0, 0)); + p->setBackgroundColor(paletteBackgroundColor()); + } +#endif + + TQStyle::SFlags flags = TQStyle::Style_Default; + if ( isEnabled() ) + flags |= TQStyle::Style_Enabled; + if ( hasFocus() ) + flags |= TQStyle::Style_HasFocus; + if ( isDown() ) + flags |= TQStyle::Style_Down; + if ( hasMouse() ) + flags |= TQStyle::Style_MouseOver; + if ( state() == TQButton::On ) + flags |= TQStyle::Style_On; + else if ( state() == TQButton::Off ) + flags |= TQStyle::Style_Off; + + style().drawControl(TQStyle::CE_RadioButton, p, this, irect, cg, flags); + +#if defined(SAVE_RADIOBUTTON_PIXMAPS) + if ( use_pm ) { + pmpaint.end(); + TQPainter::redirect(this, NULL); + if ( backgroundPixmap() || backgroundMode() == X11ParentRelative ) { + TQBitmap bm( pm->size() ); + bm.fill( color0 ); + pmpaint.begin( &bm ); + style().drawControlMask(TQStyle::CE_RadioButton, &pmpaint, this, irect); + pmpaint.end(); + pm->setMask( bm ); + } + p = paint; // draw in default device + p->drawPixmap( wx, wy, *pm ); + if (!TQPixmapCache::insert(pmkey, pm) ) // save in cache + delete pm; + } +#endif + + drawButtonLabel( p ); +} + + + +/*! + \reimp +*/ +void TQRadioButton::drawButtonLabel( TQPainter *p ) +{ + TQRect r = + TQStyle::visualRect( style().subRect(TQStyle::SR_RadioButtonContents, + this), this ); + + TQStyle::SFlags flags = TQStyle::Style_Default; + if (isEnabled()) + flags |= TQStyle::Style_Enabled; + if (hasFocus()) + flags |= TQStyle::Style_HasFocus; + if (isDown()) + flags |= TQStyle::Style_Down; + if (state() == TQButton::On) + flags |= TQStyle::Style_On; + else if (state() == TQButton::Off) + flags |= TQStyle::Style_Off; + + style().drawControl(TQStyle::CE_RadioButtonLabel, p, this, r, colorGroup(), flags); +} + + +/*! + \reimp +*/ +void TQRadioButton::resizeEvent( TQResizeEvent* e ) +{ + TQButton::resizeEvent(e); + if ( isVisible() ) { + TQPainter p(this); + TQSize isz = style().itemRect(&p, TQRect(0, 0, 1, 1), ShowPrefix, FALSE, + pixmap(), text()).size(); + TQSize wsz = (style().sizeFromContents(TQStyle::CT_RadioButton, this, isz). + expandedTo(TQApplication::globalStrut())); + + update(wsz.width(), isz.width(), 0, wsz.height()); + } + if (autoMask()) + updateMask(); +} + +/*! + \reimp +*/ +void TQRadioButton::updateMask() +{ + TQRect irect = + TQStyle::visualRect( style().subRect( TQStyle::SR_RadioButtonIndicator, + this ), this ); + + TQBitmap bm(width(), height()); + bm.fill(color0); + + TQPainter p( &bm, this ); + style().drawControlMask(TQStyle::CE_RadioButton, &p, this, irect); + if ( ! text().isNull() || ( pixmap() && ! pixmap()->isNull() ) ) { + TQRect crect = + TQStyle::visualRect( style().subRect( TQStyle::SR_RadioButtonContents, + this ), this ); + TQRect frect = + TQStyle::visualRect( style().subRect( TQStyle::SR_RadioButtonFocusRect, + this ), this ); + TQRect label(crect.unite(frect)); + p.fillRect(label, color1); + } + p.end(); + + setMask(bm); +} + +#endif diff --git a/src/widgets/tqradiobutton.h b/src/widgets/tqradiobutton.h new file mode 100644 index 000000000..1c7c0ae34 --- /dev/null +++ b/src/widgets/tqradiobutton.h @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Definition of TQRadioButton class +** +** Created : 940222 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQRADIOBUTTON_H +#define TQRADIOBUTTON_H + +#ifndef QT_H +#include "ntqbutton.h" +#endif // QT_H + +#ifndef TQT_NO_RADIOBUTTON + +class TQ_EXPORT TQRadioButton : public TQButton +{ + TQ_OBJECT + TQ_PROPERTY( bool checked READ isChecked WRITE setChecked ) + TQ_OVERRIDE( bool autoMask DESIGNABLE true SCRIPTABLE true ) + +public: + TQRadioButton( TQWidget *parent, const char* name=0 ); + TQRadioButton( const TQString &text, TQWidget *parent, const char* name=0 ); + + bool isChecked() const; + + TQSize sizeHint() const; + +public slots: + virtual void setChecked( bool check ); + +protected: + bool hitButton( const TQPoint & ) const; + void drawButton( TQPainter * ); + void drawButtonLabel( TQPainter * ); + void updateMask(); + + void resizeEvent( TQResizeEvent* ); + +private: + void init(); + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQRadioButton( const TQRadioButton & ); + TQRadioButton &operator=( const TQRadioButton & ); +#endif +}; + + +inline bool TQRadioButton::isChecked() const +{ return isOn(); } + +#endif // TQT_NO_RADIOBUTTON + +#endif // TQRADIOBUTTON_H diff --git a/src/widgets/tqscrollbar.cpp b/src/widgets/tqscrollbar.cpp new file mode 100644 index 000000000..383ce44bd --- /dev/null +++ b/src/widgets/tqscrollbar.cpp @@ -0,0 +1,1074 @@ +/**************************************************************************** +** +** Implementation of TQScrollBar class +** +** Created : 940427 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqscrollbar.h" +#ifndef TQT_NO_SCROLLBAR +#include "tqpainter.h" +#include "tqbitmap.h" +#include "ntqapplication.h" +#include "tqtimer.h" +#include "tqstyle.h" +#ifndef TQT_NO_CURSOR +#include +#endif +#if defined(QT_ACCESSIBILITY_SUPPORT) +#include "ntqaccessible.h" +#endif +#include + +/*! + \class TQScrollBar + \brief The TQScrollBar widget provides a vertical or horizontal scroll bar. + + \ingroup basic + + A scroll bar allows the user to control a value within a + program-definable range and gives users a visible indication of + the current value of a \link TQRangeControl range control \endlink. + + Scroll bars include four separate controls: + + \list + + \i The \e line-up and \e line-down controls are little buttons + which the user can use to move one "line" up or down. The meaning + of line is configurable. In editors and list boxes it means one + line of text; in an image viewer it might mean 20 pixels. + + \i The \e slider is the handle that indicates the current value of + the scroll bar, which the user can drag to change the value. This + part of the scroll bar is sometimes called the "thumb". + + \i The \e page-up/page-down control is the area on which the + slider slides (the scroll bar's background). Clicking here moves + the scroll bar towards the click. The meaning of "page" is also + configurable: in editors and list boxes it means as many lines as + there is space for in the widget. + + \endlist + + TQScrollBar has very few of its own functions; it mostly relies on + TQRangeControl. The most useful functions are setValue() to set the + scroll bar directly to some value; addPage(), addLine(), + subtractPage(), and subtractLine() to simulate the effects of + clicking (useful for accelerator keys); setSteps() to define the + values of pageStep() and lineStep(); and setRange() to set the + minValue() and maxValue() of the scroll bar. TQScrollBar has a + convenience constructor with which you can set most of these + properties. + + Some GUI styles (for example, the Windows and Motif styles + provided with TQt), also use the pageStep() value to calculate the + size of the slider. + + In addition to the access functions from TQRangeControl, TQScrollBar + provides a comprehensive set of signals: + \table + \header \i Signal \i Emitted when + \row \i \l valueChanged() + \i the scroll bar's value has changed. The tracking() + determines whether this signal is emitted during user + interaction. + \row \i \l sliderPressed() + \i the user starts to drag the slider. + \row \i \l sliderMoved() + \i the user drags the slider. + \row \i \l sliderReleased() + \i the user releases the slider. + \row \i \l nextLine() + \i the scroll bar has moved one line down or right. Line is + defined in TQRangeControl. + \row \i \l prevLine() + \i the scroll bar has moved one line up or left. + \row \i \l nextPage() + \i the scroll bar has moved one page down or right. + \row \i \l prevPage() + \i the scroll bar has moved one page up or left. + \endtable + + TQScrollBar only provides integer ranges. Note that although + TQScrollBar handles very large numbers, scroll bars on current + screens cannot usefully control ranges above about 100,000 pixels. + Beyond that, it becomes difficult for the user to control the + scroll bar using either the keyboard or the mouse. + + A scroll bar can be controlled by the keyboard, but it has a + default focusPolicy() of \c NoFocus. Use setFocusPolicy() to + enable keyboard focus. See keyPressEvent() for a list of key + bindings. + + If you need to add scroll bars to an interface, consider using the + TQScrollView class, which encapsulates the common uses for scroll + bars. + + + + \sa TQSlider TQSpinBox TQScrollView + \link guibooks.html#fowler GUI Design Handbook: Scroll Bar\endlink +*/ + + +/*! + \fn void TQScrollBar::valueChanged( int value ) + + This signal is emitted when the scroll bar value has changed, with + the new scroll bar \a value as an argument. +*/ + +/*! + \fn void TQScrollBar::sliderPressed() + + This signal is emitted when the user presses the slider with the + mouse. +*/ + +/*! + \fn void TQScrollBar::sliderMoved( int value ) + + This signal is emitted when the slider is dragged by the user, with + the new scroll bar \a value as an argument. + + This signal is emitted even when tracking is turned off. + + \sa tracking() valueChanged() nextLine() prevLine() nextPage() + prevPage() +*/ + +/*! + \fn void TQScrollBar::sliderReleased() + + This signal is emitted when the user releases the slider with the + mouse. +*/ + +/*! + \fn void TQScrollBar::nextLine() + + This signal is emitted when the scroll bar scrolls one line down + or right. +*/ + +/*! + \fn void TQScrollBar::prevLine() + + This signal is emitted when the scroll bar scrolls one line up or + left. +*/ + +/*! + \fn void TQScrollBar::nextPage() + + This signal is emitted when the scroll bar scrolls one page down + or right. +*/ + +/*! + \fn void TQScrollBar::prevPage() + + This signal is emitted when the scroll bar scrolls one page up or + left. +*/ + + + +static const int thresholdTime = 500; +static const int repeatTime = 50; + +#define HORIZONTAL (orientation() == Horizontal) +#define VERTICAL !HORIZONTAL +#define MOTIF_BORDER 2 +#define SLIDER_MIN 9 + + +/*! + Constructs a vertical scroll bar. + + The \a parent and \a name arguments are sent on to the TQWidget + constructor. + + The \c minValue defaults to 0, the \c maxValue to 99, with a \c + lineStep size of 1 and a \c pageStep size of 10, and an initial + \c value of 0. +*/ + +TQScrollBar::TQScrollBar( TQWidget *parent, const char *name ) + : TQWidget( parent, name ), orient( Vertical ) +{ + init(); +} + +/*! + Constructs a scroll bar. + + The \a orientation must be \c TQt::Vertical or \c TQt::Horizontal. + + The \a parent and \a name arguments are sent on to the TQWidget + constructor. + + The \c minValue defaults to 0, the \c maxValue to 99, with a \c + lineStep size of 1 and a \c pageStep size of 10, and an initial + \c value of 0. +*/ + +TQScrollBar::TQScrollBar( Orientation orientation, TQWidget *parent, + const char *name ) + : TQWidget( parent, name ), orient( orientation ) +{ + init(); +} + +/*! + Constructs a scroll bar whose value can never be smaller than \a + minValue or greater than \a maxValue, whose line step size is \a + lineStep and page step size is \a pageStep and whose value is + initially \a value (which is guaranteed to be in range using + bound()). + + If \a orientation is \c Vertical the scroll bar is vertical and if + it is \c Horizontal the scroll bar is horizontal. + + The \a parent and \a name arguments are sent on to the TQWidget + constructor. +*/ + +TQScrollBar::TQScrollBar( int minValue, int maxValue, int lineStep, int pageStep, + int value, Orientation orientation, + TQWidget *parent, const char *name ) + : TQWidget( parent, name ), + TQRangeControl( minValue, maxValue, lineStep, pageStep, value ), + orient( orientation ) +{ + init(); +} + +/*! + Destructor. +*/ +TQScrollBar::~TQScrollBar() +{ +} + +void TQScrollBar::init() +{ + track = TRUE; + sliderPos = 0; + pressedControl = TQStyle::SC_None; + clickedAt = FALSE; + setFocusPolicy( NoFocus ); + + repeater = 0; + + setBackgroundMode((TQt::BackgroundMode) + style().styleHint(TQStyle::SH_ScrollBar_BackgroundMode)); + + TQSizePolicy sp( TQSizePolicy::Minimum, TQSizePolicy::Fixed ); + if ( orient == Vertical ) + sp.transpose(); + setSizePolicy( sp ); + clearWState( WState_OwnSizePolicy ); +} + + +/*! + \property TQScrollBar::orientation + \brief the orientation of the scroll bar + + The orientation must be \l TQt::Vertical (the default) or \l + TQt::Horizontal. +*/ + +void TQScrollBar::setOrientation( Orientation orientation ) +{ + if ( orientation == orient ) + return; + if ( !testWState( WState_OwnSizePolicy ) ) { + TQSizePolicy sp = sizePolicy(); + sp.transpose(); + setSizePolicy( sp ); + clearWState( WState_OwnSizePolicy ); + } + + orient = orientation; + + positionSliderFromValue(); + update(); + updateGeometry(); +} + +/*! + \property TQScrollBar::tracking + \brief whether scroll bar tracking is enabled + + If tracking is enabled (the default), the scroll bar emits the + valueChanged() signal while the slider is being dragged. If + tracking is disabled, the scroll bar emits the valueChanged() + signal only when the user releases the mouse button after moving + the slider. +*/ + + +/*! + \property TQScrollBar::draggingSlider + \brief whether the user has clicked the mouse on the slider and is currently dragging it +*/ + +bool TQScrollBar::draggingSlider() const +{ + return pressedControl == TQStyle::SC_ScrollBarSlider; +} + + +/*! + Reimplements the virtual function TQWidget::setPalette(). + + Sets the background color to the mid color for Motif style scroll + bars using palette \a p. +*/ + +void TQScrollBar::setPalette( const TQPalette &p ) +{ + TQWidget::setPalette( p ); + setBackgroundMode((TQt::BackgroundMode) + style().styleHint(TQStyle::SH_ScrollBar_BackgroundMode)); +} + + +/*! \reimp */ +TQSize TQScrollBar::sizeHint() const +{ + constPolish(); + int sbextent = style().pixelMetric(TQStyle::PM_ScrollBarExtent, this); + + if ( orient == Horizontal ) { + return TQSize( 30, sbextent ); + } else { + return TQSize( sbextent, 30 ); + } +} + +/*! \fn void TQScrollBar::setSizePolicy( TQSizePolicy::SizeType, TQSizePolicy::SizeType, bool ) + \reimp +*/ + +/*! \reimp */ +void TQScrollBar::setSizePolicy( TQSizePolicy sp ) +{ + //## remove 4.0 + TQWidget::setSizePolicy( sp ); +} + +/*! + \internal + Implements the virtual TQRangeControl function. +*/ + +void TQScrollBar::valueChange() +{ + int tmp = sliderPos; + positionSliderFromValue(); + if ( tmp != sliderPos && isVisible() ) + drawControls(TQStyle::SC_ScrollBarAddPage | + TQStyle::SC_ScrollBarSubPage | + TQStyle::SC_ScrollBarSlider, + pressedControl ); + emit valueChanged(value()); +#if defined(QT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); +#endif +} + +/*! + \internal + Implements the virtual TQRangeControl function. +*/ + +void TQScrollBar::stepChange() +{ + rangeChange(); +} + +/*! + \internal + Implements the virtual TQRangeControl function. +*/ + +void TQScrollBar::rangeChange() +{ + positionSliderFromValue(); + + if ( isVisible() ) + drawControls(TQStyle::SC_ScrollBarAddLine | + TQStyle::SC_ScrollBarSubLine | + TQStyle::SC_ScrollBarAddPage | + TQStyle::SC_ScrollBarSubPage | + TQStyle::SC_ScrollBarFirst | + TQStyle::SC_ScrollBarLast | + TQStyle::SC_ScrollBarSlider, + pressedControl ); +} + + +/*! + Handles timer events for the scroll bar. +*/ + +void TQScrollBar::doAutoRepeat() +{ + bool sendRepeat = clickedAt; +#if !defined( TQT_NO_CURSOR ) && !defined( TQT_NO_STYLE ) + if(sendRepeat && (pressedControl == TQStyle::SC_ScrollBarAddPage || + pressedControl == TQStyle::SC_ScrollBarSubPage) && + style().styleHint(TQStyle::SH_ScrollBar_StopMouseOverSlider, this) && + style().querySubControl(TQStyle::CC_ScrollBar, this, + mapFromGlobal(TQCursor::pos()) ) == TQStyle::SC_ScrollBarSlider) + sendRepeat = FALSE; +#endif + if ( sendRepeat ){ + if ( repeater ) + repeater->changeInterval( repeatTime ); + action( (TQStyle::SubControl) pressedControl ); + TQApplication::syncX(); + } else { + stopAutoRepeat(); + } +} + + +/*! + Starts the auto-repeat logic. Some time after this function is + called, the auto-repeat starts taking effect and from then on + repeats until stopAutoRepeat() is called. +*/ + +void TQScrollBar::startAutoRepeat() +{ + if ( !repeater ) { + repeater = new TQTimer( this, "auto-repeat timer" ); + connect( repeater, TQ_SIGNAL(timeout()), + this, TQ_SLOT(doAutoRepeat()) ); + } + repeater->start( thresholdTime, FALSE ); +} + + +/*! + Stops the auto-repeat logic. +*/ + +void TQScrollBar::stopAutoRepeat() +{ + delete repeater; + repeater = 0; +} + + +/*! + \reimp +*/ +#ifndef TQT_NO_WHEELEVENT +void TQScrollBar::wheelEvent( TQWheelEvent *e ) +{ + static float offset = 0; + static TQScrollBar* offset_owner = 0; + if (offset_owner != this){ + offset_owner = this; + offset = 0; + } + if ( e->orientation() != orient && !rect().contains(e->pos()) ) + return; + e->accept(); + int step = TQMIN( TQApplication::wheelScrollLines()*lineStep(), + pageStep() ); + if ( ( e->state() & ControlButton ) || ( e->state() & ShiftButton ) ) + step = pageStep(); + offset += -e->delta()*step/120; + if (TQABS(offset)<1) + return; + setValue( value() + int(offset) ); + offset -= int(offset); +} +#endif + +/*! + \reimp +*/ +void TQScrollBar::keyPressEvent( TQKeyEvent *e ) +{ + // \list + // \i Left/Right move a horizontal scrollbar by one line. + // \i Up/Down move a vertical scrollbar by one line. + // \i PageUp moves up one page. + // \i PageDown moves down one page. + // \i Home moves to the start (minValue()). + // \i End moves to the end (maxValue()). + // \endlist + + // Note that unless you call setFocusPolicy(), the default NoFocus + // will apply and the user will not be able to use the keyboard to + // interact with the scrollbar. + switch ( e->key() ) { + case Key_Left: + if ( orient == Horizontal ) + subtractLine(); + break; + case Key_Right: + if ( orient == Horizontal ) + addLine(); + break; + case Key_Up: + if ( orient == Vertical ) + subtractLine(); + break; + case Key_Down: + if ( orient == Vertical ) + addLine(); + break; + case Key_PageUp: + subtractPage(); + break; + case Key_PageDown: + addPage(); + break; + case Key_Home: + setValue( minValue() ); + break; + case Key_End: + setValue( maxValue() ); + break; + default: + e->ignore(); + break; + } +} + + +/*! + \reimp +*/ +void TQScrollBar::resizeEvent( TQResizeEvent * ) +{ + positionSliderFromValue(); +} + + +/*! + \reimp +*/ +void TQScrollBar::paintEvent( TQPaintEvent * ) +{ + TQPainter p( this ); + drawControls(TQStyle::SC_ScrollBarAddLine | + TQStyle::SC_ScrollBarSubLine | + TQStyle::SC_ScrollBarAddPage | + TQStyle::SC_ScrollBarSubPage | + TQStyle::SC_ScrollBarFirst | + TQStyle::SC_ScrollBarLast | + TQStyle::SC_ScrollBarSlider, + pressedControl, &p ); +} + +static TQCOORD sliderStartPos = 0; + +/*! + \reimp + */ +void TQScrollBar::contextMenuEvent( TQContextMenuEvent *e ) +{ + if(clickedAt) + e->consume(); + else + e->ignore(); +} + +/*! + \reimp +*/ +void TQScrollBar::mousePressEvent( TQMouseEvent *e ) +{ + bool midButtonAbsPos = + style().styleHint(TQStyle::SH_ScrollBar_MiddleClickAbsolutePosition, + this); + + if ( !(e->button() == LeftButton || + (midButtonAbsPos && e->button() == MidButton) ) ) + return; + + if ( maxValue() == minValue() ) // nothing to be done + return; + + if ( e->state() & MouseButtonMask ) // another button was already pressed + return; + + clickedAt = TRUE; + pressedControl = style().querySubControl(TQStyle::CC_ScrollBar, this, e->pos() ); + + if ( (pressedControl == TQStyle::SC_ScrollBarAddPage || + pressedControl == TQStyle::SC_ScrollBarSubPage || + pressedControl == TQStyle::SC_ScrollBarSlider ) && + ((midButtonAbsPos && e->button() == MidButton) || + (style().styleHint(TQStyle::SH_ScrollBar_LeftClickAbsolutePosition) && e->button() == LeftButton)) ) { + + TQRect sr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, + TQStyle::SC_ScrollBarSlider ), + gr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, + TQStyle::SC_ScrollBarGroove ); + int sliderMin, sliderMax, sliderLength; + sliderMin = sliderMax = sliderLength = 0; + if (HORIZONTAL) { + sliderMin = gr.x(); + sliderMax = sliderMin + gr.width(); + sliderLength = sr.width(); + } else { + sliderMin = gr.y(); + sliderMax = sliderMin + gr.height(); + sliderLength = sr.height(); + } + + int newSliderPos = (HORIZONTAL ? e->pos().x() : e->pos().y()) + - sliderLength/2; + newSliderPos = TQMIN( newSliderPos, sliderMax - sliderLength ); + newSliderPos = TQMAX( newSliderPos, sliderMin ); + setValue( sliderPosToRangeValue(newSliderPos) ); + sliderPos = newSliderPos; + pressedControl = TQStyle::SC_ScrollBarSlider; + } + + if ( pressedControl == TQStyle::SC_ScrollBarSlider ) { + clickOffset = (TQCOORD)( (HORIZONTAL ? e->pos().x() : e->pos().y()) + - sliderPos ); + slidePrevVal = value(); + sliderStartPos = sliderPos; + drawControls( pressedControl, pressedControl ); + emit sliderPressed(); +#if defined(QT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( this, 0, TQAccessible::ScrollingStart ); +#endif + } else if ( pressedControl != TQStyle::SC_None ) { + drawControls( pressedControl, pressedControl ); + action( (TQStyle::SubControl) pressedControl ); + startAutoRepeat(); + } +} + + +/*! + \reimp +*/ +void TQScrollBar::mouseReleaseEvent( TQMouseEvent *e ) +{ + if ( !clickedAt ) + return; + + if ( e->stateAfter() & MouseButtonMask ) // some other button is still pressed + return; + + TQStyle::SubControl tmp = (TQStyle::SubControl) pressedControl; + clickedAt = FALSE; + stopAutoRepeat(); + mouseMoveEvent( e ); // Might have moved since last mouse move event. + pressedControl = TQStyle::SC_None; + + if (tmp == TQStyle::SC_ScrollBarSlider) { + directSetValue( calculateValueFromSlider() ); + emit sliderReleased(); + if ( value() != prevValue() ) { + emit valueChanged( value() ); +#if defined(QT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); +#endif + } +#if defined(QT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( this, 0, TQAccessible::ScrollingEnd ); +#endif + } + drawControls( tmp, pressedControl ); + if ( e->button() == MidButton ) + repaint( FALSE ); +} + + +/*! + \reimp +*/ +void TQScrollBar::mouseMoveEvent( TQMouseEvent *e ) +{ + if ( !isVisible() ) { + clickedAt = FALSE; + return; + } + + bool mcab = style().styleHint(TQStyle::SH_ScrollBar_MiddleClickAbsolutePosition, + this); + if ( ! clickedAt || ! (e->state() & LeftButton || + ((e->state() & MidButton) && mcab))) + return; + + int newSliderPos; + if ( pressedControl == TQStyle::SC_ScrollBarSlider ) { + TQRect gr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, + TQStyle::SC_ScrollBarGroove ), + sr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, + TQStyle::SC_ScrollBarSlider ); + int sliderMin, sliderMax, sliderLength; + + if (HORIZONTAL) { + sliderLength = sr.width(); + sliderMin = gr.x(); + sliderMax = gr.right() - sliderLength + 1; + } else { + sliderLength = sr.height(); + sliderMin = gr.y(); + sliderMax = gr.bottom() - sliderLength + 1; + } + + TQRect r = rect(); + int m = style().pixelMetric(TQStyle::PM_MaximumDragDistance, this); + if ( m >= 0 ) { + if ( orientation() == Horizontal ) + r.setRect( r.x() - m, r.y() - 2*m, r.width() + 2*m, r.height() + 4*m ); + else + r.setRect( r.x() - 2*m, r.y() - m, r.width() + 4*m, r.height() + 2*m ); + if (! r.contains( e->pos())) + newSliderPos = sliderStartPos; + else + newSliderPos = (HORIZONTAL ? e->pos().x() : + e->pos().y()) -clickOffset; + } else + newSliderPos = (HORIZONTAL ? e->pos().x() : + e->pos().y()) -clickOffset; + + if ( newSliderPos < sliderMin ) + newSliderPos = sliderMin; + else if ( newSliderPos > sliderMax ) + newSliderPos = sliderMax; + int newVal = sliderPosToRangeValue(newSliderPos); + if ( newVal != slidePrevVal ) + emit sliderMoved( newVal ); + if ( track && newVal != value() ) { + directSetValue( newVal ); // Set directly, painting done below + emit valueChanged( value() ); +#if defined(QT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); +#endif + } + slidePrevVal = newVal; + sliderPos = (TQCOORD)newSliderPos; + drawControls( TQStyle::SC_ScrollBarAddPage | + TQStyle::SC_ScrollBarSlider | + TQStyle::SC_ScrollBarSubPage, + pressedControl ); + } else if (! style().styleHint(TQStyle::SH_ScrollBar_ScrollWhenPointerLeavesControl)) { + // stop scrolling when the mouse pointer leaves a control + // similar to push buttons + if ( pressedControl != (uint)style().querySubControl(TQStyle::CC_ScrollBar, this, e->pos() ) ) { + drawControls( pressedControl, TQStyle::SC_None ); + stopAutoRepeat(); + } else if ( !repeater ) { + drawControls( pressedControl, pressedControl ); + action( (TQStyle::SubControl) pressedControl ); + startAutoRepeat(); + } + } +} + + +/*! + \fn int TQScrollBar::sliderStart() const + + Returns the pixel position where the scroll bar slider starts. + + This is equivalent to sliderRect().y() for vertical scroll bars or + sliderRect().x() for horizontal scroll bars. +*/ + +/*! + Returns the scroll bar slider rectangle. + + \sa sliderStart() +*/ + +TQRect TQScrollBar::sliderRect() const +{ + return style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, + TQStyle::SC_ScrollBarSlider ); +} + +void TQScrollBar::positionSliderFromValue() +{ + sliderPos = (TQCOORD)rangeValueToSliderPos( value() ); +} + +int TQScrollBar::calculateValueFromSlider() const +{ + return sliderPosToRangeValue( sliderPos ); +} + +int TQScrollBar::rangeValueToSliderPos( int v ) const +{ + TQRect gr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, + TQStyle::SC_ScrollBarGroove ); + TQRect sr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, + TQStyle::SC_ScrollBarSlider ); + int sliderMin, sliderMax, sliderLength; + + if (HORIZONTAL) { + sliderLength = sr.width(); + sliderMin = gr.x(); + sliderMax = gr.right() - sliderLength + 1; + } else { + sliderLength = sr.height(); + sliderMin = gr.y(); + sliderMax = gr.bottom() - sliderLength + 1; + } + + return positionFromValue( v, sliderMax-sliderMin ) + sliderMin; +} + +int TQScrollBar::sliderPosToRangeValue( int pos ) const +{ + TQRect gr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, + TQStyle::SC_ScrollBarGroove ); + TQRect sr = style().querySubControlMetrics(TQStyle::CC_ScrollBar, this, + TQStyle::SC_ScrollBarSlider ); + int sliderMin, sliderMax, sliderLength; + + if (HORIZONTAL) { + sliderLength = sr.width(); + sliderMin = gr.x(); + sliderMax = gr.right() - sliderLength + 1; + } else { + sliderLength = sr.height(); + sliderMin = gr.y(); + sliderMax = gr.bottom() - sliderLength + 1; + } + + return valueFromPosition( pos - sliderMin, sliderMax - sliderMin ); +} + + +void TQScrollBar::action( int control ) +{ + switch( control ) { + case TQStyle::SC_ScrollBarAddLine: + addLine(); + emit nextLine(); + break; + case TQStyle::SC_ScrollBarSubLine: + subtractLine(); + emit prevLine(); + break; + case TQStyle::SC_ScrollBarAddPage: + addPage(); + emit nextPage(); + break; + case TQStyle::SC_ScrollBarSubPage: + subtractPage(); + emit prevPage(); + break; + case TQStyle::SC_ScrollBarFirst: + setValue( minValue() ); +#if defined(QT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); +#endif + emit valueChanged( minValue() ); + break; + case TQStyle::SC_ScrollBarLast: + setValue( maxValue() ); +#if defined(QT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); +#endif + emit valueChanged( maxValue() ); + break; + default: + break; + } +} + + +void TQScrollBar::drawControls( uint controls, uint activeControl ) const +{ + TQPainter p ( this ); + drawControls( controls, activeControl, &p ); +} + + +void TQScrollBar::drawControls( uint controls, uint activeControl, + TQPainter *p ) const +{ + if ( !isUpdatesEnabled() ) + return; + + TQStyle::SFlags flags = TQStyle::Style_Default; + if (isEnabled()) + flags |= TQStyle::Style_Enabled; + if (hasFocus()) + flags |= TQStyle::Style_HasFocus; + if (hasMouse()) + flags |= TQStyle::Style_MouseOver; + if ( orientation() == Horizontal ) + flags |= TQStyle::Style_Horizontal; + + style().drawComplexControl(TQStyle::CC_ScrollBar, p, this, rect(), colorGroup(), + flags, (TQStyle::SubControl) controls, + (TQStyle::SubControl) activeControl ); +} + +/*! + \reimp +*/ +void TQScrollBar::styleChange( TQStyle& old ) +{ + positionSliderFromValue(); + setBackgroundMode((TQt::BackgroundMode) + style().styleHint(TQStyle::SH_ScrollBar_BackgroundMode)); + TQWidget::styleChange( old ); +} + +/*! + \property TQScrollBar::minValue + \brief the scroll bar's minimum value + + When setting this property, the \l TQScrollBar::maxValue is + adjusted if necessary to ensure that the range remains valid. + + \sa setRange() +*/ +int TQScrollBar::minValue() const +{ + return TQRangeControl::minValue(); +} + +void TQScrollBar::setMinValue( int minVal ) +{ + TQRangeControl::setMinValue( minVal ); +} + +/*! + \property TQScrollBar::maxValue + \brief the scroll bar's maximum value + + When setting this property, the \l TQScrollBar::minValue is + adjusted if necessary to ensure that the range remains valid. + + \sa setRange() +*/ +int TQScrollBar::maxValue() const +{ + return TQRangeControl::maxValue(); +} + +void TQScrollBar::setMaxValue( int maxVal ) +{ + TQRangeControl::setMaxValue( maxVal ); +} + +/*! + \property TQScrollBar::lineStep + \brief the line step + + When setting lineStep, the virtual stepChange() function will be + called if the new line step is different from the previous + setting. + + \sa setSteps() TQRangeControl::pageStep() setRange() +*/ + +int TQScrollBar::lineStep() const +{ + return TQRangeControl::lineStep(); +} + +/*! + \property TQScrollBar::pageStep + \brief the page step + + When setting pageStep, the virtual stepChange() function will be + called if the new page step is different from the previous + setting. + + \sa TQRangeControl::setSteps() setLineStep() setRange() +*/ + +int TQScrollBar::pageStep() const +{ + return TQRangeControl::pageStep(); +} + +void TQScrollBar::setLineStep( int i ) +{ + setSteps( i, pageStep() ); +} + +void TQScrollBar::setPageStep( int i ) +{ + setSteps( lineStep(), i ); +} + +/*! + \property TQScrollBar::value + \brief the scroll bar's value + + \sa TQRangeControl::value() prevValue() +*/ + +int TQScrollBar::value() const +{ + return TQRangeControl::value(); +} + +void TQScrollBar::setValue( int i ) +{ + TQRangeControl::setValue( i ); +} + + +/*! + This function is called when the scrollbar is hidden. +*/ +void TQScrollBar::hideEvent( TQHideEvent* ) +{ + pressedControl = TQStyle::SC_None; + clickedAt = FALSE; +} + + +#undef ADD_LINE_ACTIVE +#undef SUB_LINE_ACTIVE +#endif diff --git a/src/widgets/tqscrollbar.h b/src/widgets/tqscrollbar.h new file mode 100644 index 000000000..6a298c96f --- /dev/null +++ b/src/widgets/tqscrollbar.h @@ -0,0 +1,197 @@ +/**************************************************************************** +** +** Definition of TQScrollBar class +** +** Created : 940427 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQSCROLLBAR_H +#define TQSCROLLBAR_H + +class TQTimer; + +#ifndef QT_H +#include "tqwidget.h" +#include "ntqrangecontrol.h" +#endif // QT_H + +#ifndef TQT_NO_SCROLLBAR + +class TQ_EXPORT TQScrollBar : public TQWidget, public TQRangeControl +{ + TQ_OBJECT + TQ_PROPERTY( int minValue READ minValue WRITE setMinValue ) + TQ_PROPERTY( int maxValue READ maxValue WRITE setMaxValue ) + TQ_PROPERTY( int lineStep READ lineStep WRITE setLineStep ) + TQ_PROPERTY( int pageStep READ pageStep WRITE setPageStep ) + TQ_PROPERTY( int value READ value WRITE setValue ) + TQ_PROPERTY( bool tracking READ tracking WRITE setTracking ) + TQ_PROPERTY( bool draggingSlider READ draggingSlider ) + TQ_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) + +public: + TQScrollBar( TQWidget *parent, const char* name = 0 ); + TQScrollBar( Orientation, TQWidget *parent, const char* name = 0 ); + TQScrollBar( int minValue, int maxValue, int lineStep, int pageStep, + int value, Orientation, TQWidget *parent, const char* name = 0 ); + ~TQScrollBar(); + + virtual void setOrientation( Orientation ); + Orientation orientation() const; + virtual void setTracking( bool enable ); + bool tracking() const; + bool draggingSlider() const; + + virtual void setPalette( const TQPalette & ); + virtual TQSize sizeHint() const; + virtual void setSizePolicy( TQSizePolicy sp ); + void setSizePolicy( TQSizePolicy::SizeType hor, TQSizePolicy::SizeType ver, bool hfw = FALSE ); + + int minValue() const; + int maxValue() const; + void setMinValue( int ); + void setMaxValue( int ); + int lineStep() const; + int pageStep() const; + void setLineStep( int ); + void setPageStep( int ); + int value() const; + + int sliderStart() const; + TQRect sliderRect() const; + +public slots: + void setValue( int ); + +signals: + void valueChanged( int value ); + void sliderPressed(); + void sliderMoved( int value ); + void sliderReleased(); + void nextLine(); + void prevLine(); + void nextPage(); + void prevPage(); + +protected: +#ifndef TQT_NO_WHEELEVENT + void wheelEvent( TQWheelEvent * ); +#endif + void keyPressEvent( TQKeyEvent * ); + void resizeEvent( TQResizeEvent * ); + void paintEvent( TQPaintEvent * ); + + void mousePressEvent( TQMouseEvent * ); + void mouseReleaseEvent( TQMouseEvent * ); + void mouseMoveEvent( TQMouseEvent * ); + void contextMenuEvent( TQContextMenuEvent * ); + void hideEvent( TQHideEvent* ); + + void valueChange(); + void stepChange(); + void rangeChange(); + + void styleChange( TQStyle& ); + +private slots: + void doAutoRepeat(); + +private: + void init(); + void positionSliderFromValue(); + int calculateValueFromSlider() const; + + void startAutoRepeat(); + void stopAutoRepeat(); + + int rangeValueToSliderPos( int val ) const; + int sliderPosToRangeValue( int val ) const; + + void action( int control ); + + void drawControls( uint controls, uint activeControl ) const; + void drawControls( uint controls, uint activeControl, + TQPainter *p ) const; + + uint pressedControl; + bool track; + bool clickedAt; + Orientation orient; + + int slidePrevVal; + TQCOORD sliderPos; + TQCOORD clickOffset; + + TQTimer * repeater; + void * d; + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQScrollBar( const TQScrollBar & ); + TQScrollBar &operator=( const TQScrollBar & ); +#endif +}; + + +inline void TQScrollBar::setTracking( bool t ) +{ + track = t; +} + +inline bool TQScrollBar::tracking() const +{ + return track; +} + +inline TQScrollBar::Orientation TQScrollBar::orientation() const +{ + return orient; +} + +inline int TQScrollBar::sliderStart() const +{ + return sliderPos; +} + +inline void TQScrollBar::setSizePolicy( TQSizePolicy::SizeType hor, TQSizePolicy::SizeType ver, bool hfw ) +{ + TQWidget::setSizePolicy( hor, ver, hfw ); +} + + +#endif // TQT_NO_SCROLLBAR + +#endif // TQSCROLLBAR_H diff --git a/src/widgets/tqscrollview.cpp b/src/widgets/tqscrollview.cpp new file mode 100644 index 000000000..603110592 --- /dev/null +++ b/src/widgets/tqscrollview.cpp @@ -0,0 +1,2847 @@ +/**************************************************************************** +** +** Implementation of TQScrollView class +** +** Created : 950524 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqwidget.h" +#ifndef TQT_NO_SCROLLVIEW +#include "tqscrollbar.h" +#include "tqobjectlist.h" +#include "tqpainter.h" +#include "tqpixmap.h" +#include "ntqcursor.h" +#include "ntqfocusdata.h" +#include "tqscrollview.h" +#include "tqptrdict.h" +#include "ntqapplication.h" +#include "tqtimer.h" +#include "tqstyle.h" +#include "ntqlistview.h" +#ifdef TQ_WS_MAC +# include "qt_mac.h" +#endif + +static const int coord_limit = 4000; +static const int autoscroll_margin = 16; +static const int initialScrollTime = 30; +static const int initialScrollAccel = 5; + +struct TQSVChildRec { + TQSVChildRec(TQWidget* c, int xx, int yy) : + child(c), + x(xx), y(yy) + { + } + + void hideOrShow(TQScrollView* sv, TQWidget* clipped_viewport); + void moveTo(TQScrollView* sv, int xx, int yy, TQWidget* clipped_viewport) + { + if ( x != xx || y != yy ) { + x = xx; + y = yy; + hideOrShow(sv,clipped_viewport); + } + } + TQWidget* child; + int x, y; +}; + +void TQSVChildRec::hideOrShow(TQScrollView* sv, TQWidget* clipped_viewport) +{ + if ( clipped_viewport ) { + if ( x+child->width() < sv->contentsX()+clipped_viewport->x() + || x > sv->contentsX()+clipped_viewport->width() + || y+child->height() < sv->contentsY()+clipped_viewport->y() + || y > sv->contentsY()+clipped_viewport->height() ) { + child->move(clipped_viewport->width(), + clipped_viewport->height()); + } else { + child->move(x-sv->contentsX()-clipped_viewport->x(), + y-sv->contentsY()-clipped_viewport->y()); + } + } else { + child->move(x-sv->contentsX(), y-sv->contentsY()); + } +} + +class TQViewportWidget : public TQWidget +{ + TQ_OBJECT + +public: + TQViewportWidget( TQScrollView* parent=0, const char* name=0, WFlags f = 0 ) + : TQWidget( parent, name, f ) {} +}; + +class TQClipperWidget : public TQWidget +{ + TQ_OBJECT + +public: + TQClipperWidget( TQWidget * parent=0, const char * name=0, WFlags f=0 ) + : TQWidget ( parent,name,f) {} +}; + +#include "tqscrollview.moc" + +class TQScrollViewData { +public: + TQScrollViewData(TQScrollView* parent, int vpwflags) : + hbar( new TQScrollBar( TQScrollBar::Horizontal, parent, "qt_hbar" ) ), + vbar( new TQScrollBar( TQScrollBar::Vertical, parent, "qt_vbar" ) ), + viewport( new TQViewportWidget( parent, "qt_viewport", vpwflags ) ), + clipped_viewport( 0 ), + flags( vpwflags ), + vx( 0 ), vy( 0 ), vwidth( 1 ), vheight( 1 ), +#ifndef TQT_NO_DRAGANDDROP + autoscroll_timer( parent, "scrollview autoscroll timer" ), + drag_autoscroll( TRUE ), +#endif + scrollbar_timer( parent, "scrollview scrollbar timer" ), + inresize( FALSE ), use_cached_size_hint( TRUE ) + { + l_marg = r_marg = t_marg = b_marg = 0; + viewport->polish(); + viewport->setBackgroundMode( TQWidget::PaletteDark ); + viewport->setBackgroundOrigin( TQWidget::WidgetOrigin ); + vMode = TQScrollView::Auto; + hMode = TQScrollView::Auto; + corner = 0; + defaultCorner = new TQWidget( parent, "qt_default_corner" ); + defaultCorner->hide(); + vbar->setSteps( 20, 1/*set later*/ ); + hbar->setSteps( 20, 1/*set later*/ ); + policy = TQScrollView::Default; + signal_choke = FALSE; + static_bg = FALSE; + fake_scroll = FALSE; + hbarPressed = FALSE; + vbarPressed = FALSE; + } + ~TQScrollViewData(); + + TQSVChildRec* rec(TQWidget* w) { return childDict.find(w); } + TQSVChildRec* ancestorRec(TQWidget* w); + TQSVChildRec* addChildRec(TQWidget* w, int x, int y ) + { + TQSVChildRec *r = new TQSVChildRec(w,x,y); + children.append(r); + childDict.insert(w, r); + return r; + } + void deleteChildRec(TQSVChildRec* r) + { + childDict.remove(r->child); + children.removeRef(r); + delete r; + } + + void hideOrShowAll(TQScrollView* sv, bool isScroll = FALSE ); + void moveAllBy(int dx, int dy); + bool anyVisibleChildren(); + void autoMove(TQScrollView* sv); + void autoResize(TQScrollView* sv); + void autoResizeHint(TQScrollView* sv); + void viewportResized( int w, int h ); + + TQScrollBar* hbar; + TQScrollBar* vbar; + bool hbarPressed; + bool vbarPressed; + TQViewportWidget* viewport; + TQClipperWidget* clipped_viewport; + int flags; + TQPtrList children; + TQPtrDict childDict; + TQWidget* corner, *defaultCorner; + int vx, vy, vwidth, vheight; // for drawContents-style usage + int l_marg, r_marg, t_marg, b_marg; + TQScrollView::ResizePolicy policy; + TQScrollView::ScrollBarMode vMode; + TQScrollView::ScrollBarMode hMode; +#ifndef TQT_NO_DRAGANDDROP + TQPoint cpDragStart; + TQTimer autoscroll_timer; + int autoscroll_time; + int autoscroll_accel; + bool drag_autoscroll; +#endif + TQTimer scrollbar_timer; + + uint static_bg : 1; + uint fake_scroll : 1; + + // This variable allows ensureVisible to move the contents then + // update both the sliders. Otherwise, updating the sliders would + // cause two image scrolls, creating ugly flashing. + // + uint signal_choke : 1; + + // This variables indicates in updateScrollBars() that we are + // in a resizeEvent() and thus don't want to flash scrollbars + uint inresize : 1; + uint use_cached_size_hint : 1; + TQSize cachedSizeHint; + + inline int contentsX() const { return -vx; } + inline int contentsY() const { return -vy; } + inline int contentsWidth() const { return vwidth; } +}; + +inline TQScrollViewData::~TQScrollViewData() +{ + children.setAutoDelete( TRUE ); +} + +TQSVChildRec* TQScrollViewData::ancestorRec(TQWidget* w) +{ + if ( clipped_viewport ) { + while (w->parentWidget() != clipped_viewport) { + w = w->parentWidget(); + if (!w) return 0; + } + } else { + while (w->parentWidget() != viewport) { + w = w->parentWidget(); + if (!w) return 0; + } + } + return rec(w); +} + +void TQScrollViewData::hideOrShowAll(TQScrollView* sv, bool isScroll ) +{ + if ( !clipped_viewport ) + return; + if ( clipped_viewport->x() <= 0 + && clipped_viewport->y() <= 0 + && clipped_viewport->width()+clipped_viewport->x() >= + viewport->width() + && clipped_viewport->height()+clipped_viewport->y() >= + viewport->height() ) { + // clipped_viewport still covers viewport + if( static_bg ) + clipped_viewport->repaint( TRUE ); + else if ( ( !isScroll && !clipped_viewport->testWFlags( TQt::WStaticContents) ) + || static_bg ) + TQApplication::postEvent( clipped_viewport, + new TQPaintEvent( clipped_viewport->clipRegion(), + !clipped_viewport->testWFlags(TQt::WResizeNoErase) ) ); + } else { + // Re-center + int nx = ( viewport->width() - clipped_viewport->width() ) / 2; + int ny = ( viewport->height() - clipped_viewport->height() ) / 2; + clipped_viewport->move(nx,ny); + clipped_viewport->update(); + } + for (TQSVChildRec *r = children.first(); r; r=children.next()) { + r->hideOrShow(sv, clipped_viewport); + } +} + +void TQScrollViewData::moveAllBy(int dx, int dy) +{ + if ( clipped_viewport && !static_bg ) { + clipped_viewport->move( clipped_viewport->x()+dx, + clipped_viewport->y()+dy ); + } else { + for (TQSVChildRec *r = children.first(); r; r=children.next()) { + r->child->move(r->child->x()+dx,r->child->y()+dy); + } + if ( static_bg ) + viewport->repaint( TRUE ); + } +} + +bool TQScrollViewData::anyVisibleChildren() +{ + for (TQSVChildRec *r = children.first(); r; r=children.next()) { + if (r->child->isVisible()) return TRUE; + } + return FALSE; +} + +void TQScrollViewData::autoMove(TQScrollView* sv) +{ + if ( policy == TQScrollView::AutoOne ) { + TQSVChildRec* r = children.first(); + if (r) + sv->setContentsPos(-r->child->x(),-r->child->y()); + } +} + +void TQScrollViewData::autoResize(TQScrollView* sv) +{ + if ( policy == TQScrollView::AutoOne ) { + TQSVChildRec* r = children.first(); + if (r) + sv->resizeContents(r->child->width(),r->child->height()); + } +} + +void TQScrollViewData::autoResizeHint(TQScrollView* sv) +{ + if ( policy == TQScrollView::AutoOne ) { + TQSVChildRec* r = children.first(); + if (r) { + TQSize s = r->child->sizeHint(); + if ( s.isValid() ) + r->child->resize(s); + } + } else if ( policy == TQScrollView::AutoOneFit ) { + TQSVChildRec* r = children.first(); + if (r) { + TQSize sh = r->child->sizeHint(); + sh = sh.boundedTo( r->child->maximumSize() ); + sv->resizeContents( sh.width(), sh.height() ); + } + } +} + +void TQScrollViewData::viewportResized( int w, int h ) +{ + if ( policy == TQScrollView::AutoOneFit ) { + TQSVChildRec* r = children.first(); + if (r) { + TQSize sh = r->child->sizeHint(); + sh = sh.boundedTo( r->child->maximumSize() ); + r->child->resize( TQMAX(w,sh.width()), TQMAX(h,sh.height()) ); + } + + } +} + + +/*! + \class TQScrollView tqscrollview.h + \brief The TQScrollView widget provides a scrolling area with on-demand scroll bars. + + \ingroup abstractwidgets + \mainclass + + The TQScrollView is a large canvas - potentially larger than the + coordinate system normally supported by the underlying window + system. This is important because it is quite easy to go beyond + these limitations (e.g. many web pages are more than 32000 pixels + high). Additionally, the TQScrollView can have TQWidgets positioned + on it that scroll around with the drawn content. These sub-widgets + can also have positions outside the normal coordinate range (but + they are still limited in size). + + To provide content for the widget, inherit from TQScrollView, + reimplement drawContents() and use resizeContents() to set the + size of the viewed area. Use addChild() and moveChild() to + position widgets on the view. + + To use TQScrollView effectively it is important to understand its + widget structure in the three styles of use: a single large child + widget, a large panning area with some widgets and a large panning + area with many widgets. + + \section1 Using One Big Widget + + \img tqscrollview-vp2.png + + The first, simplest usage of TQScrollView (depicted above), is + appropriate for scrolling areas that are never more than about + 4000 pixels in either dimension (this is about the maximum + reliable size on X11 servers). In this usage, you just make one + large child in the TQScrollView. The child should be a child of the + viewport() of the scrollview and be added with addChild(): + \code + TQScrollView* sv = new TQScrollView(...); + TQVBox* big_box = new TQVBox(sv->viewport()); + sv->addChild(big_box); + \endcode + You can go on to add arbitrary child widgets to the single child + in the scrollview as you would with any widget: + \code + TQLabel* child1 = new TQLabel("CHILD", big_box); + TQLabel* child2 = new TQLabel("CHILD", big_box); + TQLabel* child3 = new TQLabel("CHILD", big_box); + ... + \endcode + + Here the TQScrollView has four children: the viewport(), the + verticalScrollBar(), the horizontalScrollBar() and a small + cornerWidget(). The viewport() has one child: the big TQVBox. The + TQVBox has the three TQLabel objects as child widgets. When the view + is scrolled, the TQVBox is moved; its children move with it as + child widgets normally do. + + \section1 Using a Very Big View with Some Widgets + + \img tqscrollview-vp.png + + The second usage of TQScrollView (depicted above) is appropriate + when few, if any, widgets are on a very large scrolling area that + is potentially larger than 4000 pixels in either dimension. In + this usage you call resizeContents() to set the size of the area + and reimplement drawContents() to paint the contents. You may also + add some widgets by making them children of the viewport() and + adding them with addChild() (this is the same as the process for + the single large widget in the previous example): + \code + TQScrollView* sv = new TQScrollView(...); + TQLabel* child1 = new TQLabel("CHILD", sv->viewport()); + sv->addChild(child1); + TQLabel* child2 = new TQLabel("CHILD", sv->viewport()); + sv->addChild(child2); + TQLabel* child3 = new TQLabel("CHILD", sv->viewport()); + sv->addChild(child3); + \endcode + Here, the TQScrollView has the same four children: the viewport(), + the verticalScrollBar(), the horizontalScrollBar() and a small + cornerWidget(). The viewport() has the three TQLabel objects as + child widgets. When the view is scrolled, the scrollview moves the + child widgets individually. + + \section1 Using a Very Big View with Many Widgets + + \target enableclipper + \img tqscrollview-cl.png + + The final usage of TQScrollView (depicted above) is appropriate + when many widgets are on a very large scrolling area that is + potentially larger than 4000 pixels in either dimension. In this + usage you call resizeContents() to set the size of the area and + reimplement drawContents() to paint the contents. You then call + enableClipper(TRUE) and add widgets, again by making them children + of the viewport(), and adding them with addChild(): + \code + TQScrollView* sv = new TQScrollView(...); + sv->enableClipper(TRUE); + TQLabel* child1 = new TQLabel("CHILD", sv->viewport()); + sv->addChild(child1); + TQLabel* child2 = new TQLabel("CHILD", sv->viewport()); + sv->addChild(child2); + TQLabel* child3 = new TQLabel("CHILD", sv->viewport()); + sv->addChild(child3); + \endcode + + Here, the TQScrollView has four children: the clipper() (not the + viewport() this time), the verticalScrollBar(), the + horizontalScrollBar() and a small cornerWidget(). The clipper() + has one child: the viewport(). The viewport() has the same three + labels as child widgets. When the view is scrolled the viewport() + is moved; its children move with it as child widgets normally do. + + \target allviews + \section1 Details Relevant for All Views + + Normally you will use the first or third method if you want any + child widgets in the view. + + Note that the widget you see in the scrolled area is the + viewport() widget, not the TQScrollView itself. So to turn mouse + tracking on, for example, use viewport()->setMouseTracking(TRUE). + + To enable drag-and-drop, you would setAcceptDrops(TRUE) on the + TQScrollView (because drag-and-drop events propagate to the + parent). But to work out the logical position in the view, you + would need to map the drop co-ordinate from being relative to the + TQScrollView to being relative to the contents; use the function + viewportToContents() for this. + + To handle mouse events on the scrolling area, subclass scrollview + as you would subclass other widgets, but rather than + reimplementing mousePressEvent(), reimplement + contentsMousePressEvent() instead. The contents specific event + handlers provide translated events in the coordinate system of the + scrollview. If you reimplement mousePressEvent(), you'll get + called only when part of the TQScrollView is clicked: and the only + such part is the "corner" (if you don't set a cornerWidget()) and + the frame; everything else is covered up by the viewport, clipper + or scroll bars. + + When you construct a TQScrollView, some of the widget flags apply + to the viewport() instead of being sent to the TQWidget constructor + for the TQScrollView. This applies to \c WNoAutoErase, \c + WStaticContents, and \c WPaintClever. See \l TQt::WidgetFlags for + documentation about these flags. Here are some examples: + + \list + + \i An image-manipulation widget would use \c + WNoAutoErase|WStaticContents because the widget draws all pixels + itself, and when its size increases, it only needs a paint event + for the new part because the old part remains unchanged. + + \i A scrolling game widget in which the background scrolls as the + characters move might use \c WNoAutoErase (in addition to \c + WStaticContents) so that the window system background does not + flash in and out during scrolling. + + \i A word processing widget might use \c WNoAutoErase and repaint + itself line by line to get a less-flickery resizing. If the widget + is in a mode in which no text justification can take place, it + might use \c WStaticContents too, so that it would only get a + repaint for the newly visible parts. + + \endlist + + Child widgets may be moved using addChild() or moveChild(). Use + childX() and childY() to get the position of a child widget. + + A widget may be placed in the corner between the vertical and + horizontal scrollbars with setCornerWidget(). You can get access + to the scrollbars using horizontalScrollBar() and + verticalScrollBar(), and to the viewport with viewport(). The + scroll view can be scrolled using scrollBy(), ensureVisible(), + setContentsPos() or center(). + + The visible area is given by visibleWidth() and visibleHeight(), + and the contents area by contentsWidth() and contentsHeight(). The + contents may be repainted using one of the repaintContents() or + updateContents() functions. + + Coordinate conversion is provided by contentsToViewport() and + viewportToContents(). + + The contentsMoving() signal is emitted just before the contents + are moved to a new position. + + \warning TQScrollView currently does not erase the background when + resized, i.e. you must always clear the background manually in + scrollview subclasses. This will change in a future version of TQt + and we recommend specifying the WNoAutoErase flag explicitly. + + +*/ + + +/*! + \enum TQScrollView::ResizePolicy + + This enum type is used to control a TQScrollView's reaction to + resize events. + + \value Default the TQScrollView selects one of the other settings + automatically when it has to. In this version of TQt, TQScrollView + changes to \c Manual if you resize the contents with + resizeContents() and to \c AutoOne if a child is added. + + \value Manual the contents stays the size set by resizeContents(). + + \value AutoOne if there is only one child widget the contents stays + the size of that widget. Otherwise the behavior is undefined. + + \value AutoOneFit if there is only one child widget the contents stays + the size of that widget's sizeHint(). If the scrollview is resized + larger than the child's sizeHint(), the child will be resized to + fit. If there is more than one child, the behavior is undefined. + +*/ +//#### The widget will be resized to its sizeHint() when a LayoutHint event +//#### is received + +/*! + Constructs a TQScrollView called \a name with parent \a parent and + widget flags \a f. + + The widget flags \c WStaticContents, \c WNoAutoErase and \c + WPaintClever are propagated to the viewport() widget. The other + widget flags are propagated to the parent constructor as usual. +*/ + +TQScrollView::TQScrollView( TQWidget *parent, const char *name, WFlags f ) : + TQFrame( parent, name, f & (~WStaticContents) & (~WResizeNoErase) ) +{ + WFlags flags = WResizeNoErase | (f&WPaintClever) | (f&WRepaintNoErase) | (f&WStaticContents); + d = new TQScrollViewData( this, flags ); + +#ifndef TQT_NO_DRAGANDDROP + connect( &d->autoscroll_timer, TQ_SIGNAL( timeout() ), + this, TQ_SLOT( doDragAutoScroll() ) ); +#endif + + connect( d->hbar, TQ_SIGNAL( valueChanged(int) ), + this, TQ_SLOT( hslide(int) ) ); + connect( d->vbar, TQ_SIGNAL( valueChanged(int) ), + this, TQ_SLOT( vslide(int) ) ); + + connect( d->hbar, TQ_SIGNAL(sliderPressed()), this, TQ_SLOT(hbarIsPressed()) ); + connect( d->hbar, TQ_SIGNAL(sliderReleased()), this, TQ_SLOT(hbarIsReleased()) ); + connect( d->vbar, TQ_SIGNAL(sliderPressed()), this, TQ_SLOT(vbarIsPressed()) ); + connect( d->vbar, TQ_SIGNAL(sliderReleased()), this, TQ_SLOT(vbarIsReleased()) ); + + + d->viewport->installEventFilter( this ); + + connect( &d->scrollbar_timer, TQ_SIGNAL( timeout() ), + this, TQ_SLOT( updateScrollBars() ) ); + + setFrameStyle( TQFrame::StyledPanel | TQFrame::Sunken ); + setLineWidth( style().pixelMetric(TQStyle::PM_DefaultFrameWidth, this) ); + setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding ) ); +} + + +/*! + Destroys the TQScrollView. Any children added with addChild() will + be deleted. +*/ +TQScrollView::~TQScrollView() +{ + // Be careful not to get all those useless events... + if ( d->clipped_viewport ) + d->clipped_viewport->removeEventFilter( this ); + else + d->viewport->removeEventFilter( this ); + + // order is important + // ~TQWidget may cause a WM_ERASEBKGND on Windows + delete d->vbar; + d->vbar = 0; + delete d->hbar; + d->hbar = 0; + delete d->viewport; + d->viewport = 0; + delete d; + d = 0; +} + +/*! + \fn void TQScrollView::horizontalSliderPressed() + + This signal is emitted whenever the user presses the horizontal slider. +*/ +/*! + \fn void TQScrollView::horizontalSliderReleased() + + This signal is emitted whenever the user releases the horizontal slider. +*/ +/*! + \fn void TQScrollView::verticalSliderPressed() + + This signal is emitted whenever the user presses the vertical slider. +*/ +/*! + \fn void TQScrollView::verticalSliderReleased() + + This signal is emitted whenever the user releases the vertical slider. +*/ +void TQScrollView::hbarIsPressed() +{ + d->hbarPressed = TRUE; + emit( horizontalSliderPressed() ); +} + +void TQScrollView::hbarIsReleased() +{ + d->hbarPressed = FALSE; + emit( horizontalSliderReleased() ); +} + +/*! + Returns TRUE if horizontal slider is pressed by user; otherwise returns FALSE. +*/ +bool TQScrollView::isHorizontalSliderPressed() +{ + return d->hbarPressed; +} + +void TQScrollView::vbarIsPressed() +{ + d->vbarPressed = TRUE; + emit( verticalSliderPressed() ); +} + +void TQScrollView::vbarIsReleased() +{ + d->vbarPressed = FALSE; + emit( verticalSliderReleased() ); +} + +/*! + Returns TRUE if vertical slider is pressed by user; otherwise returns FALSE. +*/ +bool TQScrollView::isVerticalSliderPressed() +{ + return d->vbarPressed; +} + +/*! + \reimp +*/ +void TQScrollView::styleChange( TQStyle& old ) +{ + TQWidget::styleChange( old ); + updateScrollBars(); + d->cachedSizeHint = TQSize(); +} + +/*! + \reimp +*/ +void TQScrollView::fontChange( const TQFont &old ) +{ + TQWidget::fontChange( old ); + updateScrollBars(); + d->cachedSizeHint = TQSize(); +} + +void TQScrollView::hslide( int pos ) +{ + if ( !d->signal_choke ) { + moveContents( -pos, -d->contentsY() ); + TQApplication::syncX(); + } +} + +void TQScrollView::vslide( int pos ) +{ + if ( !d->signal_choke ) { + moveContents( -d->contentsX(), -pos ); + TQApplication::syncX(); + } +} + +/*! + Called when the horizontal scroll bar geometry changes. This is + provided as a protected function so that subclasses can do + interesting things such as providing extra buttons in some of the + space normally used by the scroll bars. + + The default implementation simply gives all the space to \a hbar. + The new geometry is given by \a x, \a y, \a w and \a h. + + \sa setVBarGeometry() +*/ +void TQScrollView::setHBarGeometry(TQScrollBar& hbar, + int x, int y, int w, int h) +{ + hbar.setGeometry( x, y, w, h ); +} + +/*! + Called when the vertical scroll bar geometry changes. This is + provided as a protected function so that subclasses can do + interesting things such as providing extra buttons in some of the + space normally used by the scroll bars. + + The default implementation simply gives all the space to \a vbar. + The new geometry is given by \a x, \a y, \a w and \a h. + + \sa setHBarGeometry() +*/ +void TQScrollView::setVBarGeometry( TQScrollBar& vbar, + int x, int y, int w, int h) +{ + vbar.setGeometry( x, y, w, h ); +} + + +/*! + Returns the viewport size for size (\a x, \a y). + + The viewport size depends on \a (x, y) (the size of the contents), + the size of this widget and the modes of the horizontal and + vertical scroll bars. + + This function permits widgets that can trade vertical and + horizontal space for each other to control scroll bar appearance + better. For example, a word processor or web browser can control + the width of the right margin accurately, whether or not there + needs to be a vertical scroll bar. +*/ + +TQSize TQScrollView::viewportSize( int x, int y ) const +{ + int fw = frameWidth(); + int lmarg = fw+d->l_marg; + int rmarg = fw+d->r_marg; + int tmarg = fw+d->t_marg; + int bmarg = fw+d->b_marg; + + int w = width(); + int h = height(); + + bool needh, needv; + bool showh, showv; + int hsbExt = horizontalScrollBar()->sizeHint().height(); + int vsbExt = verticalScrollBar()->sizeHint().width(); + + if ( d->policy != AutoOne || d->anyVisibleChildren() ) { + // Do we definitely need the scrollbar? + needh = w-lmarg-rmarg < x; + needv = h-tmarg-bmarg < y; + + // Do we intend to show the scrollbar? + if (d->hMode == AlwaysOn) + showh = TRUE; + else if (d->hMode == AlwaysOff) + showh = FALSE; + else + showh = needh; + + if (d->vMode == AlwaysOn) + showv = TRUE; + else if (d->vMode == AlwaysOff) + showv = FALSE; + else + showv = needv; + + // Given other scrollbar will be shown, NOW do we need one? + if ( showh && h-vsbExt-tmarg-bmarg < y ) { + if (d->vMode == Auto) + showv=TRUE; + } + if ( showv && w-hsbExt-lmarg-rmarg < x ) { + if (d->hMode == Auto) + showh=TRUE; + } + } else { + // Scrollbars not needed, only show scrollbar that are always on. + showh = d->hMode == AlwaysOn; + showv = d->vMode == AlwaysOn; + } + + return TQSize( w-lmarg-rmarg - (showv ? vsbExt : 0), + h-tmarg-bmarg - (showh ? hsbExt : 0) ); +} + + +/*! + Updates scroll bars: all possibilities are considered. You should + never need to call this in your code. +*/ +void TQScrollView::updateScrollBars() +{ + if(!horizontalScrollBar() && !verticalScrollBar()) + return; + + // I support this should use viewportSize()... but it needs + // so many of the temporary variables from viewportSize. hm. + int fw = frameWidth(); + int lmarg = fw+d->l_marg; + int rmarg = fw+d->r_marg; + int tmarg = fw+d->t_marg; + int bmarg = fw+d->b_marg; + + int w = width(); + int h = height(); + + int portw, porth; + + bool needh; + bool needv; + bool showh; + bool showv; + bool showc = FALSE; + + int hsbExt = horizontalScrollBar()->sizeHint().height(); + int vsbExt = verticalScrollBar()->sizeHint().width(); + + TQSize oldVisibleSize( visibleWidth(), visibleHeight() ); + + if ( d->policy != AutoOne || d->anyVisibleChildren() ) { + // Do we definitely need the scrollbar? + needh = w-lmarg-rmarg < d->contentsWidth(); + if ( d->inresize ) + needh = !horizontalScrollBar()->isHidden(); + needv = h-tmarg-bmarg < contentsHeight(); + + // Do we intend to show the scrollbar? + if (d->hMode == AlwaysOn) + showh = TRUE; + else if (d->hMode == AlwaysOff) + showh = FALSE; + else + showh = needh; + + if (d->vMode == AlwaysOn) + showv = TRUE; + else if (d->vMode == AlwaysOff) + showv = FALSE; + else + showv = needv; + +#ifdef TQ_WS_MAC + bool mac_need_scroll = FALSE; + if(!parentWidget()) { + mac_need_scroll = TRUE; + } else { + TQWidget *tlw = topLevelWidget(); + TQPoint tlw_br = TQPoint(tlw->width(), tlw->height()), + my_br = posInWindow(this) + TQPoint(w, h); + if(my_br.x() >= tlw_br.x() - 3 && my_br.y() >= tlw_br.y() - 3) + mac_need_scroll = TRUE; + } + if(mac_need_scroll) { + WindowAttributes attr; + GetWindowAttributes((WindowPtr)handle(), &attr); + mac_need_scroll = (attr & kWindowResizableAttribute); + } + if(mac_need_scroll) { + showc = TRUE; + if(d->vMode == Auto) + showv = TRUE; + if(d->hMode == Auto) + showh = TRUE; + } +#endif + + // Given other scrollbar will be shown, NOW do we need one? + if ( showh && h-vsbExt-tmarg-bmarg < contentsHeight() ) { + needv=TRUE; + if (d->vMode == Auto) + showv=TRUE; + } + if ( showv && !d->inresize && w-hsbExt-lmarg-rmarg < d->contentsWidth() ) { + needh=TRUE; + if (d->hMode == Auto) + showh=TRUE; + } + } else { + // Scrollbars not needed, only show scrollbar that are always on. + needh = needv = FALSE; + showh = d->hMode == AlwaysOn; + showv = d->vMode == AlwaysOn; + } + + bool sc = d->signal_choke; + d->signal_choke=TRUE; + + // Hide unneeded scrollbar, calculate viewport size + if ( showh ) { + porth=h-hsbExt-tmarg-bmarg; + } else { + if (!needh) + d->hbar->setValue(0); + d->hbar->hide(); + porth=h-tmarg-bmarg; + } + if ( showv ) { + portw=w-vsbExt-lmarg-rmarg; + } else { + if (!needv) + d->vbar->setValue(0); + d->vbar->hide(); + portw=w-lmarg-rmarg; + } + + // Configure scrollbars that we will show + if ( needv ) { + d->vbar->setRange( 0, contentsHeight()-porth ); + d->vbar->setSteps( TQScrollView::d->vbar->lineStep(), porth ); + } else { + d->vbar->setRange( 0, 0 ); + } + if ( needh ) { + d->hbar->setRange( 0, TQMAX(0, d->contentsWidth()-portw) ); + d->hbar->setSteps( TQScrollView::d->hbar->lineStep(), portw ); + } else { + d->hbar->setRange( 0, 0 ); + } + + // Position the scrollbars, viewport and corner widget. + int bottom; + bool reverse = TQApplication::reverseLayout(); + int xoffset = ( reverse && (showv || cornerWidget() )) ? vsbExt : 0; + int xpos = reverse ? 0 : w - vsbExt; + bool frameContentsOnly = + style().styleHint(TQStyle::SH_ScrollView_FrameOnlyAroundContents); + + if( ! frameContentsOnly ) { + if ( reverse ) + xpos += fw; + else + xpos -= fw; + } + if ( showh ) { + int right = ( showc || showv || cornerWidget() ) ? w-vsbExt : w; + if ( ! frameContentsOnly ) + setHBarGeometry( *d->hbar, fw + xoffset, h-hsbExt-fw, + right-fw-fw, hsbExt ); + else + setHBarGeometry( *d->hbar, 0 + xoffset, h-hsbExt, right, + hsbExt ); + bottom=h-hsbExt; + } else { + bottom=h; + } + if ( showv ) { + clipper()->setGeometry( lmarg + xoffset, tmarg, + w-vsbExt-lmarg-rmarg, + bottom-tmarg-bmarg ); + d->viewportResized( w-vsbExt-lmarg-rmarg, bottom-tmarg-bmarg ); + if ( ! frameContentsOnly ) + changeFrameRect(TQRect(0, 0, w, h) ); + else + changeFrameRect(TQRect(xoffset, 0, w-vsbExt, bottom)); + if (showc || cornerWidget()) { + if ( ! frameContentsOnly ) + setVBarGeometry( *d->vbar, xpos, + fw, vsbExt, + h-hsbExt-fw-fw ); + else + setVBarGeometry( *d->vbar, xpos, 0, + vsbExt, + h-hsbExt ); + } + else { + if ( ! frameContentsOnly ) + setVBarGeometry( *d->vbar, xpos, + fw, vsbExt, + bottom-fw-fw ); + else + setVBarGeometry( *d->vbar, xpos, 0, + vsbExt, bottom ); + } + } else { + if ( ! frameContentsOnly ) + changeFrameRect(TQRect(0, 0, w, h)); + else + changeFrameRect(TQRect(0, 0, w, bottom)); + clipper()->setGeometry( lmarg, tmarg, + w-lmarg-rmarg, bottom-tmarg-bmarg ); + d->viewportResized( w-lmarg-rmarg, bottom-tmarg-bmarg ); + } + + TQWidget *corner = d->corner; + if ( !d->corner ) + corner = d->defaultCorner; + if ( ! frameContentsOnly ) + corner->setGeometry( xpos, + h-hsbExt-fw, + vsbExt, + hsbExt ); + else + corner->setGeometry( xpos, + h-hsbExt, + vsbExt, + hsbExt ); + + d->signal_choke=sc; + + if ( d->contentsX()+visibleWidth() > d->contentsWidth() ) { + int x; +#if 0 + if ( reverse ) + x =TQMIN(0,d->contentsWidth()-visibleWidth()); + else +#endif + x =TQMAX(0,d->contentsWidth()-visibleWidth()); + d->hbar->setValue(x); + // Do it even if it is recursive + moveContents( -x, -d->contentsY() ); + } + if ( d->contentsY()+visibleHeight() > contentsHeight() ) { + int y=TQMAX(0,contentsHeight()-visibleHeight()); + d->vbar->setValue(y); + // Do it even if it is recursive + moveContents( -d->contentsX(), -y ); + } + + // Finally, show the scroll bars + if ( showh && ( d->hbar->isHidden() || !d->hbar->isVisible() ) ) + d->hbar->show(); + if ( showv && ( d->vbar->isHidden() || !d->vbar->isVisible() ) ) + d->vbar->show(); + + d->signal_choke=TRUE; + d->vbar->setValue( d->contentsY() ); + d->hbar->setValue( d->contentsX() ); + d->signal_choke=FALSE; + + TQSize newVisibleSize( visibleWidth(), visibleHeight() ); + if ( d->clipped_viewport && oldVisibleSize != newVisibleSize ) { + TQResizeEvent e( newVisibleSize, oldVisibleSize ); + viewportResizeEvent( &e ); + } +} + + +/*! + \reimp +*/ +void TQScrollView::show() +{ + if ( isVisible() ) + return; + TQWidget::show(); + updateScrollBars(); + d->hideOrShowAll(this); +} + +/*! + \reimp + */ +void TQScrollView::resize( int w, int h ) +{ + TQWidget::resize( w, h ); +} + +/*! + \reimp +*/ +void TQScrollView::resize( const TQSize& s ) +{ + resize( s.width(), s.height() ); +} + +/*! + \reimp +*/ +void TQScrollView::resizeEvent( TQResizeEvent* event ) +{ + TQFrame::resizeEvent( event ); + +#if 0 + if ( TQApplication::reverseLayout() ) { + d->fake_scroll = TRUE; + scrollBy( -event->size().width() + event->oldSize().width(), 0 ); + d->fake_scroll = FALSE; + } +#endif + + bool inresize = d->inresize; + d->inresize = TRUE; + updateScrollBars(); + d->inresize = inresize; + d->scrollbar_timer.start( 0, TRUE ); + + d->hideOrShowAll(this); +} + + + +/*! + \reimp +*/ +void TQScrollView::mousePressEvent( TQMouseEvent * e) //#### remove for 4.0 +{ + e->ignore(); +} + +/*! + \reimp +*/ +void TQScrollView::mouseReleaseEvent( TQMouseEvent *e ) //#### remove for 4.0 +{ + e->ignore(); +} + + +/*! + \reimp +*/ +void TQScrollView::mouseDoubleClickEvent( TQMouseEvent *e ) //#### remove for 4.0 +{ + e->ignore(); +} + +/*! + \reimp +*/ +void TQScrollView::mouseMoveEvent( TQMouseEvent *e ) //#### remove for 4.0 +{ + e->ignore(); +} + +/*! + \reimp +*/ +#ifndef TQT_NO_WHEELEVENT +void TQScrollView::wheelEvent( TQWheelEvent *e ) +{ + TQWheelEvent ce( viewport()->mapFromGlobal( e->globalPos() ), + e->globalPos(), e->delta(), e->state(), e->orientation()); + viewportWheelEvent(&ce); + if ( !ce.isAccepted() ) { + if ( e->orientation() == Horizontal && horizontalScrollBar() && horizontalScrollBar()->isEnabled() ) + TQApplication::sendEvent( horizontalScrollBar(), e); + else if (e->orientation() == Vertical && verticalScrollBar() && verticalScrollBar()->isEnabled() ) + TQApplication::sendEvent( verticalScrollBar(), e); + } else { + e->accept(); + } +} +#endif + +/*! + \reimp +*/ +void TQScrollView::contextMenuEvent( TQContextMenuEvent *e ) +{ + if ( e->reason() != TQContextMenuEvent::Keyboard ) { + e->ignore(); + return; + } + + TQContextMenuEvent ce( e->reason(), viewport()->mapFromGlobal( e->globalPos() ), + e->globalPos(), e->state() ); + viewportContextMenuEvent( &ce ); + if ( ce.isAccepted() ) + e->accept(); + else + e->ignore(); +} + +TQScrollView::ScrollBarMode TQScrollView::vScrollBarMode() const +{ + return d->vMode; +} + + +/*! + \enum TQScrollView::ScrollBarMode + + This enum type describes the various modes of TQScrollView's scroll + bars. + + \value Auto TQScrollView shows a scroll bar when the content is + too large to fit and not otherwise. This is the default. + + \value AlwaysOff TQScrollView never shows a scroll bar. + + \value AlwaysOn TQScrollView always shows a scroll bar. + + (The modes for the horizontal and vertical scroll bars are + independent.) +*/ + + +/*! + \property TQScrollView::vScrollBarMode + \brief the mode for the vertical scroll bar + + The default mode is \c TQScrollView::Auto. + + \sa hScrollBarMode +*/ +void TQScrollView::setVScrollBarMode( ScrollBarMode mode ) +{ + if (d->vMode != mode) { + d->vMode = mode; + updateScrollBars(); + } +} + + +/*! + \property TQScrollView::hScrollBarMode + \brief the mode for the horizontal scroll bar + + The default mode is \c TQScrollView::Auto. + + \sa vScrollBarMode +*/ +TQScrollView::ScrollBarMode TQScrollView::hScrollBarMode() const +{ + return d->hMode; +} + +void TQScrollView::setHScrollBarMode( ScrollBarMode mode ) +{ + if (d->hMode != mode) { + d->hMode = mode; + updateScrollBars(); + } +} + + +/*! + Returns the widget in the corner between the two scroll bars. + + By default, no corner widget is present. +*/ +TQWidget* TQScrollView::cornerWidget() const +{ + return d->corner; +} + +/*! + Sets the widget in the \a corner between the two scroll bars. + + You will probably also want to set at least one of the scroll bar + modes to \c AlwaysOn. + + Passing 0 shows no widget in the corner. + + Any previous \a corner widget is hidden. + + You may call setCornerWidget() with the same widget at different + times. + + All widgets set here will be deleted by the TQScrollView when it is + destroyed unless you separately reparent the widget after setting + some other corner widget (or 0). + + Any \e newly set widget should have no current parent. + + By default, no corner widget is present. + + \sa setVScrollBarMode(), setHScrollBarMode() +*/ +void TQScrollView::setCornerWidget(TQWidget* corner) +{ + TQWidget* oldcorner = d->corner; + if (oldcorner != corner) { + if (oldcorner) oldcorner->hide(); + d->corner = corner; + + if ( corner && corner->parentWidget() != this ) { + // #### No clean way to get current WFlags + corner->reparent( this, (((TQScrollView*)corner))->getWFlags(), + TQPoint(0,0), FALSE ); + } + + updateScrollBars(); + if ( corner ) corner->show(); + } +} + + +void TQScrollView::setResizePolicy( ResizePolicy r ) +{ + d->policy = r; +} + +/*! + \property TQScrollView::resizePolicy + \brief the resize policy + + The default is \c Default. + + \sa ResizePolicy +*/ +TQScrollView::ResizePolicy TQScrollView::resizePolicy() const +{ + return d->policy; +} + +/*! + \reimp +*/ +void TQScrollView::setEnabled( bool enable ) +{ + TQFrame::setEnabled( enable ); +} + +/*! + Removes the \a child widget from the scrolled area. Note that this + happens automatically if the \a child is deleted. +*/ +void TQScrollView::removeChild(TQWidget* child) +{ + if ( !d || !child ) // First check in case we are destructing + return; + + TQSVChildRec *r = d->rec(child); + if ( r ) d->deleteChildRec( r ); +} + +/*! + \reimp +*/ +void TQScrollView::removeChild(TQObject* child) +{ + TQFrame::removeChild(child); +} + +/*! + Inserts the widget, \a child, into the scrolled area positioned at + (\a x, \a y). The position defaults to (0, 0). If the child is + already in the view, it is just moved. + + You may want to call enableClipper(TRUE) if you add a large number + of widgets. +*/ +void TQScrollView::addChild(TQWidget* child, int x, int y) +{ + if ( !child ) { +#if defined(QT_CHECK_NULL) + tqWarning( "TQScrollView::addChild(): Cannot add null child" ); +#endif + return; + } + child->polish(); + child->setBackgroundOrigin(WidgetOrigin); + + if ( child->parentWidget() == viewport() ) { + // May already be there + TQSVChildRec *r = d->rec(child); + if (r) { + r->moveTo(this,x,y,d->clipped_viewport); + if ( d->policy > Manual ) { + d->autoResizeHint(this); + d->autoResize(this); // #### better to just deal with this one widget! + } + return; + } + } + + if ( d->children.isEmpty() && d->policy != Manual ) { + if ( d->policy == Default ) + setResizePolicy( AutoOne ); + child->installEventFilter( this ); + } else if ( d->policy == AutoOne ) { + child->removeEventFilter( this ); //#### ????? + setResizePolicy( Manual ); + } + if ( child->parentWidget() != viewport() ) { + child->reparent( viewport(), 0, TQPoint(0,0), FALSE ); + } + d->addChildRec(child,x,y)->hideOrShow(this, d->clipped_viewport); + + if ( d->policy > Manual ) { + d->autoResizeHint(this); + d->autoResize(this); // #### better to just deal with this one widget! + } +} + +/*! + Repositions the \a child widget to (\a x, \a y). This function is + the same as addChild(). +*/ +void TQScrollView::moveChild(TQWidget* child, int x, int y) +{ + addChild(child,x,y); +} + +/*! + Returns the X position of the given \a child widget. Use this + rather than TQWidget::x() for widgets added to the view. + + This function returns 0 if \a child has not been added to the view. +*/ +int TQScrollView::childX(TQWidget* child) +{ + TQSVChildRec *r = d->rec(child); + return r ? r->x : 0; +} + +/*! + Returns the Y position of the given \a child widget. Use this + rather than TQWidget::y() for widgets added to the view. + + This function returns 0 if \a child has not been added to the view. +*/ +int TQScrollView::childY(TQWidget* child) +{ + TQSVChildRec *r = d->rec(child); + return r ? r->y : 0; +} + +/*! \fn bool TQScrollView::childIsVisible(TQWidget*) + \obsolete + + Returns TRUE if \a child is visible. This is equivalent + to child->isVisible(). +*/ + +/*! \fn void TQScrollView::showChild(TQWidget* child, bool y) + \obsolete + + Sets the visibility of \a child. Equivalent to + TQWidget::show() or TQWidget::hide(). +*/ + +/*! + This event filter ensures the scroll bars are updated when a + single contents widget is resized, shown, hidden or destroyed; it + passes mouse events to the TQScrollView. The event is in \a e and + the object is in \a obj. +*/ + +bool TQScrollView::eventFilter( TQObject *obj, TQEvent *e ) +{ + if ( !d ) + return FALSE; // we are destructing + if ( obj == d->viewport || obj == d->clipped_viewport ) { + switch ( e->type() ) { + /* Forward many events to viewport...() functions */ + case TQEvent::Paint: + viewportPaintEvent( (TQPaintEvent*)e ); + break; + case TQEvent::Resize: + if ( !d->clipped_viewport ) + viewportResizeEvent( (TQResizeEvent *)e ); + break; + case TQEvent::MouseButtonPress: + viewportMousePressEvent( (TQMouseEvent*)e ); + if ( ((TQMouseEvent*)e)->isAccepted() ) + return TRUE; + break; + case TQEvent::MouseButtonRelease: + viewportMouseReleaseEvent( (TQMouseEvent*)e ); + if ( ((TQMouseEvent*)e)->isAccepted() ) + return TRUE; + break; + case TQEvent::MouseButtonDblClick: + viewportMouseDoubleClickEvent( (TQMouseEvent*)e ); + if ( ((TQMouseEvent*)e)->isAccepted() ) + return TRUE; + break; + case TQEvent::MouseMove: + viewportMouseMoveEvent( (TQMouseEvent*)e ); + if ( ((TQMouseEvent*)e)->isAccepted() ) + return TRUE; + break; +#ifndef TQT_NO_DRAGANDDROP + case TQEvent::DragEnter: + viewportDragEnterEvent( (TQDragEnterEvent*)e ); + break; + case TQEvent::DragMove: { + if ( d->drag_autoscroll ) { + TQPoint vp = ((TQDragMoveEvent*) e)->pos(); + TQRect inside_margin( autoscroll_margin, autoscroll_margin, + visibleWidth() - autoscroll_margin * 2, + visibleHeight() - autoscroll_margin * 2 ); + if ( !inside_margin.contains( vp ) ) { + startDragAutoScroll(); + // Keep sending move events + ( (TQDragMoveEvent*)e )->accept( TQRect(0,0,0,0) ); + } + } + viewportDragMoveEvent( (TQDragMoveEvent*)e ); + } break; + case TQEvent::DragLeave: + stopDragAutoScroll(); + viewportDragLeaveEvent( (TQDragLeaveEvent*)e ); + break; + case TQEvent::Drop: + stopDragAutoScroll(); + viewportDropEvent( (TQDropEvent*)e ); + break; +#endif // TQT_NO_DRAGANDDROP + case TQEvent::ContextMenu: + viewportContextMenuEvent( (TQContextMenuEvent*)e ); + if ( ((TQContextMenuEvent*)e)->isAccepted() ) + return TRUE; + break; + case TQEvent::ChildRemoved: + removeChild((TQWidget*)((TQChildEvent*)e)->child()); + break; + case TQEvent::LayoutHint: + d->autoResizeHint(this); + break; + case TQEvent::WindowActivate: + case TQEvent::WindowDeactivate: + return TRUE; + default: + break; + } + } else if ( d && d->rec((TQWidget*)obj) ) { // must be a child + if ( e->type() == TQEvent::Resize ) + d->autoResize(this); + else if ( e->type() == TQEvent::Move ) + d->autoMove(this); + } + return TQFrame::eventFilter( obj, e ); // always continue with standard event processing +} + +/*! + This event handler is called whenever the TQScrollView receives a + mousePressEvent(): the press position in \a e is translated to be a point + on the contents. +*/ +void TQScrollView::contentsMousePressEvent( TQMouseEvent* e ) +{ + e->ignore(); +} + +/*! + This event handler is called whenever the TQScrollView receives a + mouseReleaseEvent(): the release position in \a e is translated to be a + point on the contents. +*/ +void TQScrollView::contentsMouseReleaseEvent( TQMouseEvent* e ) +{ + e->ignore(); +} + +/*! + This event handler is called whenever the TQScrollView receives a + mouseDoubleClickEvent(): the click position in \a e is translated to be a + point on the contents. + + The default implementation generates a normal mouse press event. +*/ +void TQScrollView::contentsMouseDoubleClickEvent( TQMouseEvent* e ) +{ + contentsMousePressEvent(e); // try mouse press event +} + +/*! + This event handler is called whenever the TQScrollView receives a + mouseMoveEvent(): the mouse position in \a e is translated to be a point + on the contents. +*/ +void TQScrollView::contentsMouseMoveEvent( TQMouseEvent* e ) +{ + e->ignore(); +} + +#ifndef TQT_NO_DRAGANDDROP + +/*! + This event handler is called whenever the TQScrollView receives a + dragEnterEvent(): the drag position is translated to be a point + on the contents. +*/ +void TQScrollView::contentsDragEnterEvent( TQDragEnterEvent * ) +{ +} + +/*! + This event handler is called whenever the TQScrollView receives a + dragMoveEvent(): the drag position is translated to be a point on + the contents. +*/ +void TQScrollView::contentsDragMoveEvent( TQDragMoveEvent * ) +{ +} + +/*! + This event handler is called whenever the TQScrollView receives a + dragLeaveEvent(): the drag position is translated to be a point + on the contents. +*/ +void TQScrollView::contentsDragLeaveEvent( TQDragLeaveEvent * ) +{ +} + +/*! + This event handler is called whenever the TQScrollView receives a + dropEvent(): the drop position is translated to be a point on the + contents. +*/ +void TQScrollView::contentsDropEvent( TQDropEvent * ) +{ +} + +#endif // TQT_NO_DRAGANDDROP + +/*! + This event handler is called whenever the TQScrollView receives a + wheelEvent() in \a{e}: the mouse position is translated to be a + point on the contents. +*/ +#ifndef TQT_NO_WHEELEVENT +void TQScrollView::contentsWheelEvent( TQWheelEvent * e ) +{ + e->ignore(); +} +#endif +/*! + This event handler is called whenever the TQScrollView receives a + contextMenuEvent() in \a{e}: the mouse position is translated to + be a point on the contents. +*/ +void TQScrollView::contentsContextMenuEvent( TQContextMenuEvent *e ) +{ + e->ignore(); +} + +/*! + This is a low-level painting routine that draws the viewport + contents. Reimplement this if drawContents() is too high-level + (for example, if you don't want to open a TQPainter on the + viewport). The paint event is passed in \a pe. +*/ +void TQScrollView::viewportPaintEvent( TQPaintEvent* pe ) +{ + TQWidget* vp = viewport(); + + TQPainter p(vp); + TQRect r = pe->rect(); + + if ( d->clipped_viewport ) { + TQRect rr( + -d->clipped_viewport->x(), -d->clipped_viewport->y(), + d->viewport->width(), d->viewport->height() + ); + r &= rr; + if ( r.isValid() ) { + int ex = r.x() + d->clipped_viewport->x() + d->contentsX(); + int ey = r.y() + d->clipped_viewport->y() + d->contentsY(); + int ew = r.width(); + int eh = r.height(); + drawContentsOffset(&p, + d->contentsX()+d->clipped_viewport->x(), + d->contentsY()+d->clipped_viewport->y(), + ex, ey, ew, eh); + } + } else { + r &= d->viewport->rect(); + int ex = r.x() + d->contentsX(); + int ey = r.y() + d->contentsY(); + int ew = r.width(); + int eh = r.height(); + drawContentsOffset(&p, d->contentsX(), d->contentsY(), ex, ey, ew, eh); + } +} + + +/*! + To provide simple processing of events on the contents, this + function receives all resize events sent to the viewport. + + \sa TQWidget::resizeEvent() +*/ +void TQScrollView::viewportResizeEvent( TQResizeEvent* ) +{ +} + +/*! \internal + + To provide simple processing of events on the contents, this + function receives all mouse press events sent to the viewport, + translates the event and calls contentsMousePressEvent(). + + \sa contentsMousePressEvent(), TQWidget::mousePressEvent() +*/ +void TQScrollView::viewportMousePressEvent( TQMouseEvent* e ) +{ + TQMouseEvent ce(e->type(), viewportToContents(e->pos()), + e->globalPos(), e->button(), e->state()); + contentsMousePressEvent(&ce); + if ( !ce.isAccepted() ) + e->ignore(); +} + +/*!\internal + + To provide simple processing of events on the contents, this function + receives all mouse release events sent to the viewport, translates + the event and calls contentsMouseReleaseEvent(). + + \sa TQWidget::mouseReleaseEvent() +*/ +void TQScrollView::viewportMouseReleaseEvent( TQMouseEvent* e ) +{ + TQMouseEvent ce(e->type(), viewportToContents(e->pos()), + e->globalPos(), e->button(), e->state()); + contentsMouseReleaseEvent(&ce); + if ( !ce.isAccepted() ) + e->ignore(); +} + +/*!\internal + + To provide simple processing of events on the contents, this function + receives all mouse double click events sent to the viewport, + translates the event and calls contentsMouseDoubleClickEvent(). + + \sa TQWidget::mouseDoubleClickEvent() +*/ +void TQScrollView::viewportMouseDoubleClickEvent( TQMouseEvent* e ) +{ + TQMouseEvent ce(e->type(), viewportToContents(e->pos()), + e->globalPos(), e->button(), e->state()); + contentsMouseDoubleClickEvent(&ce); + if ( !ce.isAccepted() ) + e->ignore(); +} + +/*!\internal + + To provide simple processing of events on the contents, this function + receives all mouse move events sent to the viewport, translates the + event and calls contentsMouseMoveEvent(). + + \sa TQWidget::mouseMoveEvent() +*/ +void TQScrollView::viewportMouseMoveEvent( TQMouseEvent* e ) +{ + TQMouseEvent ce(e->type(), viewportToContents(e->pos()), + e->globalPos(), e->button(), e->state()); + contentsMouseMoveEvent(&ce); + if ( !ce.isAccepted() ) + e->ignore(); +} + +#ifndef TQT_NO_DRAGANDDROP + +/*!\internal + + To provide simple processing of events on the contents, this function + receives all drag enter events sent to the viewport, translates the + event and calls contentsDragEnterEvent(). + + \sa TQWidget::dragEnterEvent() +*/ +void TQScrollView::viewportDragEnterEvent( TQDragEnterEvent* e ) +{ + e->setPoint(viewportToContents(e->pos())); + contentsDragEnterEvent(e); + e->setPoint(contentsToViewport(e->pos())); +} + +/*!\internal + + To provide simple processing of events on the contents, this function + receives all drag move events sent to the viewport, translates the + event and calls contentsDragMoveEvent(). + + \sa TQWidget::dragMoveEvent() +*/ +void TQScrollView::viewportDragMoveEvent( TQDragMoveEvent* e ) +{ + e->setPoint(viewportToContents(e->pos())); + contentsDragMoveEvent(e); + e->setPoint(contentsToViewport(e->pos())); +} + +/*!\internal + + To provide simple processing of events on the contents, this function + receives all drag leave events sent to the viewport and calls + contentsDragLeaveEvent(). + + \sa TQWidget::dragLeaveEvent() +*/ +void TQScrollView::viewportDragLeaveEvent( TQDragLeaveEvent* e ) +{ + contentsDragLeaveEvent(e); +} + +/*!\internal + + To provide simple processing of events on the contents, this function + receives all drop events sent to the viewport, translates the event + and calls contentsDropEvent(). + + \sa TQWidget::dropEvent() +*/ +void TQScrollView::viewportDropEvent( TQDropEvent* e ) +{ + e->setPoint(viewportToContents(e->pos())); + contentsDropEvent(e); + e->setPoint(contentsToViewport(e->pos())); +} + +#endif // TQT_NO_DRAGANDDROP + +/*!\internal + + To provide simple processing of events on the contents, this function + receives all wheel events sent to the viewport, translates the + event and calls contentsWheelEvent(). + + \sa TQWidget::wheelEvent() +*/ +#ifndef TQT_NO_WHEELEVENT +void TQScrollView::viewportWheelEvent( TQWheelEvent* e ) +{ + /* + Different than standard mouse events, because wheel events might + be sent to the focus widget if the widget-under-mouse doesn't want + the event itself. + */ + TQWheelEvent ce( viewportToContents(e->pos()), + e->globalPos(), e->delta(), e->state(), e->orientation()); + contentsWheelEvent(&ce); + if ( ce.isAccepted() ) + e->accept(); + else + e->ignore(); +} +#endif + +/*! \internal + + To provide simple processing of events on the contents, this function + receives all context menu events sent to the viewport, translates the + event and calls contentsContextMenuEvent(). +*/ +void TQScrollView::viewportContextMenuEvent( TQContextMenuEvent *e ) +{ + TQContextMenuEvent ce(e->reason(), viewportToContents(e->pos()), e->globalPos(), e->state() ); + contentsContextMenuEvent( &ce ); + if ( ce.isAccepted() ) + e->accept(); + else + e->ignore(); +} + +/*! + Returns the component horizontal scroll bar. It is made available + to allow accelerators, autoscrolling, etc. + + It should not be used for other purposes. + + This function never returns 0. +*/ +TQScrollBar* TQScrollView::horizontalScrollBar() const +{ + return d->hbar; +} + +/*! + Returns the component vertical scroll bar. It is made available to + allow accelerators, autoscrolling, etc. + + It should not be used for other purposes. + + This function never returns 0. +*/ +TQScrollBar* TQScrollView::verticalScrollBar() const { + return d->vbar; +} + + +/*! + Scrolls the content so that the point \a (x, y) is visible with at + least 50-pixel margins (if possible, otherwise centered). +*/ +void TQScrollView::ensureVisible( int x, int y ) +{ + ensureVisible(x, y, 50, 50); +} + +/*! + \overload + + Scrolls the content so that the point \a (x, y) is visible with at + least the \a xmargin and \a ymargin margins (if possible, + otherwise centered). +*/ +void TQScrollView::ensureVisible( int x, int y, int xmargin, int ymargin ) +{ + int pw=visibleWidth(); + int ph=visibleHeight(); + + int cx=-d->contentsX(); + int cy=-d->contentsY(); + int cw=d->contentsWidth(); + int ch=contentsHeight(); + + if ( pw < xmargin*2 ) + xmargin=pw/2; + if ( ph < ymargin*2 ) + ymargin=ph/2; + + if ( cw <= pw ) { + xmargin=0; + cx=0; + } + if ( ch <= ph ) { + ymargin=0; + cy=0; + } + + if ( x < -cx+xmargin ) + cx = -x+xmargin; + else if ( x >= -cx+pw-xmargin ) + cx = -x+pw-xmargin; + + if ( y < -cy+ymargin ) + cy = -y+ymargin; + else if ( y >= -cy+ph-ymargin ) + cy = -y+ph-ymargin; + + if ( cx > 0 ) + cx=0; + else if ( cx < pw-cw && cw>pw ) + cx=pw-cw; + + if ( cy > 0 ) + cy=0; + else if ( cy < ph-ch && ch>ph ) + cy=ph-ch; + + setContentsPos( -cx, -cy ); +} + +/*! + Scrolls the content so that the point \a (x, y) is in the top-left + corner. +*/ +void TQScrollView::setContentsPos( int x, int y ) +{ +#if 0 + // bounds checking... + if ( TQApplication::reverseLayout() ) + if ( x > d->contentsWidth() - visibleWidth() ) x = d->contentsWidth() - visibleWidth(); + else +#endif + if ( x < 0 ) x = 0; + if ( y < 0 ) y = 0; + // Choke signal handling while we update BOTH sliders. + d->signal_choke=TRUE; + moveContents( -x, -y ); + d->vbar->setValue( y ); + d->hbar->setValue( x ); + d->signal_choke=FALSE; +} + +/*! + Scrolls the content by \a dx to the left and \a dy upwards. +*/ +void TQScrollView::scrollBy( int dx, int dy ) +{ + setContentsPos( TQMAX( d->contentsX()+dx, 0 ), TQMAX( d->contentsY()+dy, 0 ) ); +} + +/*! + Scrolls the content so that the point \a (x, y) is in the center + of visible area. +*/ +void TQScrollView::center( int x, int y ) +{ + ensureVisible( x, y, 32000, 32000 ); +} + +/*! + \overload + + Scrolls the content so that the point \a (x, y) is visible with + the \a xmargin and \a ymargin margins (as fractions of visible + the area). + + For example: + \list + \i Margin 0.0 allows (x, y) to be on the edge of the visible area. + \i Margin 0.5 ensures that (x, y) is in middle 50% of the visible area. + \i Margin 1.0 ensures that (x, y) is in the center of the the visible area. + \endlist +*/ +void TQScrollView::center( int x, int y, float xmargin, float ymargin ) +{ + int pw=visibleWidth(); + int ph=visibleHeight(); + ensureVisible( x, y, int( xmargin/2.0*pw+0.5 ), int( ymargin/2.0*ph+0.5 ) ); +} + + +/*! + \fn void TQScrollView::contentsMoving(int x, int y) + + This signal is emitted just before the contents are moved to + position \a (x, y). + + \sa contentsX(), contentsY() +*/ + +/*! + Moves the contents by \a (x, y). +*/ +void TQScrollView::moveContents(int x, int y) +{ + if ( -x+visibleWidth() > d->contentsWidth() ) +#if 0 + if( TQApplication::reverseLayout() ) + x=TQMAX(0,-d->contentsWidth()+visibleWidth()); + else +#endif + x=TQMIN(0,-d->contentsWidth()+visibleWidth()); + if ( -y+visibleHeight() > contentsHeight() ) + y=TQMIN(0,-contentsHeight()+visibleHeight()); + + int dx = x - d->vx; + int dy = y - d->vy; + + if (!dx && !dy) + return; // Nothing to do + + emit contentsMoving( -x, -y ); + + d->vx = x; + d->vy = y; + + if ( d->clipped_viewport || d->static_bg ) { + // Cheap move (usually) + d->moveAllBy(dx,dy); + } else if ( /*dx && dy ||*/ + ( TQABS(dy) * 5 > visibleHeight() * 4 ) || + ( TQABS(dx) * 5 > visibleWidth() * 4 ) + ) + { + // Big move + if ( viewport()->isUpdatesEnabled() ) + viewport()->update(); + d->moveAllBy(dx,dy); + } else if ( !d->fake_scroll || d->contentsWidth() > visibleWidth() ) { + // Small move + clipper()->scroll(dx,dy); + } + d->hideOrShowAll(this, TRUE ); +} + +/*! + \property TQScrollView::contentsX + \brief the X coordinate of the contents that are at the left edge of + the viewport. +*/ +int TQScrollView::contentsX() const +{ + return d->contentsX(); +} + +/*! + \property TQScrollView::contentsY + \brief the Y coordinate of the contents that are at the top edge of + the viewport. +*/ +int TQScrollView::contentsY() const +{ + return d->contentsY(); +} + +/*! + \property TQScrollView::contentsWidth + \brief the width of the contents area +*/ +int TQScrollView::contentsWidth() const +{ + return d->contentsWidth(); +} + +/*! + \property TQScrollView::contentsHeight + \brief the height of the contents area +*/ +int TQScrollView::contentsHeight() const +{ + return d->vheight; +} + +/*! + Sets the size of the contents area to \a w pixels wide and \a h + pixels high and updates the viewport accordingly. +*/ +void TQScrollView::resizeContents( int w, int h ) +{ + int ow = d->vwidth; + int oh = d->vheight; + d->vwidth = w; + d->vheight = h; + + d->scrollbar_timer.start( 0, TRUE ); + + if ( d->children.isEmpty() && d->policy == Default ) + setResizePolicy( Manual ); + + if ( ow > w ) { + // Swap + int t=w; + w=ow; + ow=t; + } + // Refresh area ow..w + if ( ow < visibleWidth() && w >= 0 ) { + if ( ow < 0 ) + ow = 0; + if ( w > visibleWidth() ) + w = visibleWidth(); + clipper()->update( d->contentsX()+ow, 0, w-ow, visibleHeight() ); + } + + if ( oh > h ) { + // Swap + int t=h; + h=oh; + oh=t; + } + // Refresh area oh..h + if ( oh < visibleHeight() && h >= 0 ) { + if ( oh < 0 ) + oh = 0; + if ( h > visibleHeight() ) + h = visibleHeight(); + clipper()->update( 0, d->contentsY()+oh, visibleWidth(), h-oh); + } +} + +/*! + Calls update() on a rectangle defined by \a x, \a y, \a w, \a h, + translated appropriately. If the rectangle is not visible, nothing + is repainted. + + \sa repaintContents() +*/ +void TQScrollView::updateContents( int x, int y, int w, int h ) +{ + if ( testWState(WState_Visible|WState_BlockUpdates) != WState_Visible ) + return; + + TQWidget* vp = viewport(); + + // Translate + x -= d->contentsX(); + y -= d->contentsY(); + + // Clip to TQCOORD space + if ( x < 0 ) { + w += x; + x = 0; + } + if ( y < 0 ) { + h += y; + y = 0; + } + + if ( w < 0 || h < 0 ) + return; + if ( x > visibleWidth() || y > visibleHeight() ) + return; + + if ( w > visibleWidth() ) + w = visibleWidth(); + if ( h > visibleHeight() ) + h = visibleHeight(); + + if ( d->clipped_viewport ) { + // Translate clipper() to viewport() + x -= d->clipped_viewport->x(); + y -= d->clipped_viewport->y(); + } + + vp->update( x, y, w, h ); +} + +/*! + \overload + + Updates the contents in rectangle \a r +*/ +void TQScrollView::updateContents( const TQRect& r ) +{ + updateContents(r.x(), r.y(), r.width(), r.height()); +} + +/*! + \overload +*/ +void TQScrollView::updateContents() +{ + updateContents( d->contentsX(), d->contentsY(), visibleWidth(), visibleHeight() ); +} + +/*! + \overload + + Repaints the contents of rectangle \a r. If \a erase is TRUE the + background is cleared using the background color. +*/ +void TQScrollView::repaintContents( const TQRect& r, bool erase ) +{ + repaintContents(r.x(), r.y(), r.width(), r.height(), erase); +} + + +/*! + \overload + + Repaints the contents. If \a erase is TRUE the background is + cleared using the background color. +*/ +void TQScrollView::repaintContents( bool erase ) +{ + repaintContents( d->contentsX(), d->contentsY(), visibleWidth(), visibleHeight(), erase ); +} + + +/*! + Calls repaint() on a rectangle defined by \a x, \a y, \a w, \a h, + translated appropriately. If the rectangle is not visible, nothing + is repainted. If \a erase is TRUE the background is cleared using + the background color. + + \sa updateContents() +*/ +void TQScrollView::repaintContents( int x, int y, int w, int h, bool erase ) +{ + if ( testWState(WState_Visible|WState_BlockUpdates) != WState_Visible ) + return; + + TQWidget* vp = viewport(); + + // Translate logical to clipper() + x -= d->contentsX(); + y -= d->contentsY(); + + // Clip to TQCOORD space + if ( x < 0 ) { + w += x; + x = 0; + } + if ( y < 0 ) { + h += y; + y = 0; + } + + if ( w < 0 || h < 0 ) + return; + if ( w > visibleWidth() ) + w = visibleWidth(); + if ( h > visibleHeight() ) + h = visibleHeight(); + + if ( d->clipped_viewport ) { + // Translate clipper() to viewport() + x -= d->clipped_viewport->x(); + y -= d->clipped_viewport->y(); + } + + vp->repaint( x, y, w, h, erase ); +} + + +/*! + For backward-compatibility only. It is easier to use + drawContents(TQPainter*,int,int,int,int). + + The default implementation translates the painter appropriately + and calls drawContents(TQPainter*,int,int,int,int). See + drawContents() for an explanation of the parameters \a p, \a + offsetx, \a offsety, \a clipx, \a clipy, \a clipw and \a cliph. +*/ +void TQScrollView::drawContentsOffset(TQPainter* p, int offsetx, int offsety, int clipx, int clipy, int clipw, int cliph) +{ + p->translate(-offsetx,-offsety); + drawContents(p, clipx, clipy, clipw, cliph); +} + +/*! + \fn void TQScrollView::drawContents(TQPainter* p, int clipx, int clipy, int clipw, int cliph) + + Reimplement this function if you are viewing a drawing area rather + than a widget. + + The function should draw the rectangle (\a clipx, \a clipy, \a + clipw, \a cliph) of the contents using painter \a p. The clip + rectangle is in the scrollview's coordinates. + + For example: + \code + { + // Fill a 40000 by 50000 rectangle at (100000,150000) + + // Calculate the coordinates... + int x1 = 100000, y1 = 150000; + int x2 = x1+40000-1, y2 = y1+50000-1; + + // Clip the coordinates so X/Windows will not have problems... + if (x1 < clipx) x1=clipx; + if (y1 < clipy) y1=clipy; + if (x2 > clipx+clipw-1) x2=clipx+clipw-1; + if (y2 > clipy+cliph-1) y2=clipy+cliph-1; + + // Paint using the small coordinates... + if ( x2 >= x1 && y2 >= y1 ) + p->fillRect(x1, y1, x2-x1+1, y2-y1+1, red); + } + \endcode + + The clip rectangle and translation of the painter \a p is already + set appropriately. +*/ +void TQScrollView::drawContents(TQPainter*, int, int, int, int) +{ +} + + +/*! + \reimp +*/ +void TQScrollView::frameChanged() +{ + // slight ugle-hack - the listview header needs readjusting when + // changing the frame + if (TQListView *lv = ::tqt_cast(this)) + lv->triggerUpdate(); + TQFrame::frameChanged(); + updateScrollBars(); +} + + +/*! + Returns the viewport widget of the scrollview. This is the widget + containing the contents widget or which is the drawing area. +*/ +TQWidget* TQScrollView::viewport() const +{ + if ( d->clipped_viewport ) + return d->clipped_viewport; + return d->viewport; +} + +/*! + Returns the clipper widget. Contents in the scrollview are + ultimately clipped to be inside the clipper widget. + + You should not need to use this function. + + \sa visibleWidth(), visibleHeight() +*/ +TQWidget* TQScrollView::clipper() const +{ + return d->viewport; +} + +/*! + \property TQScrollView::visibleWidth + \brief the horizontal amount of the content that is visible +*/ +int TQScrollView::visibleWidth() const +{ + return clipper()->width(); +} + +/*! + \property TQScrollView::visibleHeight + \brief the vertical amount of the content that is visible +*/ +int TQScrollView::visibleHeight() const +{ + return clipper()->height(); +} + + +void TQScrollView::changeFrameRect(const TQRect& r) +{ + TQRect oldr = frameRect(); + if (oldr != r) { + TQRect cr = contentsRect(); + TQRegion fr( frameRect() ); + fr = fr.subtract( contentsRect() ); + setFrameRect( r ); + if ( isVisible() ) { + cr = cr.intersect( contentsRect() ); + fr = fr.unite( frameRect() ); + fr = fr.subtract( cr ); + if ( !fr.isEmpty() ) + TQApplication::postEvent( this, new TQPaintEvent( fr, FALSE ) ); + } + } +} + + +/*! + Sets the margins around the scrolling area to \a left, \a top, \a + right and \a bottom. This is useful for applications such as + spreadsheets with "locked" rows and columns. The marginal space is + \e inside the frameRect() and is left blank; reimplement + drawFrame() or put widgets in the unused area. + + By default all margins are zero. + + \sa frameChanged() +*/ +void TQScrollView::setMargins(int left, int top, int right, int bottom) +{ + if ( left == d->l_marg && + top == d->t_marg && + right == d->r_marg && + bottom == d->b_marg ) + return; + + d->l_marg = left; + d->t_marg = top; + d->r_marg = right; + d->b_marg = bottom; + updateScrollBars(); +} + + +/*! + Returns the left margin. + + \sa setMargins() +*/ +int TQScrollView::leftMargin() const +{ + return d->l_marg; +} + + +/*! + Returns the top margin. + + \sa setMargins() +*/ +int TQScrollView::topMargin() const +{ + return d->t_marg; +} + + +/*! + Returns the right margin. + + \sa setMargins() +*/ +int TQScrollView::rightMargin() const +{ + return d->r_marg; +} + + +/*! + Returns the bottom margin. + + \sa setMargins() +*/ +int TQScrollView::bottomMargin() const +{ + return d->b_marg; +} + +/*! + \reimp +*/ +bool TQScrollView::focusNextPrevChild( bool next ) +{ + // Makes sure that the new focus widget is on-screen, if + // necessary by scrolling the scroll view. + + // first set things up for the scan + TQFocusData *f = focusData(); + TQWidget *startingPoint = f->home(); + TQWidget *candidate = 0; + TQWidget *w = next ? f->next() : f->prev(); + TQSVChildRec *r; + extern bool tqt_tab_all_widgets; + uint focus_flag = tqt_tab_all_widgets ? TabFocus : StrongFocus; + + // then scan for a possible focus widget candidate + while( !candidate && w != startingPoint ) { + if ( w != startingPoint && + (w->focusPolicy() & focus_flag) == focus_flag + && w->isEnabled() &&!w->focusProxy() && w->isVisible() ) + candidate = w; + w = next ? f->next() : f->prev(); + } + + // if we could not find one, maybe super or parentWidget() can? + if ( !candidate ) + return TQFrame::focusNextPrevChild( next ); + + // we've found one. + r = d->ancestorRec( candidate ); + if ( r && ( r->child == candidate || + candidate->isVisibleTo( r->child ) ) ) { + TQPoint cp = r->child->mapToGlobal(TQPoint(0,0)); + TQPoint cr = candidate->mapToGlobal(TQPoint(0,0)) - cp; + ensureVisible( r->x+cr.x()+candidate->width()/2, + r->y+cr.y()+candidate->height()/2, + candidate->width()/2, + candidate->height()/2 ); + } + + candidate->setFocus(); + return TRUE; +} + + + +/*! + When a large numbers of child widgets are in a scrollview, + especially if they are close together, the scrolling performance + can suffer greatly. If \a y is TRUE the scrollview will use an + extra widget to group child widgets. + + Note that you may only call enableClipper() prior to adding + widgets. + + For a full discussion, see this class's \link #enableclipper + detailed description\endlink. +*/ +void TQScrollView::enableClipper(bool y) +{ + if ( !d->clipped_viewport == !y ) + return; + if ( d->children.count() ) + tqFatal("May only call TQScrollView::enableClipper() before adding widgets"); + if ( y ) { + d->clipped_viewport = new TQClipperWidget(clipper(), "qt_clipped_viewport", d->flags); + d->clipped_viewport->setGeometry(-coord_limit/2,-coord_limit/2, + coord_limit,coord_limit); + d->clipped_viewport->setBackgroundMode( d->viewport->backgroundMode() ); + d->viewport->setBackgroundMode(NoBackground); // no exposures for this + d->viewport->removeEventFilter( this ); + d->clipped_viewport->installEventFilter( this ); + d->clipped_viewport->show(); + } else { + delete d->clipped_viewport; + d->clipped_viewport = 0; + } +} + +/*! + Sets the scrollview to have a static background if \a y is TRUE, + or a scrolling background if \a y is FALSE. By default, the + background is scrolling. + + Be aware that this mode is quite slow, as a full repaint of the + visible area has to be triggered on every contents move. + + \sa hasStaticBackground() +*/ +void TQScrollView::setStaticBackground(bool y) +{ + d->static_bg = y; +} + +/*! + Returns TRUE if TQScrollView uses a static background; otherwise + returns FALSE. + + \sa setStaticBackground() +*/ +bool TQScrollView::hasStaticBackground() const +{ + return d->static_bg; +} + +/*! + \overload + + Returns the point \a p translated to a point on the viewport() + widget. +*/ +TQPoint TQScrollView::contentsToViewport( const TQPoint& p ) const +{ + if ( d->clipped_viewport ) { + return TQPoint( p.x() - d->contentsX() - d->clipped_viewport->x(), + p.y() - d->contentsY() - d->clipped_viewport->y() ); + } else { + return TQPoint( p.x() - d->contentsX(), + p.y() - d->contentsY() ); + } +} + +/*! + \overload + + Returns the point on the viewport \a vp translated to a point in + the contents. +*/ +TQPoint TQScrollView::viewportToContents( const TQPoint& vp ) const +{ + if ( d->clipped_viewport ) { + return TQPoint( vp.x() + d->contentsX() + d->clipped_viewport->x(), + vp.y() + d->contentsY() + d->clipped_viewport->y() ); + } else { + return TQPoint( vp.x() + d->contentsX(), + vp.y() + d->contentsY() ); + } +} + + +/*! + Translates a point (\a x, \a y) in the contents to a point (\a vx, + \a vy) on the viewport() widget. +*/ +void TQScrollView::contentsToViewport( int x, int y, int& vx, int& vy ) const +{ + const TQPoint v = contentsToViewport(TQPoint(x,y)); + vx = v.x(); + vy = v.y(); +} + +/*! + Translates a point (\a vx, \a vy) on the viewport() widget to a + point (\a x, \a y) in the contents. +*/ +void TQScrollView::viewportToContents( int vx, int vy, int& x, int& y ) const +{ + const TQPoint c = viewportToContents(TQPoint(vx,vy)); + x = c.x(); + y = c.y(); +} + +/*! + \reimp +*/ +TQSize TQScrollView::sizeHint() const +{ + if ( d->use_cached_size_hint && d->cachedSizeHint.isValid() ) + return d->cachedSizeHint; + + constPolish(); + int f = 2 * frameWidth(); + int h = fontMetrics().height(); + TQSize sz( f, f ); + if ( d->policy > Manual ) { + TQSVChildRec *r = d->children.first(); + if ( r ) { + TQSize cs = r->child->sizeHint(); + if ( cs.isValid() ) + sz += cs.boundedTo( r->child->maximumSize() ); + else + sz += r->child->size(); + } + } else { + sz += TQSize( d->contentsWidth(), contentsHeight() ); + } + if (d->vMode == AlwaysOn) + sz.setWidth(sz.width() + d->vbar->sizeHint().width()); + if (d->hMode == AlwaysOn) + sz.setHeight(sz.height() + d->hbar->sizeHint().height()); + return sz.expandedTo( TQSize(12 * h, 8 * h) ) + .boundedTo( TQSize(36 * h, 24 * h) ); +} + + +/*! + \reimp +*/ +TQSize TQScrollView::minimumSizeHint() const +{ + int h = fontMetrics().height(); + if ( h < 10 ) + h = 10; + int f = 2 * frameWidth(); + return TQSize( (6 * h) + f, (4 * h) + f ); +} + + +/*! + \reimp + + (Implemented to get rid of a compiler warning.) +*/ +void TQScrollView::drawContents( TQPainter * ) +{ +} + +#ifndef TQT_NO_DRAGANDDROP + +/*! + \internal +*/ +void TQScrollView::startDragAutoScroll() +{ + if ( !d->autoscroll_timer.isActive() ) { + d->autoscroll_time = initialScrollTime; + d->autoscroll_accel = initialScrollAccel; + d->autoscroll_timer.start( d->autoscroll_time ); + } +} + + +/*! + \internal +*/ +void TQScrollView::stopDragAutoScroll() +{ + d->autoscroll_timer.stop(); +} + + +/*! + \internal +*/ +void TQScrollView::doDragAutoScroll() +{ + TQPoint p = d->viewport->mapFromGlobal( TQCursor::pos() ); + + if ( d->autoscroll_accel-- <= 0 && d->autoscroll_time ) { + d->autoscroll_accel = initialScrollAccel; + d->autoscroll_time--; + d->autoscroll_timer.start( d->autoscroll_time ); + } + int l = TQMAX( 1, ( initialScrollTime- d->autoscroll_time ) ); + + int dx = 0, dy = 0; + if ( p.y() < autoscroll_margin ) { + dy = -l; + } else if ( p.y() > visibleHeight() - autoscroll_margin ) { + dy = +l; + } + if ( p.x() < autoscroll_margin ) { + dx = -l; + } else if ( p.x() > visibleWidth() - autoscroll_margin ) { + dx = +l; + } + if ( dx || dy ) { + scrollBy(dx,dy); + } else { + stopDragAutoScroll(); + } +} + + +/*! + \property TQScrollView::dragAutoScroll + \brief whether autoscrolling in drag move events is enabled + + If this property is set to TRUE (the default), the TQScrollView + automatically scrolls the contents in drag move events if the user + moves the cursor close to a border of the view. Of course this + works only if the viewport accepts drops. Specifying FALSE + disables this autoscroll feature. + + \warning Enabling this property might not be enough to + effectively turn on autoscrolling. If you put a custom widget in + the TQScrollView, you might need to call TQDragEvent::ignore() on + the event in the dragEnterEvent() and dragMoveEvent() + reimplementations. +*/ + +void TQScrollView::setDragAutoScroll( bool b ) +{ + d->drag_autoscroll = b; +} + +bool TQScrollView::dragAutoScroll() const +{ + return d->drag_autoscroll; +} + +#endif // TQT_NO_DRAGANDDROP + +/*!\internal + */ +void TQScrollView::setCachedSizeHint( const TQSize &sh ) const +{ + if ( isVisible() && !d->cachedSizeHint.isValid() ) + d->cachedSizeHint = sh; +} + +/*!\internal + */ +void TQScrollView::disableSizeHintCaching() +{ + d->use_cached_size_hint = FALSE; +} + +/*!\internal + */ +TQSize TQScrollView::cachedSizeHint() const +{ + return d->use_cached_size_hint ? d->cachedSizeHint : TQSize(); +} + +#endif // TQT_NO_SCROLLVIEW diff --git a/src/widgets/tqscrollview.h b/src/widgets/tqscrollview.h new file mode 100644 index 000000000..21cc37237 --- /dev/null +++ b/src/widgets/tqscrollview.h @@ -0,0 +1,269 @@ +/**************************************************************************** +** +** Definition of TQScrollView class +** +** Created : 970523 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ +#ifndef TQSCROLLVIEW_H +#define TQSCROLLVIEW_H + +#ifndef QT_H +#include "ntqframe.h" +#include "tqscrollbar.h" +#endif // QT_H + +#ifndef TQT_NO_SCROLLVIEW + +class TQScrollViewData; + +class TQ_EXPORT TQScrollView : public TQFrame +{ + TQ_OBJECT + TQ_ENUMS( ResizePolicy ScrollBarMode ) + TQ_PROPERTY( ResizePolicy resizePolicy READ resizePolicy WRITE setResizePolicy ) + TQ_PROPERTY( ScrollBarMode vScrollBarMode READ vScrollBarMode WRITE setVScrollBarMode ) + TQ_PROPERTY( ScrollBarMode hScrollBarMode READ hScrollBarMode WRITE setHScrollBarMode ) + TQ_PROPERTY( int visibleWidth READ visibleWidth ) + TQ_PROPERTY( int visibleHeight READ visibleHeight ) + TQ_PROPERTY( int contentsWidth READ contentsWidth ) + TQ_PROPERTY( int contentsHeight READ contentsHeight ) + TQ_PROPERTY( int contentsX READ contentsX ) + TQ_PROPERTY( int contentsY READ contentsY ) +#ifndef TQT_NO_DRAGANDDROP + TQ_PROPERTY( bool dragAutoScroll READ dragAutoScroll WRITE setDragAutoScroll ) +#endif + +public: + TQScrollView(TQWidget* parent=0, const char* name=0, WFlags f=0); + ~TQScrollView(); + + enum ResizePolicy { Default, Manual, AutoOne, AutoOneFit }; + virtual void setResizePolicy( ResizePolicy ); + ResizePolicy resizePolicy() const; + + void styleChange( TQStyle & ); + void removeChild(TQWidget* child); + virtual void addChild( TQWidget* child, int x=0, int y=0 ); + virtual void moveChild( TQWidget* child, int x, int y ); + int childX(TQWidget* child); + int childY(TQWidget* child); + bool childIsVisible(TQWidget* child) { return child->isVisible(); } // obsolete functions + void showChild(TQWidget* child, bool yes=TRUE) { + if ( yes ) + child->show(); + else + child->hide(); + } + + enum ScrollBarMode { Auto, AlwaysOff, AlwaysOn }; + + ScrollBarMode vScrollBarMode() const; + virtual void setVScrollBarMode( ScrollBarMode ); + + ScrollBarMode hScrollBarMode() const; + virtual void setHScrollBarMode( ScrollBarMode ); + + TQWidget* cornerWidget() const; + virtual void setCornerWidget(TQWidget*); + + // ### 4.0: Consider providing a factory function for scrollbars + // (e.g. make the two following functions virtual) + TQScrollBar* horizontalScrollBar() const; + TQScrollBar* verticalScrollBar() const; + TQWidget* viewport() const; + TQWidget* clipper() const; + + int visibleWidth() const; + int visibleHeight() const; + + int contentsWidth() const; + int contentsHeight() const; + int contentsX() const; + int contentsY() const; + + void resize( int w, int h ); + void resize( const TQSize& ); + void show(); + + void updateContents( int x, int y, int w, int h ); + void updateContents( const TQRect& r ); + void updateContents(); + void repaintContents( int x, int y, int w, int h, bool erase=TRUE ); + void repaintContents( const TQRect& r, bool erase=TRUE ); + void repaintContents( bool erase=TRUE ); + void contentsToViewport( int x, int y, int& vx, int& vy ) const; + void viewportToContents( int vx, int vy, int& x, int& y ) const; + TQPoint contentsToViewport( const TQPoint& ) const; + TQPoint viewportToContents( const TQPoint& ) const; + void enableClipper( bool y ); + + void setStaticBackground( bool y ); + bool hasStaticBackground() const; + + TQSize viewportSize( int, int ) const; + TQSize sizeHint() const; + TQSize minimumSizeHint() const; + + void removeChild(TQObject* child); + + bool isHorizontalSliderPressed(); + bool isVerticalSliderPressed(); + +#ifndef TQT_NO_DRAGANDDROP + virtual void setDragAutoScroll( bool b ); + bool dragAutoScroll() const; +#endif + +signals: + void contentsMoving(int x, int y); + void horizontalSliderPressed(); + void horizontalSliderReleased(); + void verticalSliderPressed(); + void verticalSliderReleased(); + +public slots: + virtual void resizeContents( int w, int h ); + void scrollBy( int dx, int dy ); + virtual void setContentsPos( int x, int y ); + void ensureVisible(int x, int y); + void ensureVisible(int x, int y, int xmargin, int ymargin); + void center(int x, int y); + void center(int x, int y, float xmargin, float ymargin); + + void updateScrollBars(); // ### virtual in 4.0 + void setEnabled( bool enable ); + +protected: + virtual void drawContents(TQPainter*, int cx, int cy, int cw, int ch); + virtual void drawContentsOffset(TQPainter*, int ox, int oy, + int cx, int cy, int cw, int ch); + + + virtual void contentsMousePressEvent( TQMouseEvent* ); + virtual void contentsMouseReleaseEvent( TQMouseEvent* ); + virtual void contentsMouseDoubleClickEvent( TQMouseEvent* ); + virtual void contentsMouseMoveEvent( TQMouseEvent* ); +#ifndef TQT_NO_DRAGANDDROP + virtual void contentsDragEnterEvent( TQDragEnterEvent * ); + virtual void contentsDragMoveEvent( TQDragMoveEvent * ); + virtual void contentsDragLeaveEvent( TQDragLeaveEvent * ); + virtual void contentsDropEvent( TQDropEvent * ); +#endif +#ifndef TQT_NO_WHEELEVENT + virtual void contentsWheelEvent( TQWheelEvent * ); +#endif + virtual void contentsContextMenuEvent( TQContextMenuEvent * ); + + + virtual void viewportPaintEvent( TQPaintEvent* ); + virtual void viewportResizeEvent( TQResizeEvent* ); + virtual void viewportMousePressEvent( TQMouseEvent* ); + virtual void viewportMouseReleaseEvent( TQMouseEvent* ); + virtual void viewportMouseDoubleClickEvent( TQMouseEvent* ); + virtual void viewportMouseMoveEvent( TQMouseEvent* ); +#ifndef TQT_NO_DRAGANDDROP + virtual void viewportDragEnterEvent( TQDragEnterEvent * ); + virtual void viewportDragMoveEvent( TQDragMoveEvent * ); + virtual void viewportDragLeaveEvent( TQDragLeaveEvent * ); + virtual void viewportDropEvent( TQDropEvent * ); +#endif +#ifndef TQT_NO_WHEELEVENT + virtual void viewportWheelEvent( TQWheelEvent * ); +#endif + virtual void viewportContextMenuEvent( TQContextMenuEvent * ); + + void frameChanged(); + + virtual void setMargins(int left, int top, int right, int bottom); + int leftMargin() const; + int topMargin() const; + int rightMargin() const; + int bottomMargin() const; + + bool focusNextPrevChild( bool next ); + + virtual void setHBarGeometry(TQScrollBar& hbar, int x, int y, int w, int h); + virtual void setVBarGeometry(TQScrollBar& vbar, int x, int y, int w, int h); + + void resizeEvent(TQResizeEvent*); + void mousePressEvent( TQMouseEvent * ); + void mouseReleaseEvent( TQMouseEvent * ); + void mouseDoubleClickEvent( TQMouseEvent * ); + void mouseMoveEvent( TQMouseEvent * ); +#ifndef TQT_NO_WHEELEVENT + void wheelEvent( TQWheelEvent * ); +#endif + void contextMenuEvent( TQContextMenuEvent * ); + bool eventFilter( TQObject *, TQEvent *e ); + + void setCachedSizeHint( const TQSize &sh ) const; + TQSize cachedSizeHint() const; + void fontChange( const TQFont & ); + +private: + void drawContents( TQPainter* ); + void moveContents(int x, int y); + + TQScrollViewData* d; + +private slots: + void hslide(int); + void vslide(int); + void hbarIsPressed(); + void hbarIsReleased(); + void vbarIsPressed(); + void vbarIsReleased(); +#ifndef TQT_NO_DRAGANDDROP + void doDragAutoScroll(); + void startDragAutoScroll(); + void stopDragAutoScroll(); +#endif + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQScrollView( const TQScrollView & ); + TQScrollView &operator=( const TQScrollView & ); +#endif + void changeFrameRect(const TQRect&); + +public: + void disableSizeHintCaching(); + +}; + +#endif // TQT_NO_SCROLLVIEW + +#endif // TQSCROLLVIEW_H diff --git a/src/widgets/tqslider.cpp b/src/widgets/tqslider.cpp new file mode 100644 index 000000000..98d61b68d --- /dev/null +++ b/src/widgets/tqslider.cpp @@ -0,0 +1,924 @@ +/**************************************************************************** +** +** Implementation of TQSlider class +** +** Created : 961019 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqslider.h" +#ifndef TQT_NO_SLIDER +#include "tqpainter.h" +#include "ntqdrawutil.h" +#include "tqtimer.h" +#include "tqbitmap.h" +#include "ntqapplication.h" +#include "tqstyle.h" +#if defined(QT_ACCESSIBILITY_SUPPORT) +#include "ntqaccessible.h" +#endif + +static const int thresholdTime = 300; +static const int repeatTime = 100; + +struct TQSliderPrivate +{ + // ### move these to TQSlider in TQt 4.0 + int sliderStartVal; + TQSliderPrivate() : sliderStartVal( 0 ) { } +}; + + +/*! + \class TQSlider + \brief The TQSlider widget provides a vertical or horizontal slider. + + \ingroup basic + \mainclass + + The slider is the classic widget for controlling a bounded value. + It lets the user move a slider along a horizontal or vertical + groove and translates the slider's position into an integer value + within the legal range. + + TQSlider inherits TQRangeControl, which provides the "integer" side + of the slider. setRange() and value() are likely to be used by + practically all slider users; see the \l TQRangeControl + documentation for information about the many other functions that + class provides. + + The main functions offered by the slider itself are tickmark and + orientation control; you can use setTickmarks() to indicate where + you want the tickmarks to be, setTickInterval() to indicate how + many of them you want and setOrientation() to indicate whether the + slider is to be horizontal or vertical. + + A slider accepts focus on Tab and uses the mouse wheel and a + suitable keyboard interface. + + + + \important setRange + + \sa TQScrollBar TQSpinBox + \link guibooks.html#fowler GUI Design Handbook: Slider\endlink +*/ + + +/*! + \enum TQSlider::TickSetting + + This enum specifies where the tickmarks are to be drawn relative + to the slider's groove and the handle the user moves. + + \value NoMarks do not draw any tickmarks. + \value Both draw tickmarks on both sides of the groove. + \value Above draw tickmarks above the (horizontal) slider + \value Below draw tickmarks below the (horizontal) slider + \value Left draw tickmarks to the left of the (vertical) slider + \value Right draw tickmarks to the right of the (vertical) slider +*/ + + +/*! + Constructs a vertical slider. + + The \a parent and \a name arguments are sent on to the TQWidget + constructor. +*/ + +TQSlider::TQSlider( TQWidget *parent, const char *name ) + : TQWidget( parent, name ) +{ + orient = Vertical; + init(); +} + +/*! + Constructs a slider. + + The \a orientation must be \l TQt::Vertical or \l TQt::Horizontal. + + The \a parent and \a name arguments are sent on to the TQWidget + constructor. +*/ + +TQSlider::TQSlider( Orientation orientation, TQWidget *parent, const char *name ) + : TQWidget( parent, name ) +{ + orient = orientation; + init(); +} + +/*! + Constructs a slider whose value can never be smaller than \a + minValue or greater than \a maxValue, whose page step size is \a + pageStep and whose value is initially \a value (which is + guaranteed to be in range using bound()). + + If \a orientation is \c TQt::Vertical the slider is vertical and if it + is \c TQt::Horizontal the slider is horizontal. + + The \a parent and \a name arguments are sent on to the TQWidget + constructor. +*/ + +TQSlider::TQSlider( int minValue, int maxValue, int pageStep, + int value, Orientation orientation, + TQWidget *parent, const char *name ) + : TQWidget( parent, name ), + TQRangeControl( minValue, maxValue, 1, pageStep, value ) +{ + orient = orientation; + init(); + sliderVal = value; +} + +/*! + Destructor. +*/ +TQSlider::~TQSlider() +{ + delete d; +} + +void TQSlider::init() +{ + d = new TQSliderPrivate; + timer = 0; + sliderPos = 0; + sliderVal = 0; + clickOffset = 0; + state = Idle; + track = TRUE; + ticks = NoMarks; + tickInt = 0; + setFocusPolicy( TabFocus ); + initTicks(); + + TQSizePolicy sp( TQSizePolicy::Expanding, TQSizePolicy::Fixed ); + if ( orient == Vertical ) + sp.transpose(); + setSizePolicy( sp ); + clearWState( WState_OwnSizePolicy ); +} + + +/* + Does what's needed when someone changes the tickmark status. +*/ + +void TQSlider::initTicks() +{ + tickOffset = style().pixelMetric( TQStyle::PM_SliderTickmarkOffset, this ); +} + + +/*! + \property TQSlider::tracking + \brief whether slider tracking is enabled + + If tracking is enabled (the default), the slider emits the + valueChanged() signal whenever the slider is being dragged. If + tracking is disabled, the slider emits the valueChanged() signal + when the user releases the mouse button (unless the value happens + to be the same as before). +*/ + +void TQSlider::setTracking( bool enable ) +{ + track = enable; +} + + +/*! + \fn void TQSlider::valueChanged( int value ) + + This signal is emitted when the slider value is changed, with the + new slider \a value as its argument. +*/ + +/*! + \fn void TQSlider::sliderPressed() + + This signal is emitted when the user presses the slider with the + mouse. +*/ + +/*! + \fn void TQSlider::sliderMoved( int value ) + + This signal is emitted when the slider is dragged, with the new + slider \a value as its argument. +*/ + +/*! + \fn void TQSlider::sliderReleased() + + This signal is emitted when the user releases the slider with the mouse. +*/ + +/* + Calculates slider position corresponding to value \a v. +*/ + +int TQSlider::positionFromValue( int v ) const +{ + int a = available(); + int x = TQRangeControl::positionFromValue( v, a ); + if ( orient == Horizontal && TQApplication::reverseLayout() ) + x = a - x; + return x; +} + +/* + Returns the available space in which the slider can move. +*/ + +int TQSlider::available() const +{ + return style().pixelMetric( TQStyle::PM_SliderSpaceAvailable, this ); +} + +/* + Calculates a value corresponding to slider position \a p. +*/ + +int TQSlider::valueFromPosition( int p ) const +{ + int a = available(); + int x = TQRangeControl::valueFromPosition( p, a ); + if ( orient == Horizontal && TQApplication::reverseLayout() ) + x = maxValue() + minValue() - x; + return x; +} + +/*! + Implements the virtual TQRangeControl function. +*/ + +void TQSlider::rangeChange() +{ + int newPos = positionFromValue( value() ); + if ( newPos != sliderPos ) { + reallyMoveSlider( newPos ); + } +} + +/*! + Implements the virtual TQRangeControl function. +*/ + +void TQSlider::valueChange() +{ + if ( sliderVal != value() ) { + int newPos = positionFromValue( value() ); + sliderVal = value(); + reallyMoveSlider( newPos ); + } + emit valueChanged(value()); +#if defined(QT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); +#endif +} + + +/*! + \reimp +*/ +void TQSlider::resizeEvent( TQResizeEvent * ) +{ + rangeChange(); + initTicks(); +} + + +/*! + Reimplements the virtual function TQWidget::setPalette(). + + Sets the background color to the mid color for Motif style sliders + using palette \a p. +*/ + +void TQSlider::setPalette( const TQPalette &p ) +{ + TQWidget::setPalette( p ); +} + + + +/*! + \property TQSlider::orientation + \brief the slider's orientation + + The orientation must be \l TQt::Vertical (the default) or \l + TQt::Horizontal. +*/ + +void TQSlider::setOrientation( Orientation orientation ) +{ + if ( orientation == orient ) + return; + + if ( !testWState( WState_OwnSizePolicy ) ) { + TQSizePolicy sp = sizePolicy(); + sp.transpose(); + setSizePolicy( sp ); + clearWState( WState_OwnSizePolicy ); + } + + orient = orientation; + + rangeChange(); + update(); +} + +/*! + \fn int TQSlider::sliderStart() const + + Returns the start position of the slider. +*/ + + +/*! + Returns the slider handle rectangle. (This is the visual marker + that the user can move.) +*/ + +TQRect TQSlider::sliderRect() const +{ + return style().querySubControlMetrics( TQStyle::CC_Slider, this, + TQStyle::SC_SliderHandle ); +} + +/* + Performs the actual moving of the slider. +*/ + +void TQSlider::reallyMoveSlider( int newPos ) +{ + TQRegion oldR(sliderRect()); + sliderPos = newPos; + TQRegion newR(sliderRect()); + + /* just the one repaint if no background */ + if (backgroundMode() == NoBackground) + repaint(newR | oldR, FALSE); + else { + repaint(oldR.subtract(newR)); + repaint(newR, FALSE); + } +} + + +/*! + \reimp +*/ +void TQSlider::paintEvent( TQPaintEvent * ) +{ + TQPainter p( this ); + + TQStyle::SFlags flags = TQStyle::Style_Default; + if (isEnabled()) + flags |= TQStyle::Style_Enabled; + if (hasFocus()) + flags |= TQStyle::Style_HasFocus; + if (hasMouse()) + flags |= TQStyle::Style_MouseOver; + + TQStyle::SCFlags sub = TQStyle::SC_SliderGroove | TQStyle::SC_SliderHandle; + if ( tickmarks() != NoMarks ) { + sub |= TQStyle::SC_SliderTickmarks; + } + + style().drawComplexControl( TQStyle::CC_Slider, &p, this, rect(), colorGroup(), + flags, sub, state == Dragging ? TQStyle::SC_SliderHandle : TQStyle::SC_None ); +} + + +/*! + \reimp +*/ +void TQSlider::mousePressEvent( TQMouseEvent *e ) +{ + int slideLength = style().pixelMetric( TQStyle::PM_SliderLength, this ); + resetState(); + d->sliderStartVal = sliderVal; + TQRect r = sliderRect(); + + if ( e->button() == RightButton ) + return; + + if ( r.contains( e->pos() ) ) { + state = Dragging; + clickOffset = (TQCOORD)( goodPart( e->pos() ) - sliderPos ); + emit sliderPressed(); + } else if ( e->button() == MidButton ) { + int pos = goodPart( e->pos() ); + moveSlider( pos - slideLength / 2 ); + state = Dragging; + clickOffset = slideLength / 2; + } else if ( ( orient == Horizontal && e->pos().x() < r.left() ) //### goodPart + || ( orient == Vertical && e->pos().y() < r.top() ) ) { + if ( orient == Horizontal && TQApplication::reverseLayout() ) { + state = TimingUp; + addPage(); + } else { + state = TimingDown; + subtractPage(); + } + if ( !timer ) + timer = new TQTimer( this ); + connect( timer, TQ_SIGNAL(timeout()), TQ_SLOT(repeatTimeout()) ); + timer->start( thresholdTime, TRUE ); + } else if ( ( orient == Horizontal && e->pos().x() > r.right() ) //### goodPart + || ( orient == Vertical && e->pos().y() > r.bottom() ) ) { + if ( orient == Horizontal && TQApplication::reverseLayout() ) { + state = TimingDown; + subtractPage(); + } else { + state = TimingUp; + addPage(); + } + if ( !timer ) + timer = new TQTimer( this ); + connect( timer, TQ_SIGNAL(timeout()), TQ_SLOT(repeatTimeout()) ); + timer->start( thresholdTime, TRUE ); + } + update( sliderRect() ); +} + +/*! + \reimp +*/ +void TQSlider::mouseMoveEvent( TQMouseEvent *e ) +{ + if ( state != Dragging ) + return; + + TQRect r = rect(); + int m = style().pixelMetric( TQStyle::PM_MaximumDragDistance, + this ); + if ( m >= 0 ) { + if ( orientation() == Horizontal ) + r.setRect( r.x() - m, r.y() - 2*m/3, + r.width() + 2*m, r.height() + 3*m ); + else + r.setRect( r.x() - 2*m/3, r.y() - m, + r.width() + 3*m, r.height() + 2*m ); + if ( !r.contains( e->pos() ) ) { + moveSlider( positionFromValue(d->sliderStartVal) ); + return; + } + } + + int pos = goodPart( e->pos() ); + moveSlider( pos - clickOffset ); +} + +/*! + \reimp +*/ +#ifndef TQT_NO_WHEELEVENT +void TQSlider::wheelEvent( TQWheelEvent * e ) +{ + if ( e->orientation() != orientation() && !rect().contains(e->pos()) ) + return; + + static float offset = 0; + static TQSlider* offset_owner = 0; + if (offset_owner != this){ + offset_owner = this; + offset = 0; + } + offset += -e->delta()*TQMAX(pageStep(),lineStep())/120; + if (TQABS(offset)<1) + return; + setValue( value() + int(offset) ); + offset -= int(offset); + e->accept(); +} +#endif + +/*! + \reimp +*/ +void TQSlider::mouseReleaseEvent( TQMouseEvent * ) +{ + resetState(); + update( sliderRect() ); +} + +/*! + \reimp +*/ +void TQSlider::focusInEvent( TQFocusEvent * e) +{ + TQWidget::focusInEvent( e ); +} + +/*! + \reimp +*/ +void TQSlider::focusOutEvent( TQFocusEvent * e ) +{ + TQWidget::focusOutEvent( e ); +} + +/*! + Moves the left (or top) edge of the slider to position \a pos. The + slider is actually moved to the step position nearest the given \a + pos. +*/ + +void TQSlider::moveSlider( int pos ) +{ + int a = available(); + int newPos = TQMIN( a, TQMAX( 0, pos ) ); + int newVal = valueFromPosition( newPos ); + if (style().styleHint(TQStyle::SH_Slider_SnapToValue, this)) + newPos = positionFromValue( newVal ); + if ( sliderPos != newPos ) + reallyMoveSlider( newPos ); + if ( sliderVal != newVal ) { + sliderVal = newVal; + emit sliderMoved( sliderVal ); + } + if ( tracking() && sliderVal != value() ) + setValue( sliderVal ); + +} + + +/* + Resets all state information and stops the timer. +*/ + +void TQSlider::resetState() +{ + if ( timer ) { + timer->stop(); + timer->disconnect(); + } + switch ( state ) { + case TimingUp: + case TimingDown: + break; + case Dragging: { + setValue( valueFromPosition( sliderPos ) ); + emit sliderReleased(); + break; + } + case Idle: + break; + default: + tqWarning("TQSlider: (%s) in wrong state", name( "unnamed" ) ); + } + state = Idle; +} + + +/*! + \reimp +*/ +void TQSlider::keyPressEvent( TQKeyEvent *e ) +{ + bool sloppy = bool(style().styleHint(TQStyle::SH_Slider_SloppyKeyEvents, this)); + switch ( e->key() ) { + case Key_Left: + if ( sloppy || orient == Horizontal ) { + if (TQApplication::reverseLayout()) + addLine(); + else + subtractLine(); + } + break; + case Key_Right: + if ( sloppy || orient == Horizontal ) { + if (TQApplication::reverseLayout()) + subtractLine(); + else + addLine(); + } + break; + case Key_Up: + if ( sloppy || orient == Vertical ) + subtractLine(); + break; + case Key_Down: + if ( sloppy || orient == Vertical ) + addLine(); + break; + case Key_Prior: + subtractPage(); + break; + case Key_Next: + addPage(); + break; + case Key_Home: + setValue( minValue() ); + break; + case Key_End: + setValue( maxValue() ); + break; + default: + e->ignore(); + return; + } +} + +void TQSlider::setValue( int value ) +{ + TQRangeControl::setValue( value ); +#if defined(QT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); +#endif +} + + +/*! \reimp +*/ + +void TQSlider::addLine() +{ + TQRangeControl::addLine(); +} + +/*! \reimp +*/ + +void TQSlider::subtractLine() +{ + TQRangeControl::subtractLine(); +} + +/*! + Moves the slider one pageStep() up or right. +*/ + +void TQSlider::addStep() +{ + addPage(); +} + + +/*! + Moves the slider one pageStep() down or left. +*/ + +void TQSlider::subtractStep() +{ + subtractPage(); +} + + +/* + Waits for autorepeat. +*/ + +void TQSlider::repeatTimeout() +{ + Q_ASSERT( timer ); + timer->disconnect(); + if ( state == TimingDown ) + connect( timer, TQ_SIGNAL(timeout()), TQ_SLOT(subtractStep()) ); + else if ( state == TimingUp ) + connect( timer, TQ_SIGNAL(timeout()), TQ_SLOT(addStep()) ); + timer->start( repeatTime, FALSE ); +} + + +/* + Returns the relevant dimension of \a p. +*/ + +int TQSlider::goodPart( const TQPoint &p ) const +{ + return (orient == Horizontal) ? p.x() : p.y(); +} + +/*! + \reimp +*/ +TQSize TQSlider::sizeHint() const +{ + constPolish(); + const int length = 84, tickSpace = 5; + int thick = style().pixelMetric( TQStyle::PM_SliderThickness, this ); + if ( ticks & Above ) + thick += tickSpace; + if ( ticks & Below ) + thick += tickSpace; + int w = thick, h = length; + if ( orient == Horizontal ) { + w = length; + h = thick; + } + return (style().sizeFromContents(TQStyle::CT_Slider, this, + TQSize(w, h)).expandedTo(TQApplication::globalStrut())); +} + + + +/*! + \reimp +*/ + +TQSize TQSlider::minimumSizeHint() const +{ + TQSize s = sizeHint(); + int length = style().pixelMetric(TQStyle::PM_SliderLength, this); + if ( orient == Horizontal ) + s.setWidth( length ); + else + s.setHeight( length ); + + return s; +} + +/*! \fn void TQSlider::setSizePolicy( TQSizePolicy::SizeType, TQSizePolicy::SizeType, bool ) + \reimp +*/ + +/*! \reimp */ +void TQSlider::setSizePolicy( TQSizePolicy sp ) +{ + // ## remove 4.0 + TQWidget::setSizePolicy( sp ); +} + +/*! \reimp */ +TQSizePolicy TQSlider::sizePolicy() const +{ + // ### 4.0 remove this reimplementation + return TQWidget::sizePolicy(); +} + +/*! + \property TQSlider::tickmarks + \brief the tickmark settings for this slider + + The valid values are in \l{TQSlider::TickSetting}. The default is + \c NoMarks. + + \sa tickInterval +*/ + +void TQSlider::setTickmarks( TickSetting s ) +{ + ticks = s; + initTicks(); + update(); +} + + +/*! + \property TQSlider::tickInterval + \brief the interval between tickmarks + + This is a value interval, not a pixel interval. If it is 0, the + slider will choose between lineStep() and pageStep(). The initial + value of tickInterval is 0. + + \sa TQRangeControl::lineStep(), TQRangeControl::pageStep() +*/ + +void TQSlider::setTickInterval( int i ) +{ + tickInt = TQMAX( 0, i ); + update(); +} + + +/*! + \reimp +*/ +void TQSlider::styleChange( TQStyle& old ) +{ + TQWidget::styleChange( old ); +} + +/*! + \property TQSlider::minValue + \brief the current minimum value of the slider + + When setting this property, the \l TQSlider::maxValue is adjusted, + if necessary, to ensure that the range remains valid. + + \sa setRange() +*/ +int TQSlider::minValue() const +{ + return TQRangeControl::minValue(); +} + +/*! + \property TQSlider::maxValue + \brief the current maximum value of the slider + + When setting this property, the \l TQSlider::minValue is adjusted, + if necessary, to ensure that the range remains valid. + + \sa setRange() +*/ +int TQSlider::maxValue() const +{ + return TQRangeControl::maxValue(); +} + +void TQSlider::setMinValue( int minVal ) +{ + TQRangeControl::setMinValue( minVal ); +} + +void TQSlider::setMaxValue( int maxVal ) +{ + TQRangeControl::setMaxValue( maxVal ); +} + +/*! + \property TQSlider::lineStep + \brief the current line step + + When setting lineStep, the virtual stepChange() function will be + called if the new line step is different from the previous + setting. + + \sa setSteps() TQRangeControl::pageStep() setRange() +*/ +int TQSlider::lineStep() const +{ + return TQRangeControl::lineStep(); +} + +/*! + \property TQSlider::pageStep + \brief the current page step + + When setting pageStep, the virtual stepChange() function will be + called if the new page step is different from the previous + setting. + + \sa TQRangeControl::setSteps() setLineStep() setRange() +*/ + +int TQSlider::pageStep() const +{ + return TQRangeControl::pageStep(); +} + +void TQSlider::setLineStep( int i ) +{ + setSteps( i, pageStep() ); +} + +void TQSlider::setPageStep( int i ) +{ + setSteps( lineStep(), i ); +} + +/*! + \property TQSlider::value + \brief the current slider value + + \sa TQRangeControl::value() prevValue() +*/ + +int TQSlider::value() const +{ + return TQRangeControl::value(); +} + +#endif diff --git a/src/widgets/tqslider.h b/src/widgets/tqslider.h new file mode 100644 index 000000000..af60245e3 --- /dev/null +++ b/src/widgets/tqslider.h @@ -0,0 +1,199 @@ +/**************************************************************************** +** +** Definition of TQSlider class +** +** Created : 961019 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQSLIDER_H +#define TQSLIDER_H + +#ifndef QT_H +#include "tqwidget.h" +#include "ntqrangecontrol.h" +#endif // QT_H + +#ifndef TQT_NO_SLIDER + +struct TQSliderPrivate; + +class TQTimer; + +class TQ_EXPORT TQSlider : public TQWidget, public TQRangeControl +{ + TQ_OBJECT + TQ_ENUMS( TickSetting ) + TQ_PROPERTY( int minValue READ minValue WRITE setMinValue ) + TQ_PROPERTY( int maxValue READ maxValue WRITE setMaxValue ) + TQ_PROPERTY( int lineStep READ lineStep WRITE setLineStep ) + TQ_PROPERTY( int pageStep READ pageStep WRITE setPageStep ) + TQ_PROPERTY( int value READ value WRITE setValue ) + TQ_PROPERTY( bool tracking READ tracking WRITE setTracking ) + TQ_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) + TQ_PROPERTY( TickSetting tickmarks READ tickmarks WRITE setTickmarks ) + TQ_PROPERTY( int tickInterval READ tickInterval WRITE setTickInterval ) + +public: + enum TickSetting { NoMarks = 0, Above = 1, Left = Above, + Below = 2, Right = Below, Both = 3 }; + + TQSlider( TQWidget *parent, const char* name = 0 ); + TQSlider( Orientation, TQWidget *parent, const char* name = 0 ); + TQSlider( int minValue, int maxValue, int pageStep, int value, Orientation, + TQWidget *parent, const char* name = 0 ); + ~TQSlider(); + + virtual void setOrientation( Orientation ); + Orientation orientation() const; + virtual void setTracking( bool enable ); + bool tracking() const; + virtual void setPalette( const TQPalette & ); + + int sliderStart() const; + TQRect sliderRect() const; + TQSize sizeHint() const; + void setSizePolicy( TQSizePolicy sp ); + void setSizePolicy( TQSizePolicy::SizeType hor, TQSizePolicy::SizeType ver, bool hfw = FALSE ); + + TQSizePolicy sizePolicy() const; + TQSize minimumSizeHint() const; + + virtual void setTickmarks( TickSetting ); + TickSetting tickmarks() const { return ticks; } + + virtual void setTickInterval( int ); + int tickInterval() const { return tickInt; } + + int minValue() const; + int maxValue() const; + void setMinValue( int ); + void setMaxValue( int ); + int lineStep() const; + int pageStep() const; + void setLineStep( int ); + void setPageStep( int ); + int value() const; + +public slots: + virtual void setValue( int ); + void addStep(); + void subtractStep(); + void addLine(); + void subtractLine(); + +signals: + void valueChanged( int value ); + void sliderPressed(); + void sliderMoved( int value ); + void sliderReleased(); + +protected: + void resizeEvent( TQResizeEvent * ); + void paintEvent( TQPaintEvent * ); + + void keyPressEvent( TQKeyEvent * ); + void mousePressEvent( TQMouseEvent * ); + void mouseReleaseEvent( TQMouseEvent * ); + void mouseMoveEvent( TQMouseEvent * ); +#ifndef TQT_NO_WHEELEVENT + void wheelEvent( TQWheelEvent * ); +#endif + void focusInEvent( TQFocusEvent *e ); + void focusOutEvent( TQFocusEvent *e ); + + void styleChange( TQStyle& ); + + void valueChange(); + void rangeChange(); + +private slots: + void repeatTimeout(); + +private: + enum State { Idle, Dragging, TimingUp, TimingDown }; + + void init(); + int positionFromValue( int ) const; + int valueFromPosition( int ) const; + void moveSlider( int ); + void reallyMoveSlider( int ); + void resetState(); + int available() const; + int goodPart( const TQPoint& ) const; + void initTicks(); + + TQSliderPrivate *d; + TQTimer *timer; + TQCOORD sliderPos; + int sliderVal; + TQCOORD clickOffset; + State state; + bool track; + TQCOORD tickOffset; + TickSetting ticks; + int tickInt; + Orientation orient; + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQSlider( const TQSlider & ); + TQSlider &operator=( const TQSlider & ); +#endif +}; + +inline bool TQSlider::tracking() const +{ + return track; +} + +inline TQSlider::Orientation TQSlider::orientation() const +{ + return orient; +} + +inline int TQSlider::sliderStart() const +{ + return sliderPos; +} + +inline void TQSlider::setSizePolicy( TQSizePolicy::SizeType hor, TQSizePolicy::SizeType ver, bool hfw ) +{ + TQWidget::setSizePolicy( hor, ver, hfw ); +} + +#endif // TQT_NO_SLIDER + +#endif // TQSLIDER_H diff --git a/src/widgets/tqspinbox.cpp b/src/widgets/tqspinbox.cpp new file mode 100644 index 000000000..ff336035d --- /dev/null +++ b/src/widgets/tqspinbox.cpp @@ -0,0 +1,1116 @@ +/**************************************************************************** +** +** Implementation of TQSpinBox widget class +** +** Created : 970101 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqspinbox.h" +#ifndef TQT_NO_SPINBOX + +#include "ntqcursor.h" +#include "tqpushbutton.h" +#include "tqpainter.h" +#include "tqbitmap.h" +#include "tqlineedit.h" +#include "ntqvalidator.h" +#include "tqpixmapcache.h" +#include "ntqapplication.h" +#include "tqstyle.h" +#if defined(QT_ACCESSIBILITY_SUPPORT) +#include "ntqaccessible.h" +#endif + +static bool sumOutOfRange(int current, int add) +{ + if (add > 0 && INT_MAX - add < current) { + return true; + } + if (add < 0 && INT_MIN - add > current) { + return true; + } + return false; +} + +class TQSpinBoxPrivate +{ +public: + TQSpinBoxPrivate() {} + TQSpinWidget* controls; + uint selreq : 1; +}; + +class TQSpinBoxValidator : public TQIntValidator +{ +public: + TQSpinBoxValidator( TQSpinBox *sb, const char *name ) + : TQIntValidator( sb, name ), spinBox( sb ) { } + + virtual State validate( TQString& str, int& pos ) const; + +private: + TQSpinBox *spinBox; +}; + +TQValidator::State TQSpinBoxValidator::validate( TQString& str, int& pos ) const +{ + TQString pref = spinBox->prefix(); + TQString suff = spinBox->suffix(); + TQString suffStriped = suff.stripWhiteSpace(); + uint overhead = pref.length() + suff.length(); + State state = Invalid; + + ((TQIntValidator *) this)->setRange( spinBox->minValue(), + spinBox->maxValue() ); + if ( overhead == 0 ) { + state = TQIntValidator::validate( str, pos ); + } else { + bool stripedVersion = FALSE; + if ( str.length() >= overhead && str.startsWith(pref) + && (str.endsWith(suff) + || (stripedVersion = str.endsWith(suffStriped))) ) { + if ( stripedVersion ) + overhead = pref.length() + suffStriped.length(); + TQString core = str.mid( pref.length(), str.length() - overhead ); + int corePos = pos - pref.length(); + state = TQIntValidator::validate( core, corePos ); + pos = corePos + pref.length(); + str.replace( pref.length(), str.length() - overhead, core ); + } else { + state = TQIntValidator::validate( str, pos ); + if ( state == Invalid ) { + // stripWhiteSpace(), cf. TQSpinBox::interpretText() + TQString special = spinBox->specialValueText().stripWhiteSpace(); + TQString candidate = str.stripWhiteSpace(); + + if ( special.startsWith(candidate) ) { + if ( candidate.length() == special.length() ) { + state = Acceptable; + } else { + state = Intermediate; + } + } + } + } + } + return state; +} + +/*! + \class TQSpinBox + \brief The TQSpinBox class provides a spin box widget (spin button). + + \ingroup basic + \mainclass + + TQSpinBox allows the user to choose a value either by clicking the + up/down buttons to increase/decrease the value currently displayed + or by typing the value directly into the spin box. If the value is + entered directly into the spin box, Enter (or Return) must be + pressed to apply the new value. The value is usually an integer. + + Every time the value changes TQSpinBox emits the valueChanged() + signal. The current value can be fetched with value() and set + with setValue(). + + The spin box keeps the value within a numeric range, and to + multiples of the lineStep() size (see TQRangeControl for details). + Clicking the up/down buttons or using the keyboard accelerator's + up and down arrows will increase or decrease the current value in + steps of size lineStep(). The minimum and maximum value and the + step size can be set using one of the constructors, and can be + changed later with setMinValue(), setMaxValue() and setLineStep(). + + Most spin boxes are directional, but TQSpinBox can also operate as + a circular spin box, i.e. if the range is 0-99 and the current + value is 99, clicking "up" will give 0. Use setWrapping() if you + want circular behavior. + + The displayed value can be prepended and appended with arbitrary + strings indicating, for example, currency or the unit of + measurement. See setPrefix() and setSuffix(). The text in the spin + box is retrieved with text() (which includes any prefix() and + suffix()), or with cleanText() (which has no prefix(), no suffix() + and no leading or trailing whitespace). currentValueText() returns + the spin box's current value as text. + + Normally the spin box displays up and down arrows in the buttons. + You can use setButtonSymbols() to change the display to show + + and - symbols if you prefer. In either case the up + and down arrow keys work as expected. + + It is often desirable to give the user a special (often default) + choice in addition to the range of numeric values. See + setSpecialValueText() for how to do this with TQSpinBox. + + The default \l TQWidget::focusPolicy() is StrongFocus. + + If using prefix(), suffix() and specialValueText() don't provide + enough control, you can ignore them and subclass TQSpinBox instead. + + TQSpinBox can easily be subclassed to allow the user to input + things other than an integer value as long as the allowed input + can be mapped to a range of integers. This can be done by + overriding the virtual functions mapValueToText() and + mapTextToValue(), and setting another suitable validator using + setValidator(). + + For example, these functions could be changed so that the user + provided values from 0.0 to 10.0, or -1 to signify 'Auto', while + the range of integers used inside the program would be -1 to 100: + + \code + class MySpinBox : public TQSpinBox + { + TQ_OBJECT + public: + ... + + TQString mapValueToText( int value ) + { + if ( value == -1 ) // special case + return TQString( "Auto" ); + + return TQString( "%1.%2" ) // 0.0 to 10.0 + .arg( value / 10 ).arg( value % 10 ); + } + + int mapTextToValue( bool *ok ) + { + if ( text() == "Auto" ) // special case + return -1; + + return (int) ( 10 * text().toFloat() ); // 0 to 100 + } + }; + \endcode + + + + \sa TQScrollBar TQSlider + \link guibooks.html#fowler GUI Design Handbook: Spin Box \endlink +*/ + + +/*! + Constructs a spin box with the default TQRangeControl range and + step values. It is called \a name and has parent \a parent. + + \sa minValue(), maxValue(), setRange(), lineStep(), setSteps() +*/ + +TQSpinBox::TQSpinBox( TQWidget * parent , const char *name ) + : TQWidget( parent, name, WNoAutoErase ), + TQRangeControl() +{ + initSpinBox(); +} + + +/*! + Constructs a spin box that allows values from \a minValue to \a + maxValue inclusive, with step amount \a step. The value is + initially set to \a minValue. + + The spin box is called \a name and has parent \a parent. + + \sa minValue(), maxValue(), setRange(), lineStep(), setSteps() +*/ + +TQSpinBox::TQSpinBox( int minValue, int maxValue, int step, TQWidget* parent, + const char* name ) + : TQWidget( parent, name, WNoAutoErase ), + TQRangeControl( minValue, maxValue, step, step, minValue ) +{ + initSpinBox(); +} + +/* + \internal Initialization. +*/ + +void TQSpinBox::initSpinBox() +{ + d = new TQSpinBoxPrivate; + + d->controls = new TQSpinWidget( this, "controls" ); + connect( d->controls, TQ_SIGNAL( stepUpPressed() ), TQ_SLOT( stepUp() ) ); + connect( d->controls, TQ_SIGNAL( stepDownPressed() ), TQ_SLOT( stepDown() ) ); + + wrap = FALSE; + edited = FALSE; + d->selreq = FALSE; + + validate = new TQSpinBoxValidator( this, "validator" ); + vi = new TQLineEdit( this, "qt_spinbox_edit" ); + d->controls->setEditWidget( vi ); + vi->setValidator( validate ); + vi->installEventFilter( this ); + vi->setFrame( FALSE ); + setFocusProxy( vi ); + + setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed ) ); + setBackgroundMode( PaletteBackground, PaletteBase ); + + updateDisplay(); + + connect( vi, TQ_SIGNAL(textChanged(const TQString&)), TQ_SLOT(textChanged()) ); +} + +/*! + Destroys the spin box, freeing all memory and other resources. +*/ + +TQSpinBox::~TQSpinBox() +{ + delete d; +} + + +/*! + \property TQSpinBox::text + \brief the spin box's text, including any prefix() and suffix() + + There is no default text. + + \sa value() +*/ + +TQString TQSpinBox::text() const +{ + return vi->text(); +} + + + +/*! + \property TQSpinBox::cleanText + \brief the spin box's text with no prefix(), suffix() or leading + or trailing whitespace. + + \sa text, prefix, suffix +*/ + +TQString TQSpinBox::cleanText() const +{ + TQString s = TQString(text()).stripWhiteSpace(); + if ( !prefix().isEmpty() ) { + TQString px = TQString(prefix()).stripWhiteSpace(); + int len = px.length(); + if ( len && s.left(len) == px ) // Remove _only_ if it is the prefix + s.remove( (uint)0, len ); + } + if ( !suffix().isEmpty() ) { + TQString sx = TQString(suffix()).stripWhiteSpace(); + int len = sx.length(); + if ( len && s.right(len) == sx ) // Remove _only_ if it is the suffix + s.truncate( s.length() - len ); + } + return s.stripWhiteSpace(); +} + + +/*! + \property TQSpinBox::specialValueText + \brief the special-value text + + If set, the spin box will display this text instead of a numeric + value whenever the current value is equal to minVal(). Typical use + is to indicate that this choice has a special (default) meaning. + + For example, if your spin box allows the user to choose the margin + width in a print dialog and your application is able to + automatically choose a good margin width, you can set up the spin + box like this: + \code + TQSpinBox marginBox( -1, 20, 1, parent, "marginBox" ); + marginBox->setSuffix( " mm" ); + marginBox->setSpecialValueText( "Auto" ); + \endcode + The user will then be able to choose a margin width from 0-20 + millimeters or select "Auto" to leave it to the application to + choose. Your code must then interpret the spin box value of -1 as + the user requesting automatic margin width. + + All values are displayed with the prefix() and suffix() (if set), + \e except for the special value, which only shows the special + value text. + + To turn off the special-value text display, call this function + with an empty string. The default is no special-value text, i.e. + the numeric value is shown as usual. + + If no special-value text is set, specialValueText() returns + TQString::null. +*/ + +void TQSpinBox::setSpecialValueText( const TQString &text ) +{ + specText = text; + updateDisplay(); +} + + +TQString TQSpinBox::specialValueText() const +{ + if ( specText.isEmpty() ) + return TQString::null; + else + return specText; +} + + +/*! + \property TQSpinBox::prefix + \brief the spin box's prefix + + The prefix is prepended to the start of the displayed value. + Typical use is to display a unit of measurement or a currency + symbol. For example: + + \code + sb->setPrefix( "$" ); + \endcode + + To turn off the prefix display, set this property to an empty + string. The default is no prefix. The prefix is not displayed for + the minValue() if specialValueText() is not empty. + + If no prefix is set, prefix() returns TQString::null. + + \sa suffix() +*/ + +void TQSpinBox::setPrefix( const TQString &text ) +{ + pfix = text; + updateDisplay(); +} + + +TQString TQSpinBox::prefix() const +{ + if ( pfix.isEmpty() ) + return TQString::null; + else + return pfix; +} + + +/*! + \property TQSpinBox::suffix + \brief the suffix of the spin box + + The suffix is appended to the end of the displayed value. Typical + use is to display a unit of measurement or a currency symbol. For + example: + + \code + sb->setSuffix( " km" ); + \endcode + + To turn off the suffix display, set this property to an empty + string. The default is no suffix. The suffix is not displayed for + the minValue() if specialValueText() is not empty. + + If no suffix is set, suffix() returns a TQString::null. + + \sa prefix() +*/ + +void TQSpinBox::setSuffix( const TQString &text ) +{ + sfix = text; + updateDisplay(); +} + +TQString TQSpinBox::suffix() const +{ + if ( sfix.isEmpty() ) + return TQString::null; + else + return sfix; +} + + +/*! + \property TQSpinBox::wrapping + \brief whether it is possible to step the value from the highest + value to the lowest value and vice versa + + By default, wrapping is turned off. + + If you have a range of 0..100 and wrapping is off when the user + reaches 100 and presses the Up Arrow nothing will happen; but if + wrapping is on the value will change from 100 to 0, then to 1, + etc. When wrapping is on, navigating past the highest value takes + you to the lowest and vice versa. + + \sa minValue, maxValue, setRange() +*/ + +void TQSpinBox::setWrapping( bool on ) +{ + wrap = on; + updateDisplay(); +} + +bool TQSpinBox::wrapping() const +{ + return wrap; +} + +/*! + \reimp +*/ +TQSize TQSpinBox::sizeHint() const +{ + constPolish(); + TQSize sz = vi->sizeHint(); + int h = sz.height(); + TQFontMetrics fm( font() ); + int w = 35; + int wx = fm.width( ' ' )*2; + TQString s; + s = prefix() + ( (TQSpinBox*)this )->mapValueToText( minValue() ) + suffix(); + w = TQMAX( w, fm.width( s ) + wx); + s = prefix() + ( (TQSpinBox*)this )->mapValueToText( maxValue() ) + suffix(); + w = TQMAX(w, fm.width( s ) + wx ); + if ( !specialValueText().isEmpty() ) { + s = specialValueText(); + w = TQMAX( w, fm.width( s ) + wx ); + } + return style().sizeFromContents(TQStyle::CT_SpinBox, this, + TQSize( w + d->controls->downRect().width(), + h + style().pixelMetric( TQStyle::PM_DefaultFrameWidth ) * 2). + expandedTo( TQApplication::globalStrut() )); +} + + +/*! + \reimp +*/ +TQSize TQSpinBox::minimumSizeHint() const +{ + int w = vi->minimumSizeHint().width() + d->controls->downRect().width(); + int h = TQMAX( vi->minimumSizeHint().height(), d->controls->minimumSizeHint().height() ); + return TQSize( w, h ); +} + +// Does the layout of the lineedit and the buttons + +void TQSpinBox::arrangeWidgets() +{ + d->controls->arrange(); +} + +/*! + \property TQSpinBox::value + \brief the value of the spin box + + \sa TQRangeControl::setValue() +*/ + +void TQSpinBox::setValue( int value ) +{ + edited = FALSE; // we ignore anything entered and not yet interpreted + TQRangeControl::setValue( value ); + updateDisplay(); +} + +int TQSpinBox::value() const +{ + TQSpinBox * that = (TQSpinBox *) this; + if ( edited ) { + that->edited = FALSE; // avoid recursion + that->interpretText(); + } + return TQRangeControl::value(); +} + + +/*! + Increases the spin box's value by one lineStep(), wrapping as + necessary if wrapping() is TRUE. This is the same as clicking on + the pointing-up button and can be used for keyboard accelerators, + for example. + + \sa stepDown(), addLine(), lineStep(), setSteps(), setValue(), value() +*/ + +void TQSpinBox::stepUp() +{ + if ( edited ) + interpretText(); + if ( wrapping() && ( value()+lineStep() > maxValue() || sumOutOfRange(value(), lineStep() ) ) ) { + setValue( minValue() ); + } else { + addLine(); + } +} + + +/*! + Decreases the spin box's value one lineStep(), wrapping as + necessary if wrapping() is TRUE. This is the same as clicking on + the pointing-down button and can be used for keyboard + accelerators, for example. + + \sa stepUp(), subtractLine(), lineStep(), setSteps(), setValue(), value() +*/ + +void TQSpinBox::stepDown() +{ + if ( edited ) + interpretText(); + if ( wrapping() && ( value()-lineStep() < minValue() || sumOutOfRange(value(), -lineStep() ) ) ) { + setValue( maxValue() ); + } else { + subtractLine(); + } +} + + +/*! + \fn void TQSpinBox::valueChanged( int value ) + + This signal is emitted every time the value of the spin box + changes; the new value is passed in \a value. This signal will be + emitted as a result of a call to setValue(), or because the user + changed the value by using a keyboard accelerator or mouse click, + etc. + + Note that the valueChanged() signal is emitted \e every time, not + just for the "last" step; i.e. if the user clicks "up" three + times, this signal is emitted three times. + + \sa value() +*/ + + +/*! + \fn void TQSpinBox::valueChanged( const TQString& valueText ) + + \overload + + This signal is emitted whenever the valueChanged( int ) signal is + emitted, i.e. every time the value of the spin box changes + (whatever the cause, e.g. by setValue(), by a keyboard + accelerator, by mouse clicks, etc.). + + The \a valueText parameter is the same string that is displayed in + the edit field of the spin box. + + \sa value() prefix() suffix() specialValueText() +*/ + + + +/*! + Intercepts and handles the events coming to the embedded TQLineEdit + that have special meaning for the TQSpinBox. The object is passed + as \a o and the event is passed as \a ev. +*/ + +bool TQSpinBox::eventFilter( TQObject* o, TQEvent* ev ) +{ + if (o != vi) + return TQWidget::eventFilter(o,ev); + + if ( ev->type() == TQEvent::KeyPress ) { + TQKeyEvent* k = (TQKeyEvent*)ev; + + bool retval = FALSE; // workaround for MSVC++ optimization bug + if( (k->key() == Key_Tab) || (k->key() == Key_BackTab) ){ + if ( k->state() & TQt::ControlButton ) + return FALSE; + if ( edited ) + interpretText(); + tqApp->sendEvent( this, ev ); + retval = TRUE; + } if ( k->key() == Key_Up ) { + stepUp(); + retval = TRUE; + } else if ( k->key() == Key_Down ) { + stepDown(); + retval = TRUE; + } else if ( k->key() == Key_Enter || k->key() == Key_Return ) { + interpretText(); + return FALSE; + } + if ( retval ) + return retval; + } else if ( ev->type() == TQEvent::FocusOut || ev->type() == TQEvent::Hide ) { + if ( edited ) { + interpretText(); + } + return FALSE; + } + return FALSE; +} + +/*! + \reimp + */ +void TQSpinBox::setEnabled( bool enabled ) +{ + TQWidget::setEnabled( enabled ); + updateDisplay(); +} + +/*! + \reimp +*/ +void TQSpinBox::leaveEvent( TQEvent* ) +{ +} + + +/*! + \reimp +*/ +void TQSpinBox::resizeEvent( TQResizeEvent* ) +{ + d->controls->resize( width(), height() ); +} + +/*! + \reimp +*/ +#ifndef TQT_NO_WHEELEVENT +void TQSpinBox::wheelEvent( TQWheelEvent * e ) +{ + e->accept(); + static float offset = 0; + static TQSpinBox* offset_owner = 0; + if (offset_owner != this) { + offset_owner = this; + offset = 0; + } + offset += -e->delta()/120; + if (TQABS(offset) < 1) + return; + int ioff = int(offset); + int i; + for (i=0; i 0 ? stepDown() : stepUp(); + offset -= ioff; +} +#endif + +/*! + This virtual function is called by TQRangeControl whenever the + value has changed. The TQSpinBox reimplementation updates the + display and emits the valueChanged() signals; if you need + additional processing, either reimplement this or connect to one + of the valueChanged() signals. +*/ + +void TQSpinBox::valueChange() +{ + d->selreq = hasFocus(); + updateDisplay(); + d->selreq = FALSE; + emit valueChanged( value() ); + emit valueChanged( currentValueText() ); +#if defined(QT_ACCESSIBILITY_SUPPORT) + TQAccessible::updateAccessibility( this, 0, TQAccessible::ValueChanged ); +#endif +} + + +/*! + This virtual function is called by TQRangeControl whenever the + range has changed. It adjusts the default validator and updates + the display; if you need additional processing, you can + reimplement this function. +*/ + +void TQSpinBox::rangeChange() +{ + updateDisplay(); +} + + +/*! + Sets the validator to \a v. The validator controls what keyboard + input is accepted when the user is editing in the value field. The + default is to use a suitable TQIntValidator. + + Use setValidator(0) to turn off input validation (entered input + will still be kept within the spin box's range). +*/ + +void TQSpinBox::setValidator( const TQValidator* v ) +{ + if ( vi ) + vi->setValidator( v ); +} + + +/*! + Returns the validator that constrains editing for this spin box if + there is any; otherwise returns 0. + + \sa setValidator() TQValidator +*/ + +const TQValidator * TQSpinBox::validator() const +{ + return vi ? vi->validator() : 0; +} + +/*! + Updates the contents of the embedded TQLineEdit to reflect the + current value using mapValueToText(). Also enables/disables the + up/down push buttons accordingly. + + \sa mapValueToText() +*/ +void TQSpinBox::updateDisplay() +{ + vi->setUpdatesEnabled( FALSE ); + vi->setText( currentValueText() ); + if ( d->selreq && isVisible() && ( hasFocus() || vi->hasFocus() ) ) { + selectAll(); + } else { + if ( !suffix().isEmpty() && vi->text().endsWith(suffix()) ) + vi->setCursorPosition( vi->text().length() - suffix().length() ); + } + vi->setUpdatesEnabled( TRUE ); + vi->repaint( FALSE ); // immediate repaint needed for some reason + edited = FALSE; + + bool upEnabled = isEnabled() && ( wrapping() || value() < maxValue() ); + bool downEnabled = isEnabled() && ( wrapping() || value() > minValue() ); + + d->controls->setUpEnabled( upEnabled ); + d->controls->setDownEnabled( downEnabled ); + vi->setEnabled( isEnabled() ); + repaint( FALSE ); +} + + +/*! + TQSpinBox calls this after the user has manually edited the + contents of the spin box (i.e. by typing in the embedded + TQLineEdit, rather than using the up/down buttons/keys). + + The default implementation of this function interprets the new + text using mapTextToValue(). If mapTextToValue() is successful, it + changes the spin box's value; if not, the value is left unchanged. + + \sa editor() +*/ + +void TQSpinBox::interpretText() +{ + bool ok = TRUE; + bool done = FALSE; + int newVal = 0; + if ( !specialValueText().isEmpty() ) { + TQString s = text().stripWhiteSpace(); + TQString t = specialValueText().stripWhiteSpace(); + if ( s == t ) { + newVal = minValue(); + done = TRUE; + } + } + if ( !done ) + newVal = mapTextToValue( &ok ); + if ( ok ) + setValue( newVal ); + updateDisplay(); // sometimes redundant +} + + +/*! + Returns the geometry of the "up" button. +*/ + +TQRect TQSpinBox::upRect() const +{ + return d->controls->upRect(); +} + + +/*! + Returns the geometry of the "down" button. +*/ + +TQRect TQSpinBox::downRect() const +{ + return d->controls->downRect(); +} + + +/*! + Returns a pointer to the embedded TQLineEdit. +*/ + +TQLineEdit* TQSpinBox::editor() const +{ + return vi; +} + + +/*! + This slot is called whenever the user edits the spin box's text. +*/ + +void TQSpinBox::textChanged() +{ + edited = TRUE; // this flag is cleared in updateDisplay() +} + + +/*! + This virtual function is used by the spin box whenever it needs to + display value \a v. The default implementation returns a string + containing \a v printed in the standard way. Reimplementations may + return anything. (See the example in the detailed description.) + + Note that TQt does not call this function for specialValueText() + and that neither prefix() nor suffix() are included in the return + value. + + If you reimplement this, you may also need to reimplement + mapTextToValue(). + + \sa updateDisplay(), mapTextToValue() +*/ + +TQString TQSpinBox::mapValueToText( int v ) +{ + TQString s; + s.setNum( v ); + return s; +} + + +/*! + This virtual function is used by the spin box whenever it needs to + interpret text entered by the user as a value. The text is + available as text() and as cleanText(), and this function must + parse it if possible. If \a ok is not 0: if it parses the text + successfully, \a *ok is set to TRUE; otherwise \a *ok is set to + FALSE. + + Subclasses that need to display spin box values in a non-numeric + way need to reimplement this function. + + Note that TQt handles specialValueText() separately; this function + is only concerned with the other values. + + The default implementation tries to interpret the text() as an + integer in the standard way and returns the integer value. + + \sa interpretText(), mapValueToText() +*/ + +int TQSpinBox::mapTextToValue( bool* ok ) +{ + TQString s = text(); + int newVal = s.toInt( ok ); + if ( !(*ok) && !( !prefix() && !suffix() ) ) {// Try removing any pre/suffix + s = cleanText(); + newVal = s.toInt( ok ); + } + return newVal; +} + + +/*! + Returns the full text calculated from the current value, including + any prefix and suffix. If there is special value text and the + value is minValue() the specialValueText() is returned. +*/ + +TQString TQSpinBox::currentValueText() +{ + TQString s; + if ( (value() == minValue()) && !specialValueText().isEmpty() ) { + s = specialValueText(); + } else { + s = prefix(); + s.append( mapValueToText( value() ) ); + s.append( suffix() ); + } + return s; +} + +/*! + \reimp +*/ + +void TQSpinBox::styleChange( TQStyle& old ) +{ + arrangeWidgets(); + TQWidget::styleChange( old ); +} + + +/*! + \enum TQSpinBox::ButtonSymbols + + This enum type determines what the buttons in a spin box show. + + \value UpDownArrows the buttons show little arrows in the classic + style. + + \value PlusMinus the buttons show + and - symbols. + + \sa TQSpinBox::buttonSymbols +*/ + +/*! + \property TQSpinBox::buttonSymbols + + \brief the current button symbol mode + + The possible values can be either \c UpDownArrows or \c PlusMinus. + The default is \c UpDownArrows. + + \sa ButtonSymbols +*/ + +void TQSpinBox::setButtonSymbols( ButtonSymbols newSymbols ) +{ + if ( buttonSymbols() == newSymbols ) + return; + + switch ( newSymbols ) { + case UpDownArrows: + d->controls->setButtonSymbols( TQSpinWidget::UpDownArrows ); + break; + case PlusMinus: + d->controls->setButtonSymbols( TQSpinWidget::PlusMinus ); + break; + } + // repaint( FALSE ); +} + +TQSpinBox::ButtonSymbols TQSpinBox::buttonSymbols() const +{ + switch( d->controls->buttonSymbols() ) { + case TQSpinWidget::UpDownArrows: + return UpDownArrows; + case TQSpinWidget::PlusMinus: + return PlusMinus; + } + return UpDownArrows; +} + +/*! + \property TQSpinBox::minValue + + \brief the minimum value of the spin box + + When setting this property, \l TQSpinBox::maxValue is adjusted, if + necessary, to ensure that the range remains valid. + + \sa setRange() setSpecialValueText() +*/ + +int TQSpinBox::minValue() const +{ + return TQRangeControl::minValue(); +} + +void TQSpinBox::setMinValue( int minVal ) +{ + TQRangeControl::setMinValue( minVal ); +} + +/*! + \property TQSpinBox::maxValue + \brief the maximum value of the spin box + + When setting this property, \l TQSpinBox::minValue is adjusted, if + necessary, to ensure that the range remains valid. + + \sa setRange() setSpecialValueText() +*/ + +int TQSpinBox::maxValue() const +{ + return TQRangeControl::maxValue(); +} + +void TQSpinBox::setMaxValue( int maxVal ) +{ + TQRangeControl::setMaxValue( maxVal ); +} + +/*! + \property TQSpinBox::lineStep + \brief the line step + + When the user uses the arrows to change the spin box's value the + value will be incremented/decremented by the amount of the line + step. + + The setLineStep() function calls the virtual stepChange() function + if the new line step is different from the previous setting. + + \sa TQRangeControl::setSteps() setRange() +*/ + +int TQSpinBox::lineStep() const +{ + return TQRangeControl::lineStep(); +} + +void TQSpinBox::setLineStep( int i ) +{ + setSteps( i, pageStep() ); +} + +/*! + Selects all the text in the spin box's editor. +*/ + +void TQSpinBox::selectAll() +{ + int overhead = prefix().length() + suffix().length(); + if ( !overhead || currentValueText() == specialValueText() ) { + vi->selectAll(); + } else { + vi->setSelection( prefix().length(), vi->text().length() - overhead ); + } +} + +#endif diff --git a/src/widgets/tqspinbox.h b/src/widgets/tqspinbox.h new file mode 100644 index 000000000..345857c74 --- /dev/null +++ b/src/widgets/tqspinbox.h @@ -0,0 +1,172 @@ +/**************************************************************************** +** +** Definition of TQSpinBox widget class +** +** Created : 970101 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQSPINBOX_H +#define TQSPINBOX_H + +#ifndef QT_H +#include "tqwidget.h" +#include "ntqrangecontrol.h" +#endif // QT_H + +#ifndef TQT_NO_SPINBOX + +class TQLineEdit; +class TQValidator; +class TQSpinBoxPrivate; + +class TQ_EXPORT TQSpinBox: public TQWidget, public TQRangeControl +{ + TQ_OBJECT + TQ_ENUMS( ButtonSymbols ) + TQ_PROPERTY( TQString text READ text ) + TQ_PROPERTY( TQString prefix READ prefix WRITE setPrefix ) + TQ_PROPERTY( TQString suffix READ suffix WRITE setSuffix ) + TQ_PROPERTY( TQString cleanText READ cleanText ) + TQ_PROPERTY( TQString specialValueText READ specialValueText WRITE setSpecialValueText ) + TQ_PROPERTY( bool wrapping READ wrapping WRITE setWrapping ) + TQ_PROPERTY( ButtonSymbols buttonSymbols READ buttonSymbols WRITE setButtonSymbols ) + TQ_PROPERTY( int maxValue READ maxValue WRITE setMaxValue ) + TQ_PROPERTY( int minValue READ minValue WRITE setMinValue ) + TQ_PROPERTY( int lineStep READ lineStep WRITE setLineStep ) + TQ_PROPERTY( int value READ value WRITE setValue ) + +public: + TQSpinBox( TQWidget* parent=0, const char* name=0 ); + TQSpinBox( int minValue, int maxValue, int step = 1, + TQWidget* parent=0, const char* name=0 ); + ~TQSpinBox(); + + TQString text() const; + + virtual TQString prefix() const; + virtual TQString suffix() const; + virtual TQString cleanText() const; + + virtual void setSpecialValueText( const TQString &text ); + TQString specialValueText() const; + + virtual void setWrapping( bool on ); + bool wrapping() const; + + enum ButtonSymbols { UpDownArrows, PlusMinus }; + virtual void setButtonSymbols( ButtonSymbols ); + ButtonSymbols buttonSymbols() const; + + virtual void setValidator( const TQValidator* v ); + const TQValidator * validator() const; + + TQSize sizeHint() const; + TQSize minimumSizeHint() const; + + int minValue() const; + int maxValue() const; + void setMinValue( int ); + void setMaxValue( int ); + int lineStep() const; + void setLineStep( int ); + int value() const; + + TQRect upRect() const; + TQRect downRect() const; + +public slots: + virtual void setValue( int value ); + virtual void setPrefix( const TQString &text ); + virtual void setSuffix( const TQString &text ); + virtual void stepUp(); + virtual void stepDown(); + virtual void setEnabled( bool enabled ); + virtual void selectAll(); + +signals: + void valueChanged( int value ); + void valueChanged( const TQString &valueText ); + +protected: + virtual TQString mapValueToText( int value ); + virtual int mapTextToValue( bool* ok ); + TQString currentValueText(); + + virtual void updateDisplay(); + virtual void interpretText(); + + TQLineEdit* editor() const; + + virtual void valueChange(); + virtual void rangeChange(); + + bool eventFilter( TQObject* obj, TQEvent* ev ); + void resizeEvent( TQResizeEvent* ev ); +#ifndef TQT_NO_WHEELEVENT + void wheelEvent( TQWheelEvent * ); +#endif + void leaveEvent( TQEvent* ); + + void styleChange( TQStyle& ); + +protected slots: + void textChanged(); + +private: + void initSpinBox(); + TQSpinBoxPrivate* d; + TQLineEdit* vi; + TQValidator* validate; + TQString pfix; + TQString sfix; + TQString specText; + + uint wrap : 1; + uint edited : 1; + + void arrangeWidgets(); + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQSpinBox( const TQSpinBox& ); + TQSpinBox& operator=( const TQSpinBox& ); +#endif + +}; + +#endif // TQT_NO_SPINBOX + +#endif // TQSPINBOX_H diff --git a/src/widgets/tqspinwidget.cpp b/src/widgets/tqspinwidget.cpp new file mode 100644 index 000000000..a66e90d1d --- /dev/null +++ b/src/widgets/tqspinwidget.cpp @@ -0,0 +1,467 @@ +/**************************************************************************** +** +** Implementation of TQSpinWidget class +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the widgets module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial licenses may use this file in accordance with the TQt +** Commercial License Agreement provided with the Software. +** +** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, +** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "ntqrangecontrol.h" + +#ifndef TQT_NO_SPINWIDGET + +#include "tqrect.h" +#include "tqtimer.h" +#include "tqstyle.h" +#include "tqpainter.h" + +class TQSpinWidgetPrivate +{ +public: + TQSpinWidgetPrivate() + : upEnabled( TRUE ), + downEnabled( TRUE ), + theButton( 0 ), + buttonDown( 0 ), + timerUp( 0 ), + bsyms( TQSpinWidget::UpDownArrows ), + ed ( 0 ) {} + uint upEnabled :1; + uint downEnabled :1; + uint theButton :2; + uint buttonDown :2; + uint timerUp : 1; + TQRect up; + TQRect down; + TQTimer auRepTimer; + TQSpinWidget::ButtonSymbols bsyms; + TQWidget *ed; + void startTimer( int msec ) { auRepTimer.start( msec, TRUE ); } + void startTimer( bool up, int msec ) { timerUp = up; startTimer( msec ); } + void stopTimer() { auRepTimer.stop(); } +}; + +/*! + + \class TQSpinWidget tqspinwidget.h + \brief The TQSpinWidget class is an internal range control related class. + + \internal + + Constructs an empty range control widget with parent \a parent + called \a name. + +*/ + +TQSpinWidget::TQSpinWidget( TQWidget* parent, const char* name ) + : TQWidget( parent, name ) +{ + d = new TQSpinWidgetPrivate(); + connect( &d->auRepTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( timerDone() ) ); + setFocusPolicy( StrongFocus ); + + arrange(); + updateDisplay(); +} + + +/*! Destroys the object and frees any allocated resources. + +*/ + +TQSpinWidget::~TQSpinWidget() +{ + delete d; +} + +/*! */ +TQWidget * TQSpinWidget::editWidget() +{ + return d->ed; +} + +/*! + Sets the editing widget to \a w. +*/ +void TQSpinWidget::setEditWidget( TQWidget * w ) +{ + if ( w ) { + if (w->parentWidget() != this) + w->reparent( this, TQPoint( 0, 0 ) ); + setFocusProxy( w ); + } + d->ed = w; + arrange(); + updateDisplay(); +} + +/*! \reimp + +*/ + +void TQSpinWidget::mousePressEvent( TQMouseEvent *e ) +{ + if ( e->button() != LeftButton ) { + d->stopTimer(); + d->buttonDown = 0; + d->theButton = 0; + repaint( d->down.unite( d->up ), FALSE ); + return; + } + + uint oldButtonDown = d->buttonDown; + + if ( d->down.contains( e->pos() ) && d->downEnabled ) + d->buttonDown = 1; + else if ( d->up.contains( e->pos() ) && d->upEnabled ) + d->buttonDown = 2; + else + d->buttonDown = 0; + + d->theButton = d->buttonDown; + if ( oldButtonDown != d->buttonDown ) { + if ( !d->buttonDown ) { + repaint( d->down.unite( d->up ), FALSE ); + } else if ( d->buttonDown & 1 ) { + repaint( d->down, FALSE ); + stepDown(); + d->startTimer( FALSE, 300 ); + } else if ( d->buttonDown & 2 ) { + repaint( d->up, FALSE ); + stepUp(); + d->startTimer( TRUE, 300 ); + } + } +} + +/*! + +*/ + +void TQSpinWidget::arrange() +{ + d->up = TQStyle::visualRect( style().querySubControlMetrics( TQStyle::CC_SpinWidget, this, + TQStyle::SC_SpinWidgetUp ), this ); + d->down = TQStyle::visualRect( style().querySubControlMetrics( TQStyle::CC_SpinWidget, this, + TQStyle::SC_SpinWidgetDown ), this ); + if ( d->ed ) { + TQRect r = TQStyle::visualRect( style().querySubControlMetrics( TQStyle::CC_SpinWidget, this, + TQStyle::SC_SpinWidgetEditField ), this ); + d->ed->setGeometry( r ); + } +} + +/*! + +*/ + +void TQSpinWidget::stepUp() +{ + emit stepUpPressed(); +} + +void TQSpinWidget::resizeEvent( TQResizeEvent* ) +{ + arrange(); +} + +/*! + +*/ + +void TQSpinWidget::stepDown() +{ + emit stepDownPressed(); +} + + +void TQSpinWidget::timerDone() +{ + // we use a double timer to make it possible for users to do + // something with 0-timer on valueChanged. + TQTimer::singleShot( 1, this, TQ_SLOT( timerDoneEx() ) ); +} + +void TQSpinWidget::timerDoneEx() +{ + if ( !d->buttonDown ) + return; + if ( d->timerUp ) + stepUp(); + else + stepDown(); + d->startTimer( 100 ); +} + + +void TQSpinWidget::windowActivationChange( bool oldActive ) +{ + //was active, but lost focus + if ( oldActive && d->buttonDown ) { + d->stopTimer(); + d->buttonDown = 0; + d->theButton = 0; + } + TQWidget::windowActivationChange( oldActive ); +} + + + +/*! + The event is passed in \a e. +*/ + +void TQSpinWidget::mouseReleaseEvent( TQMouseEvent *e ) +{ + if ( e->button() != LeftButton ) + return; + + uint oldButtonDown = d->theButton; + d->theButton = 0; + if ( oldButtonDown != d->theButton ) { + if ( oldButtonDown & 1 ) + repaint( d->down, FALSE ); + else if ( oldButtonDown & 2 ) + repaint( d->up, FALSE ); + } + d->stopTimer(); + d->buttonDown = 0; +} + + +/*! + The event is passed in \a e. +*/ + +void TQSpinWidget::mouseMoveEvent( TQMouseEvent *e ) +{ + if ( !(e->state() & LeftButton ) ) + return; + + uint oldButtonDown = d->theButton; + if ( oldButtonDown & 1 && !d->down.contains( e->pos() ) ) { + d->stopTimer(); + d->theButton = 0; + repaint( d->down, FALSE ); + } else if ( oldButtonDown & 2 && !d->up.contains( e->pos() ) ) { + d->stopTimer(); + d->theButton = 0; + repaint( d->up, FALSE ); + } else if ( !oldButtonDown && d->up.contains( e->pos() ) && d->buttonDown & 2 ) { + d->startTimer( 500 ); + d->theButton = 2; + repaint( d->up, FALSE ); + } else if ( !oldButtonDown && d->down.contains( e->pos() ) && d->buttonDown & 1 ) { + d->startTimer( 500 ); + d->theButton = 1; + repaint( d->down, FALSE ); + } +} + + +/*! + The event is passed in \a e. +*/ +#ifndef TQT_NO_WHEELEVENT +void TQSpinWidget::wheelEvent( TQWheelEvent *e ) +{ + e->accept(); + static float offset = 0; + static TQSpinWidget* offset_owner = 0; + if ( offset_owner != this ) { + offset_owner = this; + offset = 0; + } + offset += -e->delta()/120; + if ( TQABS( offset ) < 1 ) + return; + int ioff = int(offset); + int i; + for( i=0; i < TQABS( ioff ); i++ ) + offset > 0 ? stepDown() : stepUp(); + offset -= ioff; +} +#endif + +/*! + +*/ +void TQSpinWidget::paintEvent( TQPaintEvent * ) +{ + TQPainter p( this ); + + TQStyle::SFlags flags = TQStyle::Style_Default; + if (isEnabled()) + flags |= TQStyle::Style_Enabled; + if (hasMouse()) + flags |= TQStyle::Style_MouseOver; + if (hasFocus() || (focusProxy() && focusProxy()->hasFocus())) + flags |= TQStyle::Style_HasFocus; + + TQStyle::SCFlags active; + if ( d->theButton & 1 ) + active = TQStyle::SC_SpinWidgetDown; + else if ( d->theButton & 2 ) + active = TQStyle::SC_SpinWidgetUp; + else + active = TQStyle::SC_None; + + TQRect fr = TQStyle::visualRect( + style().querySubControlMetrics( TQStyle::CC_SpinWidget, this, + TQStyle::SC_SpinWidgetFrame ), this ); + style().drawComplexControl( TQStyle::CC_SpinWidget, &p, this, + fr, colorGroup(), + flags, + (uint)TQStyle::SC_All, + active ); +} + + +/*! + The previous style is passed in \a old. +*/ + +void TQSpinWidget::styleChange( TQStyle& old ) +{ + arrange(); + TQWidget::styleChange( old ); +} + +/*! +*/ + +TQRect TQSpinWidget::upRect() const +{ + return d->up; +} + +/*! +*/ + +TQRect TQSpinWidget::downRect() const +{ + return d->down; +} + +/*! +*/ + +void TQSpinWidget::updateDisplay() +{ + if ( !isEnabled() ) { + d->upEnabled = FALSE; + d->downEnabled = FALSE; + } + if ( d->theButton & 1 && ( d->downEnabled ) == 0 ) { + d->theButton &= ~1; + d->buttonDown &= ~1; + } + + if ( d->theButton & 2 && ( d->upEnabled ) == 0 ) { + d->theButton &= ~2; + d->buttonDown &= ~2; + } + repaint( FALSE ); +} + + +/*! + The previous enabled state is passed in \a old. +*/ + +void TQSpinWidget::enableChanged( bool ) +{ + d->upEnabled = isEnabled(); + d->downEnabled = isEnabled(); + updateDisplay(); +} + + +/*! + Sets up-enabled to \a on. +*/ + +void TQSpinWidget::setUpEnabled( bool on ) +{ + if ( (bool)d->upEnabled != on ) { + d->upEnabled = on; + updateDisplay(); + } +} + +/*! +*/ + +bool TQSpinWidget::isUpEnabled() const +{ + return d->upEnabled; +} + +/*! + Sets down-enabled to \a on. +*/ + +void TQSpinWidget::setDownEnabled( bool on ) +{ + if ( (bool)d->downEnabled != on ) { + d->downEnabled = on; + updateDisplay(); + } +} + +/*! +*/ + +bool TQSpinWidget::isDownEnabled() const +{ + return d->downEnabled; +} + +/*! + Sets the button symbol to \a bs. +*/ + +void TQSpinWidget::setButtonSymbols( ButtonSymbols bs ) +{ + d->bsyms = bs; +} + +/*! +*/ + +TQSpinWidget::ButtonSymbols TQSpinWidget::buttonSymbols() const +{ + return d->bsyms; +} + +#endif diff --git a/src/widgets/tqtextedit.h b/src/widgets/tqtextedit.h index 0b88f8593..f58b91d09 100644 --- a/src/widgets/tqtextedit.h +++ b/src/widgets/tqtextedit.h @@ -42,7 +42,7 @@ #define TQTEXTEDIT_H #ifndef QT_H -#include "ntqscrollview.h" +#include "tqscrollview.h" #include "tqstylesheet.h" #include "tqptrvector.h" #include "tqvaluelist.h" diff --git a/src/widgets/tqtoolbar.cpp b/src/widgets/tqtoolbar.cpp index a94185bec..b8a66fb7a 100644 --- a/src/widgets/tqtoolbar.cpp +++ b/src/widgets/tqtoolbar.cpp @@ -51,7 +51,7 @@ #include "ntqdrawutil.h" #include "tqtoolbutton.h" #include "tqpopupmenu.h" -#include "ntqcombobox.h" +#include "tqcombobox.h" #include "tqtimer.h" #include "tqwidgetlist.h" #include "tqstyle.h" diff --git a/src/widgets/tqtoolbox.cpp b/src/widgets/tqtoolbox.cpp index 7b515b0a7..948acf7d7 100644 --- a/src/widgets/tqtoolbox.cpp +++ b/src/widgets/tqtoolbox.cpp @@ -44,7 +44,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/workspace/tqworkspace.cpp b/src/workspace/tqworkspace.cpp index 72319497b..5706ee3e4 100644 --- a/src/workspace/tqworkspace.cpp +++ b/src/workspace/tqworkspace.cpp @@ -59,7 +59,7 @@ #include "tqtooltip.h" #include "tqwmatrix.h" #include "tqimage.h" -#include "ntqscrollbar.h" +#include "tqscrollbar.h" #include "tqstyle.h" #include "tqbitmap.h" diff --git a/tools/assistant/helpdialogimpl.cpp b/tools/assistant/helpdialogimpl.cpp index 3da2e1e3e..b972d872d 100644 --- a/tools/assistant/helpdialogimpl.cpp +++ b/tools/assistant/helpdialogimpl.cpp @@ -48,13 +48,13 @@ #include #include #include -#include +#include #include #include #include #include #include -#include +#include #include #include #include diff --git a/tools/assistant/mainwindow.ui b/tools/assistant/mainwindow.ui index 8c1977309..81586bd7f 100644 --- a/tools/assistant/mainwindow.ui +++ b/tools/assistant/mainwindow.ui @@ -575,7 +575,7 @@ ntqmessagebox.h tqfontdatabase.h ntqaccel.h - ntqcombobox.h + tqcombobox.h tqpaintdevicemetrics.h tqsimplerichtext.h tqfileinfo.h @@ -592,9 +592,9 @@ tqpainter.h tqurl.h tqstatusbar.h - ntqlineedit.h + tqlineedit.h tqsettings.h - ntqcheckbox.h + tqcheckbox.h tabbedbrowser.h tqptrlist.h ntqguardedptr.h diff --git a/tools/assistant/settingsdialogimpl.cpp b/tools/assistant/settingsdialogimpl.cpp index 9898f64e6..2be9b31bd 100644 --- a/tools/assistant/settingsdialogimpl.cpp +++ b/tools/assistant/settingsdialogimpl.cpp @@ -36,13 +36,13 @@ #include "config.h" #include -#include -#include +#include +#include #include #include #include #include -#include +#include #include #include #include diff --git a/tools/assistant/topicchooserimpl.cpp b/tools/assistant/topicchooserimpl.cpp index a0ff04826..d81427a9c 100644 --- a/tools/assistant/topicchooserimpl.cpp +++ b/tools/assistant/topicchooserimpl.cpp @@ -35,7 +35,7 @@ #include #include -#include +#include TopicChooser::TopicChooser( TQWidget *parent, const TQStringList &lnkNames, const TQStringList &lnks, const TQString &title ) diff --git a/tools/designer/designer/actioneditorimpl.cpp b/tools/designer/designer/actioneditorimpl.cpp index 938b8f25e..f89813961 100644 --- a/tools/designer/designer/actioneditorimpl.cpp +++ b/tools/designer/designer/actioneditorimpl.cpp @@ -41,12 +41,12 @@ #include "formfile.h" #include -#include +#include #include #include #include -#include -#include +#include +#include #include #include diff --git a/tools/designer/designer/connectionitems.cpp b/tools/designer/designer/connectionitems.cpp index 65f433a2b..234049595 100644 --- a/tools/designer/designer/connectionitems.cpp +++ b/tools/designer/designer/connectionitems.cpp @@ -38,9 +38,9 @@ #include "widgetfactory.h" #include "project.h" #include -#include +#include #include -#include +#include #include #include #include diff --git a/tools/designer/designer/customwidgeteditorimpl.cpp b/tools/designer/designer/customwidgeteditorimpl.cpp index 296000d9a..a2fe0a13e 100644 --- a/tools/designer/designer/customwidgeteditorimpl.cpp +++ b/tools/designer/designer/customwidgeteditorimpl.cpp @@ -41,10 +41,10 @@ #include "widgetdatabase.h" #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -56,7 +56,7 @@ #include #include #include -#include +#include CustomWidgetEditor::CustomWidgetEditor( TQWidget *parent, MainWindow *mw ) : CustomWidgetEditorBase( parent, 0, TRUE ), mainWindow( mw ) diff --git a/tools/designer/designer/dbconnectionimpl.cpp b/tools/designer/designer/dbconnectionimpl.cpp index c14ded90c..745c56c52 100644 --- a/tools/designer/designer/dbconnectionimpl.cpp +++ b/tools/designer/designer/dbconnectionimpl.cpp @@ -36,9 +36,9 @@ #include "project.h" #include "asciivalidator.h" #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/tools/designer/designer/dbconnectionsimpl.cpp b/tools/designer/designer/dbconnectionsimpl.cpp index c08e9554e..69d860d70 100644 --- a/tools/designer/designer/dbconnectionsimpl.cpp +++ b/tools/designer/designer/dbconnectionsimpl.cpp @@ -37,10 +37,10 @@ #include #include "project.h" #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/tools/designer/designer/designer_pch.h b/tools/designer/designer/designer_pch.h index 0be6a87ac..49a463505 100644 --- a/tools/designer/designer/designer_pch.h +++ b/tools/designer/designer/designer_pch.h @@ -11,13 +11,13 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include -#include +#include #include #include #include @@ -26,8 +26,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/tools/designer/designer/editfunctionsimpl.cpp b/tools/designer/designer/editfunctionsimpl.cpp index dbdbe133b..840f98f93 100644 --- a/tools/designer/designer/editfunctionsimpl.cpp +++ b/tools/designer/designer/editfunctionsimpl.cpp @@ -40,16 +40,16 @@ #include "project.h" #include -#include -#include -#include +#include +#include +#include #include #include #include #include #include #include -#include +#include EditFunctions::EditFunctions( TQWidget *parent, FormWindow *fw, bool justSlots ) : EditFunctionsBase( parent, 0, TRUE ), formWindow( fw ) diff --git a/tools/designer/designer/finddialog.ui b/tools/designer/designer/finddialog.ui index 73b00ef6f..1b9ce01ad 100644 --- a/tools/designer/designer/finddialog.ui +++ b/tools/designer/designer/finddialog.ui @@ -260,7 +260,7 @@ PushButton2 - ntqlineedit.h + tqlineedit.h ../interfaces/editorinterface.h finddialog.ui.h diff --git a/tools/designer/designer/formsettingsimpl.cpp b/tools/designer/designer/formsettingsimpl.cpp index 88ddef415..30b7b2223 100644 --- a/tools/designer/designer/formsettingsimpl.cpp +++ b/tools/designer/designer/formsettingsimpl.cpp @@ -40,12 +40,12 @@ #include "project.h" #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include FormSettings::FormSettings( TQWidget *parent, FormWindow *fw ) : FormSettingsBase( parent, 0, TRUE ), formwindow( fw ) diff --git a/tools/designer/designer/formwindow.cpp b/tools/designer/designer/formwindow.cpp index 2e0c32d94..d02fb6119 100644 --- a/tools/designer/designer/formwindow.cpp +++ b/tools/designer/designer/formwindow.cpp @@ -59,14 +59,14 @@ #include #include #include -#include +#include #include #include #include #include #include #include -#include +#include #include #include #include diff --git a/tools/designer/designer/iconvieweditorimpl.cpp b/tools/designer/designer/iconvieweditorimpl.cpp index 34bbf1bdb..ebc3cf487 100644 --- a/tools/designer/designer/iconvieweditorimpl.cpp +++ b/tools/designer/designer/iconvieweditorimpl.cpp @@ -36,11 +36,11 @@ #include "mainwindow.h" #include "pixmapchooser.h" -#include +#include #include #include -#include -#include +#include +#include IconViewEditor::IconViewEditor( TQWidget *parent, TQWidget *editWidget, FormWindow *fw ) : IconViewEditorBase( parent, 0, TRUE ), formwindow( fw ) diff --git a/tools/designer/designer/listboxeditorimpl.cpp b/tools/designer/designer/listboxeditorimpl.cpp index 907648d1d..ec7fa9129 100644 --- a/tools/designer/designer/listboxeditorimpl.cpp +++ b/tools/designer/designer/listboxeditorimpl.cpp @@ -39,11 +39,11 @@ #include "listboxdnd.h" #include "listboxrename.h" -#include +#include #include #include -#include -#include +#include +#include ListBoxEditor::ListBoxEditor( TQWidget *parent, TQWidget *editWidget, FormWindow *fw ) : ListBoxEditorBase( parent, 0, TRUE ), formwindow( fw ) diff --git a/tools/designer/designer/listboxrename.cpp b/tools/designer/designer/listboxrename.cpp index 2e2bffe95..44eb05cc7 100644 --- a/tools/designer/designer/listboxrename.cpp +++ b/tools/designer/designer/listboxrename.cpp @@ -32,7 +32,7 @@ **********************************************************************/ #include -#include +#include #include #include "listboxrename.h" diff --git a/tools/designer/designer/listdnd.h b/tools/designer/designer/listdnd.h index c3e414a03..a464255c0 100644 --- a/tools/designer/designer/listdnd.h +++ b/tools/designer/designer/listdnd.h @@ -35,7 +35,7 @@ #define LISTDND_H #include -#include +#include class ListDnd : public TQObject { diff --git a/tools/designer/designer/listvieweditorimpl.cpp b/tools/designer/designer/listvieweditorimpl.cpp index 6d2e98235..51a271401 100644 --- a/tools/designer/designer/listvieweditorimpl.cpp +++ b/tools/designer/designer/listvieweditorimpl.cpp @@ -43,12 +43,12 @@ #include #include #include -#include -#include +#include +#include #include #include -#include -#include +#include +#include #include ListViewEditor::ListViewEditor( TQWidget *parent, TQListView *lv, FormWindow *fw ) diff --git a/tools/designer/designer/mainwindow.cpp b/tools/designer/designer/mainwindow.cpp index 3c188d6c6..428443f05 100644 --- a/tools/designer/designer/mainwindow.cpp +++ b/tools/designer/designer/mainwindow.cpp @@ -103,7 +103,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tools/designer/designer/mainwindowactions.cpp b/tools/designer/designer/mainwindowactions.cpp index 1699b4725..16a185bdf 100644 --- a/tools/designer/designer/mainwindowactions.cpp +++ b/tools/designer/designer/mainwindowactions.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -48,8 +48,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/tools/designer/designer/menubareditor.cpp b/tools/designer/designer/menubareditor.cpp index 173b18ce0..cc3e22c25 100644 --- a/tools/designer/designer/menubareditor.cpp +++ b/tools/designer/designer/menubareditor.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tools/designer/designer/multilineeditorimpl.cpp b/tools/designer/designer/multilineeditorimpl.cpp index a75fdcbc9..450f01876 100644 --- a/tools/designer/designer/multilineeditorimpl.cpp +++ b/tools/designer/designer/multilineeditorimpl.cpp @@ -41,7 +41,7 @@ #include #include <./private/qrichtext_p.h> -#include +#include #include #include #include diff --git a/tools/designer/designer/newformimpl.cpp b/tools/designer/designer/newformimpl.cpp index b1d237eef..75fd0c0c1 100644 --- a/tools/designer/designer/newformimpl.cpp +++ b/tools/designer/designer/newformimpl.cpp @@ -48,9 +48,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include diff --git a/tools/designer/designer/paletteeditoradvancedimpl.cpp b/tools/designer/designer/paletteeditoradvancedimpl.cpp index f776e584d..4884c73f8 100644 --- a/tools/designer/designer/paletteeditoradvancedimpl.cpp +++ b/tools/designer/designer/paletteeditoradvancedimpl.cpp @@ -36,10 +36,10 @@ #include "mainwindow.h" #include "formwindow.h" -#include -#include +#include +#include #include -#include +#include #include #include #include diff --git a/tools/designer/designer/paletteeditorimpl.cpp b/tools/designer/designer/paletteeditorimpl.cpp index c23808f35..0aae0754b 100644 --- a/tools/designer/designer/paletteeditorimpl.cpp +++ b/tools/designer/designer/paletteeditorimpl.cpp @@ -38,10 +38,10 @@ #include "mainwindow.h" #include "formwindow.h" -#include -#include +#include +#include #include -#include +#include PaletteEditor::PaletteEditor( FormWindow *fw, TQWidget * parent, const char * name, bool modal, WFlags f ) : PaletteEditorBase( parent, name, modal, f ), formWindow( fw ) diff --git a/tools/designer/designer/pixmapchooser.cpp b/tools/designer/designer/pixmapchooser.cpp index 1ded61d8b..fdde54aa2 100644 --- a/tools/designer/designer/pixmapchooser.cpp +++ b/tools/designer/designer/pixmapchooser.cpp @@ -48,8 +48,8 @@ #include #include #include -#include -#include +#include +#include #include #if defined(DESIGNER) diff --git a/tools/designer/designer/pixmapchooser.h b/tools/designer/designer/pixmapchooser.h index 46f754506..a8bc94cf2 100644 --- a/tools/designer/designer/pixmapchooser.h +++ b/tools/designer/designer/pixmapchooser.h @@ -35,7 +35,7 @@ #define PIXMAPCHOOSER_H #include -#include +#include #include #include diff --git a/tools/designer/designer/popupmenueditor.cpp b/tools/designer/designer/popupmenueditor.cpp index ba43a3633..2aa2c7062 100644 --- a/tools/designer/designer/popupmenueditor.cpp +++ b/tools/designer/designer/popupmenueditor.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tools/designer/designer/projectsettingsimpl.cpp b/tools/designer/designer/projectsettingsimpl.cpp index 27554c196..215a2f391 100644 --- a/tools/designer/designer/projectsettingsimpl.cpp +++ b/tools/designer/designer/projectsettingsimpl.cpp @@ -41,14 +41,14 @@ #include "sourcefile.h" #include "workspace.h" -#include +#include #include -#include +#include #include -#include +#include #include #include -#include +#include #include /* diff --git a/tools/designer/designer/propertyeditor.cpp b/tools/designer/designer/propertyeditor.cpp index c5df3f06c..7a32cd344 100644 --- a/tools/designer/designer/propertyeditor.cpp +++ b/tools/designer/designer/propertyeditor.cpp @@ -55,14 +55,14 @@ #include #include #include -#include +#include #include #include -#include -#include +#include +#include #include #include -#include +#include #include #include #include diff --git a/tools/designer/designer/propertyeditor.h b/tools/designer/designer/propertyeditor.h index ca3b426f4..9740f0593 100644 --- a/tools/designer/designer/propertyeditor.h +++ b/tools/designer/designer/propertyeditor.h @@ -43,8 +43,8 @@ #include #include #include -#include -#include +#include +#include #include "hierarchyview.h" #include "metadatabase.h" diff --git a/tools/designer/designer/qcompletionedit.h b/tools/designer/designer/qcompletionedit.h index 2b35c2412..792f74002 100644 --- a/tools/designer/designer/qcompletionedit.h +++ b/tools/designer/designer/qcompletionedit.h @@ -34,7 +34,7 @@ #ifndef TQCOMPLETIONEDIT_H #define TQCOMPLETIONEDIT_H -#include +#include #include class TQListBox; diff --git a/tools/designer/designer/replacedialog.ui b/tools/designer/designer/replacedialog.ui index 3cd6e2476..78c12653f 100644 --- a/tools/designer/designer/replacedialog.ui +++ b/tools/designer/designer/replacedialog.ui @@ -304,7 +304,7 @@ ../interfaces/editorinterface.h - ntqlineedit.h + tqlineedit.h replacedialog.ui.h diff --git a/tools/designer/designer/resource.cpp b/tools/designer/designer/resource.cpp index b1974e311..02a39753a 100644 --- a/tools/designer/designer/resource.cpp +++ b/tools/designer/designer/resource.cpp @@ -53,7 +53,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tools/designer/designer/startdialogimpl.cpp b/tools/designer/designer/startdialogimpl.cpp index b27131ae6..4bd471363 100644 --- a/tools/designer/designer/startdialogimpl.cpp +++ b/tools/designer/designer/startdialogimpl.cpp @@ -2,19 +2,19 @@ #include #include #include -#include +#include #include #include #include #include #include -#include +#include #include #include #include #include #include -#include +#include #include #include "mainwindow.h" diff --git a/tools/designer/designer/tableeditorimpl.cpp b/tools/designer/designer/tableeditorimpl.cpp index 38d043f96..d1149670e 100644 --- a/tools/designer/designer/tableeditorimpl.cpp +++ b/tools/designer/designer/tableeditorimpl.cpp @@ -37,11 +37,11 @@ #endif #include "formwindow.h" #include -#include +#include #include #include -#include -#include +#include +#include #include "pixmapchooser.h" #include "command.h" #include diff --git a/tools/designer/designer/variabledialogimpl.cpp b/tools/designer/designer/variabledialogimpl.cpp index c02dcf691..017767313 100644 --- a/tools/designer/designer/variabledialogimpl.cpp +++ b/tools/designer/designer/variabledialogimpl.cpp @@ -33,8 +33,8 @@ #include #include -#include -#include +#include +#include #include #include "metadatabase.h" diff --git a/tools/designer/designer/widgetfactory.cpp b/tools/designer/designer/widgetfactory.cpp index edc24274b..45fb9a901 100644 --- a/tools/designer/designer/widgetfactory.cpp +++ b/tools/designer/designer/widgetfactory.cpp @@ -64,21 +64,21 @@ #include #endif #include -#include -#include +#include +#include #include #include #include #include #include -#include +#include #include #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -88,7 +88,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tools/designer/designer/widgetfactory.h b/tools/designer/designer/widgetfactory.h index 7f913721d..4256a7f0e 100644 --- a/tools/designer/designer/widgetfactory.h +++ b/tools/designer/designer/widgetfactory.h @@ -47,10 +47,10 @@ #include #include #include -#include +#include #include -#include -#include +#include +#include #include #include #include diff --git a/tools/designer/designer/wizardeditorimpl.cpp b/tools/designer/designer/wizardeditorimpl.cpp index a04a33f36..0450c76e5 100644 --- a/tools/designer/designer/wizardeditorimpl.cpp +++ b/tools/designer/designer/wizardeditorimpl.cpp @@ -40,7 +40,7 @@ #include #include -#include +#include #include WizardEditor::WizardEditor( TQWidget *parent, TQWizard *w, FormWindow *fw ) diff --git a/tools/designer/editor/preferences.ui b/tools/designer/editor/preferences.ui index 5627528c8..1612f3415 100644 --- a/tools/designer/editor/preferences.ui +++ b/tools/designer/editor/preferences.ui @@ -473,13 +473,13 @@ tqmap.h conf.h tqpalette.h - ntqlineedit.h + tqlineedit.h tqpixmap.h - ntqcombobox.h + tqcombobox.h tqfontdatabase.h editor.h - ntqpushbutton.h - ntqcheckbox.h + tqpushbutton.h + tqcheckbox.h tqcolordialog.h tqsettings.h preferences.ui.h diff --git a/tools/designer/examples/colortool/mainform.ui b/tools/designer/examples/colortool/mainform.ui index f76e39e1b..6a054f59e 100644 --- a/tools/designer/examples/colortool/mainform.ui +++ b/tools/designer/examples/colortool/mainform.ui @@ -513,8 +513,8 @@ findform.h tqsettings.h - ntqradiobutton.h - ntqcheckbox.h + tqradiobutton.h + tqcheckbox.h colornameform.h tqcolordialog.h tqregexp.h @@ -528,7 +528,7 @@ ntqmessagebox.h tqclipboard.h tqlabel.h - ntqlineedit.h + tqlineedit.h optionsform.h mainform.ui.h diff --git a/tools/designer/examples/credit/creditform.cpp b/tools/designer/examples/credit/creditform.cpp index 8bceaa4b2..3a2afa342 100644 --- a/tools/designer/examples/credit/creditform.cpp +++ b/tools/designer/examples/credit/creditform.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include "creditform.h" CreditForm::CreditForm( TQWidget* parent, const char* name, diff --git a/tools/designer/examples/credit/creditformbase.cpp b/tools/designer/examples/credit/creditformbase.cpp index 7ea445897..51957cedb 100644 --- a/tools/designer/examples/credit/creditformbase.cpp +++ b/tools/designer/examples/credit/creditformbase.cpp @@ -10,9 +10,9 @@ #include // first for gcc 2.7.2 #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/tools/designer/examples/credit/creditformbase.h b/tools/designer/examples/credit/creditformbase.h index 8d8b97c69..e609e2095 100644 --- a/tools/designer/examples/credit/creditformbase.h +++ b/tools/designer/examples/credit/creditformbase.h @@ -10,7 +10,7 @@ #define CREDITFORMBASE_H #include -#include +#include class TQVBoxLayout; class TQHBoxLayout; class TQGridLayout; diff --git a/tools/designer/examples/filechooser/widget/filechooser.cpp b/tools/designer/examples/filechooser/widget/filechooser.cpp index 97ff5d5b2..799772b8d 100644 --- a/tools/designer/examples/filechooser/widget/filechooser.cpp +++ b/tools/designer/examples/filechooser/widget/filechooser.cpp @@ -1,6 +1,6 @@ #include "filechooser.h" -#include -#include +#include +#include #include #include diff --git a/tools/designer/examples/receiver1/mainform.ui b/tools/designer/examples/receiver1/mainform.ui index 71d651be2..ff2c230de 100644 --- a/tools/designer/examples/receiver1/mainform.ui +++ b/tools/designer/examples/receiver1/mainform.ui @@ -74,7 +74,7 @@ - ntqspinbox.h + tqspinbox.h tqwidgetfactory.h mainform.ui.h diff --git a/tools/designer/examples/receiver2/mainform.ui b/tools/designer/examples/receiver2/mainform.ui index 6f27e6dab..cdcc140d4 100644 --- a/tools/designer/examples/receiver2/mainform.ui +++ b/tools/designer/examples/receiver2/mainform.ui @@ -1,7 +1,7 @@ MainForm tqwidgetfactory.h -ntqspinbox.h +tqspinbox.h receiver.h mainform.ui.h diff --git a/tools/designer/examples/receiver2/receiver.cpp b/tools/designer/examples/receiver2/receiver.cpp index 41ce98db5..2f6f1153a 100644 --- a/tools/designer/examples/receiver2/receiver.cpp +++ b/tools/designer/examples/receiver2/receiver.cpp @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include "receiver.h" void Receiver::setParent( TQDialog *parent ) diff --git a/tools/designer/examples/receiver2/receiver.h b/tools/designer/examples/receiver2/receiver.h index 685da7e35..5f8cd0ee7 100644 --- a/tools/designer/examples/receiver2/receiver.h +++ b/tools/designer/examples/receiver2/receiver.h @@ -1,5 +1,5 @@ #include -#include +#include class Receiver : public TQObject { diff --git a/tools/designer/examples/sizeaware/sizeaware.h b/tools/designer/examples/sizeaware/sizeaware.h index b939cfe4e..490c3b94a 100644 --- a/tools/designer/examples/sizeaware/sizeaware.h +++ b/tools/designer/examples/sizeaware/sizeaware.h @@ -1,6 +1,6 @@ #ifndef SIZEAWARE_H #define SIZEAWARE_H -#include +#include class SizeAware : public TQDialog { diff --git a/tools/designer/examples/vcr/vcr.cpp b/tools/designer/examples/vcr/vcr.cpp index d5b36f4d7..c8dff0c32 100644 --- a/tools/designer/examples/vcr/vcr.cpp +++ b/tools/designer/examples/vcr/vcr.cpp @@ -1,5 +1,5 @@ #include "vcr.h" -#include +#include #include static const char * rewind_xpm[] = { diff --git a/tools/designer/plugins/cppeditor/sourcetemplateinterfaceimpl.cpp b/tools/designer/plugins/cppeditor/sourcetemplateinterfaceimpl.cpp index fbf6f059d..82b41e77a 100644 --- a/tools/designer/plugins/cppeditor/sourcetemplateinterfaceimpl.cpp +++ b/tools/designer/plugins/cppeditor/sourcetemplateinterfaceimpl.cpp @@ -35,7 +35,7 @@ #include "sourcetemplateinterfaceimpl.h" #include #include "mainfilesettings.h" -#include +#include #include SourceTemplateInterfaceImpl::SourceTemplateInterfaceImpl() diff --git a/tools/designer/plugins/dlg/dlg2ui.cpp b/tools/designer/plugins/dlg/dlg2ui.cpp index 8978b88e8..753249e55 100644 --- a/tools/designer/plugins/dlg/dlg2ui.cpp +++ b/tools/designer/plugins/dlg/dlg2ui.cpp @@ -660,7 +660,7 @@ void Dlg2Ui::emitWidgetBody( const TQDomElement& e, bool layouted ) TQRegExp connex( TQString( "\\s*\\[(BaseClass|P(?:ublic|rotected))\\]\\s*([0-9A-Z_a-z]+)\\s*" "-->\\s*([0-9A-Z_a-z]+)\\s*(\\([^()]*\\))\\s*") ); - TQRegExp qdialogSlots( TQString( + TQRegExp tqdialogSlots( TQString( "done\\(\\s*int\\s*\\)|(?:accept|reject)\\(\\s*\\)") ); TQString userClassHeader; @@ -749,7 +749,7 @@ void Dlg2Ui::emitWidgetBody( const TQDomElement& e, bool layouted ) if ( connex.cap(1) != TQString("BaseClass") && - !qdialogSlots.exactMatch(c.slot) ) + !tqdialogSlots.exactMatch(c.slot) ) yySlots.insert( c.slot, connex.cap(1) ); } diff --git a/tools/designer/plugins/wizards/sqlformwizardimpl.cpp b/tools/designer/plugins/wizards/sqlformwizardimpl.cpp index ac721699c..6f8fce263 100644 --- a/tools/designer/plugins/wizards/sqlformwizardimpl.cpp +++ b/tools/designer/plugins/wizards/sqlformwizardimpl.cpp @@ -35,19 +35,19 @@ #include #include -#include -#include +#include +#include #include #include #include #include -#include +#include #include #include #include -#include -#include +#include +#include #include #ifndef TQT_NO_SQL diff --git a/tools/designer/shared/widgetdatabase.cpp b/tools/designer/shared/widgetdatabase.cpp index 332f16735..356a88a1a 100644 --- a/tools/designer/shared/widgetdatabase.cpp +++ b/tools/designer/shared/widgetdatabase.cpp @@ -64,14 +64,15 @@ static bool was_in_setup = FALSE; // It will be removed afterwards static TQString converted_widgets[] = { - "TQColorDialog", - "TQDateTimeEdit", "TQDesktopWidget", + "TQCheckBox", "TQColorDialog", "TQComboBox", + "TQDateTimeEdit", "TQDesktopWidget", "TQDial", "TQDialog", "TQFileDialog", "TQIconView", - "TQLabel", + "TQLabel", "TQLCDNumber", "TQLineEdit", "TQMainWindow", "TQMenuBar", - "TQPopupMenu", - "TQStatusBar", "TQSizeGrip", + "TQPopupMenu", "TQPushButton", + "TQRadioButton", + "TQScrollBar", "TQScrollView", "TQSizeGrip", "TQSlider", "TQSpinBox", "TQStatusBar", "TQTextBrowser", "TQTextEdit", "TQTextView", "TQToolBar", "TQToolBox", "TQToolButton", "TQToolTip", "TQWidget", "TQWidgetStack", "TQWorkspace" }; @@ -559,7 +560,7 @@ void WidgetDatabase::setupDataBase( int id ) r = new WidgetDatabaseRecord; r->iconSet = ""; r->name = "TQScrollView"; - r->includeFile = "ntqscrollview.h"; + r->includeFile = "tqscrollview.h"; r->group = widgetGroup( "Temp" ); r->isContainer = TRUE; diff --git a/tools/designer/uilib/tqwidgetfactory.cpp b/tools/designer/uilib/tqwidgetfactory.cpp index 03c0046cf..6bfe35607 100644 --- a/tools/designer/uilib/tqwidgetfactory.cpp +++ b/tools/designer/uilib/tqwidgetfactory.cpp @@ -59,10 +59,10 @@ #endif // include all TQt widgets we support -#include +#include #include -#include -#include +#include +#include #include #include #include @@ -72,26 +72,26 @@ #endif #include #include -#include -#include +#include +#include #include #include #include #include -#include -#include +#include +#include #include -#include +#include #include #include #include -#include -#include +#include +#include #include #include #include #include -#include +#include #include #include #include diff --git a/tools/linguist/book/linguist-programmer.leaf b/tools/linguist/book/linguist-programmer.leaf index 663f5fc40..7fa18a15f 100644 --- a/tools/linguist/book/linguist-programmer.leaf +++ b/tools/linguist/book/linguist-programmer.leaf @@ -121,13 +121,13 @@ will fall back to using the original source text. User-visible strings are marked as translation targets by wrapping them in a \c tr() call, for example: \code - button = new QPushButton( "&Quit", this ); + button = new TQPushButton( "&Quit", this ); \endcode would become \code - button = new QPushButton( tr("&Quit"), this); + button = new TQPushButton( tr("&Quit"), this); \endcode \index TQ_OBJECT @@ -140,7 +140,7 @@ usually called as a member function of a \l TQObject subclass, in other cases an explicit class name can be supplied, for example: \code - QPushButton::tr("&Quit") + TQPushButton::tr("&Quit") \endcode or @@ -167,13 +167,13 @@ differ between the two. This is easily achieved using the two argument form of the \c tr() call, e.g. \code - rbc = new QRadioButton( tr("Enabled", "Color frame"), this ); + rbc = new TQRadioButton( tr("Enabled", "Color frame"), this ); \endcode and \code - rbh = new QRadioButton( tr("Enabled", "Hue frame"), this ); + rbh = new TQRadioButton( tr("Enabled", "Hue frame"), this ); \endcode \index Ctrl Key @@ -374,7 +374,7 @@ translation appears; if not, the source text appears. All classes that inherit \l TQObject have a \c tr() function. Inside a member function of a \l TQObject class, we simply write \c tr("Hello -world!") instead of \c QPushButton::tr("Hello world!") or \c +world!") instead of \c TQPushButton::tr("Hello world!") or \c TQObject::tr("Hello world!"). \section3 Running the Application in English @@ -461,7 +461,7 @@ the current directory, containing this: \code - QPushButton + TQPushButton Hello world! @@ -486,7 +486,7 @@ To start \e {Qt Linguist}, type linguist tt1_la.ts \endcode -You should now see the text "QPushButton" in the top left pane. +You should now see the text "TQPushButton" in the top left pane. Double-click it, then click on "Hello world!" and enter "Orbis, te saluto!" in the \e Translation pane (the middle right of the window). Don't forget the exclamation mark! @@ -614,8 +614,8 @@ conflicts. In \c arrowpad.cpp we implement the \c ArrowPad class. \quotefile tt2/arrowpad.cpp -\skipto QPushButton -\printline QPushButton +\skipto TQPushButton +\printline TQPushButton We call \c ArrowPad::tr() for each button's label since the labels are user-visible text. @@ -958,16 +958,16 @@ second argument "two-sided" in the appropriate \c tr() calls to the first pair of radio buttons: \code - but = new QRadioButton( tr("Enabled", "two-sided"), twoSided ); - but = new QRadioButton( tr("Disabled", "two-sided"), twoSided ); + but = new TQRadioButton( tr("Enabled", "two-sided"), twoSided ); + but = new TQRadioButton( tr("Disabled", "two-sided"), twoSided ); \endcode and add the second argument "colors" in the appropriate \c tr() calls for the second pair of radio buttons: \code - but = new QRadioButton( tr("Enabled", "colors"), colors ); - but = new QRadioButton( tr("Disabled", "colors"), colors ); + but = new TQRadioButton( tr("Enabled", "colors"), colors ); + but = new TQRadioButton( tr("Disabled", "colors"), colors ); \endcode \index lupdate diff --git a/tools/linguist/linguist/finddialog.cpp b/tools/linguist/linguist/finddialog.cpp index 26663bf3d..8369df80d 100644 --- a/tools/linguist/linguist/finddialog.cpp +++ b/tools/linguist/linguist/finddialog.cpp @@ -39,11 +39,11 @@ #include "finddialog.h" -#include +#include #include #include -#include -#include +#include +#include #include FindDialog::FindDialog( bool replace, TQWidget *parent, const char *name, diff --git a/tools/linguist/linguist/finddialog.h b/tools/linguist/linguist/finddialog.h index c2576002e..ae922b84d 100644 --- a/tools/linguist/linguist/finddialog.h +++ b/tools/linguist/linguist/finddialog.h @@ -34,7 +34,7 @@ #ifndef FINDDIALOG_H #define FINDDIALOG_H -#include +#include class TQCheckBox; class TQLineEdit; diff --git a/tools/linguist/linguist/msgedit.cpp b/tools/linguist/linguist/msgedit.cpp index 292fbc153..16bab1075 100644 --- a/tools/linguist/linguist/msgedit.cpp +++ b/tools/linguist/linguist/msgedit.cpp @@ -43,13 +43,13 @@ #include "simtexth.h" #include -#include +#include #include #include #include #include #include -#include +#include #include #include #include @@ -59,7 +59,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tools/linguist/linguist/msgedit.h b/tools/linguist/linguist/msgedit.h index 0ca95bcf7..d631a0048 100644 --- a/tools/linguist/linguist/msgedit.h +++ b/tools/linguist/linguist/msgedit.h @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tools/linguist/linguist/phrasebookbox.cpp b/tools/linguist/linguist/phrasebookbox.cpp index 90ebdd950..a272a35ba 100644 --- a/tools/linguist/linguist/phrasebookbox.cpp +++ b/tools/linguist/linguist/phrasebookbox.cpp @@ -43,9 +43,9 @@ #include #include #include -#include +#include #include -#include +#include #include PhraseBookBox::PhraseBookBox( const TQString& filename, diff --git a/tools/linguist/linguist/phrasebookbox.h b/tools/linguist/linguist/phrasebookbox.h index 64071000a..d09ec3787 100644 --- a/tools/linguist/linguist/phrasebookbox.h +++ b/tools/linguist/linguist/phrasebookbox.h @@ -36,7 +36,7 @@ #include "phrase.h" -#include +#include #include class TQLineEdit; diff --git a/tools/linguist/tutorial/tt1/main.cpp b/tools/linguist/tutorial/tt1/main.cpp index 43c6da732..977d18e88 100644 --- a/tools/linguist/tutorial/tt1/main.cpp +++ b/tools/linguist/tutorial/tt1/main.cpp @@ -5,7 +5,7 @@ ****************************************************************/ #include -#include +#include #include diff --git a/tools/linguist/tutorial/tt2/arrowpad.cpp b/tools/linguist/tutorial/tt2/arrowpad.cpp index d96f8f596..c25d3817f 100644 --- a/tools/linguist/tutorial/tt2/arrowpad.cpp +++ b/tools/linguist/tutorial/tt2/arrowpad.cpp @@ -6,7 +6,7 @@ #include "arrowpad.h" -#include +#include ArrowPad::ArrowPad( TQWidget *parent, const char *name ) : TQGrid( 3, Horizontal, parent, name ) diff --git a/tools/linguist/tutorial/tt3/printpanel.cpp b/tools/linguist/tutorial/tt3/printpanel.cpp index 3f8f6eda4..ad8bd7ebb 100644 --- a/tools/linguist/tutorial/tt3/printpanel.cpp +++ b/tools/linguist/tutorial/tt3/printpanel.cpp @@ -7,7 +7,7 @@ #include "printpanel.h" #include -#include +#include #include PrintPanel::PrintPanel( TQWidget *parent, const char *name ) diff --git a/tools/qtconfig/mainwindow.cpp b/tools/qtconfig/mainwindow.cpp index da33fbd0b..4e3ab416b 100644 --- a/tools/qtconfig/mainwindow.cpp +++ b/tools/qtconfig/mainwindow.cpp @@ -38,15 +38,15 @@ #include #include -#include +#include #include #include #include #include -#include +#include #include -#include -#include +#include +#include #include #include #include diff --git a/tools/qtconfig/paletteeditoradvanced.cpp b/tools/qtconfig/paletteeditoradvanced.cpp index 2d3829fd9..959017cce 100644 --- a/tools/qtconfig/paletteeditoradvanced.cpp +++ b/tools/qtconfig/paletteeditoradvanced.cpp @@ -34,10 +34,10 @@ #include "paletteeditoradvanced.h" #include "colorbutton.h" -#include -#include +#include +#include #include -#include +#include #include #include #include diff --git a/translations/qt_ar.ts b/translations/qt_ar.ts index 9a9bb96d1..848762c89 100644 --- a/translations/qt_ar.ts +++ b/translations/qt_ar.ts @@ -392,7 +392,7 @@ - QDialog + TQDialog What's This? ما هذا؟ @@ -1113,7 +1113,7 @@ Check path and filename. - QLineEdit + TQLineEdit &Undo &تراجع diff --git a/translations/qt_ca.ts b/translations/qt_ca.ts index 96a8a46ff..dacd542e0 100644 --- a/translations/qt_ca.ts +++ b/translations/qt_ca.ts @@ -393,7 +393,7 @@ - QDialog + TQDialog What's This? Què és això? @@ -1114,7 +1114,7 @@ Comprova la ruta i el nom de fitxer. - QLineEdit + TQLineEdit &Undo &Desfés diff --git a/translations/qt_cs.ts b/translations/qt_cs.ts index 2dcfaf650..a087ac2bb 100644 --- a/translations/qt_cs.ts +++ b/translations/qt_cs.ts @@ -394,7 +394,7 @@ - QDialog + TQDialog What's This? Co je toto? @@ -1115,7 +1115,7 @@ překontrolujte cestu a jméno souboru. - QLineEdit + TQLineEdit &Undo &Zpět diff --git a/translations/qt_de.ts b/translations/qt_de.ts index da5585f93..ad0966a80 100644 --- a/translations/qt_de.ts +++ b/translations/qt_de.ts @@ -436,7 +436,7 @@ - QDialog + TQDialog What's This? Direkthilfe @@ -1208,7 +1208,7 @@ Datei wurde nicht gefunden. - QLineEdit + TQLineEdit Clear Löschen diff --git a/translations/qt_es.ts b/translations/qt_es.ts index d0dec0ecb..42ee2c3ea 100644 --- a/translations/qt_es.ts +++ b/translations/qt_es.ts @@ -394,7 +394,7 @@ - QDialog + TQDialog What's This? ¿Qué es ésto? @@ -1115,7 +1115,7 @@ Comprueba la ruta y el nombre del fichero. - QLineEdit + TQLineEdit &Undo &Deshacer diff --git a/translations/qt_fr.ts b/translations/qt_fr.ts index 57e3ee3b8..1c7020ec2 100644 --- a/translations/qt_fr.ts +++ b/translations/qt_fr.ts @@ -435,7 +435,7 @@ - QDialog + TQDialog What's This? Qu'est-ce que c'est ? @@ -1215,7 +1215,7 @@ Vérifier le chemin et le nom du fichier. - QLineEdit + TQLineEdit Clear Effacer diff --git a/translations/qt_he.ts b/translations/qt_he.ts index 7b7c743ee..62ab20754 100644 --- a/translations/qt_he.ts +++ b/translations/qt_he.ts @@ -434,7 +434,7 @@ - QDialog + TQDialog What's This? מה זה? @@ -1202,7 +1202,7 @@ Check path and filename. - QLineEdit + TQLineEdit &Undo &בטל diff --git a/translations/qt_it.ts b/translations/qt_it.ts index 107728016..f063807c8 100644 --- a/translations/qt_it.ts +++ b/translations/qt_it.ts @@ -394,7 +394,7 @@ - QDialog + TQDialog What's This? Che cos'è? @@ -1115,7 +1115,7 @@ Controllare il percorso e il nome del file. - QLineEdit + TQLineEdit &Undo &Annulla diff --git a/translations/qt_ja.ts b/translations/qt_ja.ts index f8c9b8113..58c90108b 100644 --- a/translations/qt_ja.ts +++ b/translations/qt_ja.ts @@ -392,7 +392,7 @@ - QDialog + TQDialog What's This? ヒント('S) @@ -1113,7 +1113,7 @@ Check path and filename. - QLineEdit + TQLineEdit &Undo 元に戻す(&U) diff --git a/translations/qt_nb.ts b/translations/qt_nb.ts index 0970468f6..7b82d8b2d 100644 --- a/translations/qt_nb.ts +++ b/translations/qt_nb.ts @@ -394,7 +394,7 @@ - QDialog + TQDialog What's This? Hva er dette? @@ -1115,7 +1115,7 @@ Kontroller filsti og filnavn. - QLineEdit + TQLineEdit &Undo &Angre diff --git a/translations/qt_pt-br.ts b/translations/qt_pt-br.ts index 849b5e9cb..a2012c22a 100644 --- a/translations/qt_pt-br.ts +++ b/translations/qt_pt-br.ts @@ -394,7 +394,7 @@ - QDialog + TQDialog What's This? O Que é Isso? @@ -1115,7 +1115,7 @@ Verificar caminho e nome do arquivo. - QLineEdit + TQLineEdit &Undo &Desfazer diff --git a/translations/qt_pt.ts b/translations/qt_pt.ts index 37fc52ca5..06968aed2 100644 --- a/translations/qt_pt.ts +++ b/translations/qt_pt.ts @@ -394,7 +394,7 @@ - QDialog + TQDialog What's This? O Que é Isso? @@ -1115,7 +1115,7 @@ Verificar caminho e nome do ficheiro. - QLineEdit + TQLineEdit &Undo &Desfazer diff --git a/translations/qt_ru.ts b/translations/qt_ru.ts index dda35f07b..cb231366c 100644 --- a/translations/qt_ru.ts +++ b/translations/qt_ru.ts @@ -446,7 +446,7 @@ - QDialog + TQDialog What's This? Что это такое? @@ -457,7 +457,7 @@ - QDialogButtons + TQDialogButtons Yes to All Да для всех @@ -1313,7 +1313,7 @@ Check path and filename. - QLineEdit + TQLineEdit &Undo &Отменить diff --git a/translations/qt_sk.ts b/translations/qt_sk.ts index b2e6fa112..ef6ea349f 100644 --- a/translations/qt_sk.ts +++ b/translations/qt_sk.ts @@ -394,7 +394,7 @@ - QDialog + TQDialog What's This? Čo je to? @@ -1115,7 +1115,7 @@ Overte cestu a názov súboru. - QLineEdit + TQLineEdit &Undo V&rátiť späť diff --git a/translations/qt_tr.ts b/translations/qt_tr.ts index f6afc0fb2..887525a23 100644 --- a/translations/qt_tr.ts +++ b/translations/qt_tr.ts @@ -394,7 +394,7 @@ - QDialog + TQDialog What's This? @@ -1104,7 +1104,7 @@ Check path and filename. - QLineEdit + TQLineEdit &Undo diff --git a/translations/qt_zh-cn.ts b/translations/qt_zh-cn.ts index 73c80cf26..07f4bde81 100644 --- a/translations/qt_zh-cn.ts +++ b/translations/qt_zh-cn.ts @@ -391,7 +391,7 @@ - QDialog + TQDialog What's This? 这是什么? @@ -1112,7 +1112,7 @@ Check path and filename. - QLineEdit + TQLineEdit &Undo 撤消(&U) diff --git a/translations/qt_zh-tw.ts b/translations/qt_zh-tw.ts index 6c1d522f6..8c20ccb02 100644 --- a/translations/qt_zh-tw.ts +++ b/translations/qt_zh-tw.ts @@ -392,7 +392,7 @@ - QDialog + TQDialog What's This? 這是什麼? @@ -1113,7 +1113,7 @@ Check path and filename. - QLineEdit + TQLineEdit &Undo 復原(&U) diff --git a/translations/template.ts b/translations/template.ts index 9a77f25f1..a9e9bc7c2 100644 --- a/translations/template.ts +++ b/translations/template.ts @@ -392,7 +392,7 @@ - QDialog + TQDialog What's This? @@ -1102,7 +1102,7 @@ Check path and filename. - QLineEdit + TQLineEdit &Undo diff --git a/tutorial/t1/main.cpp b/tutorial/t1/main.cpp index 1b1874b79..c3fa55675 100644 --- a/tutorial/t1/main.cpp +++ b/tutorial/t1/main.cpp @@ -5,7 +5,7 @@ ****************************************************************/ #include -#include +#include int main( int argc, char **argv ) diff --git a/tutorial/t10/lcdrange.cpp b/tutorial/t10/lcdrange.cpp index 2a56b9ad2..3a69b92cf 100644 --- a/tutorial/t10/lcdrange.cpp +++ b/tutorial/t10/lcdrange.cpp @@ -6,8 +6,8 @@ #include "lcdrange.h" -#include -#include +#include +#include LCDRange::LCDRange( TQWidget *parent, const char *name ) : TQVBox( parent, name ) diff --git a/tutorial/t10/main.cpp b/tutorial/t10/main.cpp index 55f22285a..6c837573e 100644 --- a/tutorial/t10/main.cpp +++ b/tutorial/t10/main.cpp @@ -5,8 +5,8 @@ ****************************************************************/ #include -#include -#include +#include +#include #include #include diff --git a/tutorial/t11/lcdrange.cpp b/tutorial/t11/lcdrange.cpp index 2a56b9ad2..3a69b92cf 100644 --- a/tutorial/t11/lcdrange.cpp +++ b/tutorial/t11/lcdrange.cpp @@ -6,8 +6,8 @@ #include "lcdrange.h" -#include -#include +#include +#include LCDRange::LCDRange( TQWidget *parent, const char *name ) : TQVBox( parent, name ) diff --git a/tutorial/t11/main.cpp b/tutorial/t11/main.cpp index 3f0726300..2fc8a6634 100644 --- a/tutorial/t11/main.cpp +++ b/tutorial/t11/main.cpp @@ -5,8 +5,8 @@ ****************************************************************/ #include -#include -#include +#include +#include #include #include diff --git a/tutorial/t12/lcdrange.cpp b/tutorial/t12/lcdrange.cpp index f5b713a9a..30f097af8 100644 --- a/tutorial/t12/lcdrange.cpp +++ b/tutorial/t12/lcdrange.cpp @@ -6,8 +6,8 @@ #include "lcdrange.h" -#include -#include +#include +#include #include diff --git a/tutorial/t12/main.cpp b/tutorial/t12/main.cpp index db78662ef..94f2ba4c8 100644 --- a/tutorial/t12/main.cpp +++ b/tutorial/t12/main.cpp @@ -5,8 +5,8 @@ ****************************************************************/ #include -#include -#include +#include +#include #include #include diff --git a/tutorial/t13/gamebrd.cpp b/tutorial/t13/gamebrd.cpp index a0534c92b..d094c0358 100644 --- a/tutorial/t13/gamebrd.cpp +++ b/tutorial/t13/gamebrd.cpp @@ -9,8 +9,8 @@ #include #include #include -#include -#include +#include +#include #include #include "lcdrange.h" diff --git a/tutorial/t13/lcdrange.cpp b/tutorial/t13/lcdrange.cpp index 61717ff9c..c4371914e 100644 --- a/tutorial/t13/lcdrange.cpp +++ b/tutorial/t13/lcdrange.cpp @@ -6,8 +6,8 @@ #include "lcdrange.h" -#include -#include +#include +#include #include #include diff --git a/tutorial/t14/gamebrd.cpp b/tutorial/t14/gamebrd.cpp index dfebd2ca6..afecb3435 100644 --- a/tutorial/t14/gamebrd.cpp +++ b/tutorial/t14/gamebrd.cpp @@ -10,8 +10,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/tutorial/t14/lcdrange.cpp b/tutorial/t14/lcdrange.cpp index 61717ff9c..c4371914e 100644 --- a/tutorial/t14/lcdrange.cpp +++ b/tutorial/t14/lcdrange.cpp @@ -6,8 +6,8 @@ #include "lcdrange.h" -#include -#include +#include +#include #include #include diff --git a/tutorial/t15/main.h b/tutorial/t15/main.h index 0b3697514..93d4fad93 100644 --- a/tutorial/t15/main.h +++ b/tutorial/t15/main.h @@ -13,7 +13,7 @@ #include #include -#include +#include #include class MainObject; diff --git a/tutorial/t2/main.cpp b/tutorial/t2/main.cpp index 4490c6d67..cc1d59432 100644 --- a/tutorial/t2/main.cpp +++ b/tutorial/t2/main.cpp @@ -5,7 +5,7 @@ ****************************************************************/ #include -#include +#include #include diff --git a/tutorial/t3/main.cpp b/tutorial/t3/main.cpp index aa3d9f559..104e685b4 100644 --- a/tutorial/t3/main.cpp +++ b/tutorial/t3/main.cpp @@ -5,7 +5,7 @@ ****************************************************************/ #include -#include +#include #include #include diff --git a/tutorial/t4/main.cpp b/tutorial/t4/main.cpp index 583fe5566..79bceaab1 100644 --- a/tutorial/t4/main.cpp +++ b/tutorial/t4/main.cpp @@ -5,7 +5,7 @@ ****************************************************************/ #include -#include +#include #include diff --git a/tutorial/t5/main.cpp b/tutorial/t5/main.cpp index db3d2536d..01a129657 100644 --- a/tutorial/t5/main.cpp +++ b/tutorial/t5/main.cpp @@ -5,9 +5,9 @@ ****************************************************************/ #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/tutorial/t6/main.cpp b/tutorial/t6/main.cpp index e51340b5c..923162368 100644 --- a/tutorial/t6/main.cpp +++ b/tutorial/t6/main.cpp @@ -5,9 +5,9 @@ ****************************************************************/ #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/tutorial/t7/lcdrange.cpp b/tutorial/t7/lcdrange.cpp index c8a29e0ee..57b3adb2f 100644 --- a/tutorial/t7/lcdrange.cpp +++ b/tutorial/t7/lcdrange.cpp @@ -6,8 +6,8 @@ #include "lcdrange.h" -#include -#include +#include +#include LCDRange::LCDRange( TQWidget *parent, const char *name ) : TQVBox( parent, name ) diff --git a/tutorial/t7/main.cpp b/tutorial/t7/main.cpp index 2b95fd0d6..1b57c6bc7 100644 --- a/tutorial/t7/main.cpp +++ b/tutorial/t7/main.cpp @@ -5,8 +5,8 @@ ****************************************************************/ #include -#include -#include +#include +#include #include #include #include diff --git a/tutorial/t8/lcdrange.cpp b/tutorial/t8/lcdrange.cpp index 2a56b9ad2..3a69b92cf 100644 --- a/tutorial/t8/lcdrange.cpp +++ b/tutorial/t8/lcdrange.cpp @@ -6,8 +6,8 @@ #include "lcdrange.h" -#include -#include +#include +#include LCDRange::LCDRange( TQWidget *parent, const char *name ) : TQVBox( parent, name ) diff --git a/tutorial/t8/main.cpp b/tutorial/t8/main.cpp index 9e98f0722..186e3bc0e 100644 --- a/tutorial/t8/main.cpp +++ b/tutorial/t8/main.cpp @@ -5,8 +5,8 @@ ****************************************************************/ #include -#include -#include +#include +#include #include #include diff --git a/tutorial/t9/lcdrange.cpp b/tutorial/t9/lcdrange.cpp index 2a56b9ad2..3a69b92cf 100644 --- a/tutorial/t9/lcdrange.cpp +++ b/tutorial/t9/lcdrange.cpp @@ -6,8 +6,8 @@ #include "lcdrange.h" -#include -#include +#include +#include LCDRange::LCDRange( TQWidget *parent, const char *name ) : TQVBox( parent, name ) diff --git a/tutorial/t9/main.cpp b/tutorial/t9/main.cpp index 685ec68e9..42f358e1f 100644 --- a/tutorial/t9/main.cpp +++ b/tutorial/t9/main.cpp @@ -5,8 +5,8 @@ ****************************************************************/ #include -#include -#include +#include +#include #include #include -- cgit v1.2.3