diff --git a/harbour/ChangeLog b/harbour/ChangeLog index daf1338716..c7f0deab40 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,43 @@ The license applies to all entries newer than 2009-04-28. */ +2011-02-27 08:46 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbqt/qtcore/hbqt_hbqevents.cpp + ! Fixed to convert object name to uppercase when registering an event. + Francesco's patch with a twist to do less .toUpper() calls. + Pls test. + + + examples/hbqt_tut + + examples/hbqt_tut/hbmk.hbm + + examples/hbqt_tut/win01.prg + + examples/hbqt_tut/win10.prg + + examples/hbqt_tut/win20.prg + + examples/hbqt_tut/win02.prg + + examples/hbqt_tut/win11.prg + + examples/hbqt_tut/win21.prg + + examples/hbqt_tut/win12.prg + + examples/hbqt_tut/win03.prg + + examples/hbqt_tut/win13.prg + + examples/hbqt_tut/win04.prg + + examples/hbqt_tut/win14.prg + + examples/hbqt_tut/win05.prg + + examples/hbqt_tut/win15.prg + + examples/hbqt_tut/win06.prg + + examples/hbqt_tut/win07.prg + + examples/hbqt_tut/win16.prg + + examples/hbqt_tut/win08.prg + + examples/hbqt_tut/win17.prg + + examples/hbqt_tut/win09.prg + + examples/hbqt_tut/win18.prg + + examples/hbqt_tut/win19.prg + + examples/hbqt_tut/prova.ui + + examples/hbqt_tut/test.jpg + + examples/hbqt_tut/test.dbf + + Added HBQT tutorial created by Giovanni Di Maria. + ! Used hbformat to format them. + * Renamed a.jpg to test.jpg + + Added hbmk.hbm + 2011-02-27 00:24 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/qtcore/hbqt_hbqevents.cpp ! Fixed recent typo. Thanks Francesco. diff --git a/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp b/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp index e65f2a15b7..6994e25e4f 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp @@ -81,10 +81,10 @@ void hbqt_events_register_createobj( QEvent::Type eventtype, QByteArray szCreate if( iIndex == -1 ) { s_lstEvent << eventtype; - s_lstCreateObj << szCreateObj; + s_lstCreateObj << szCreateObj.toUpper(); } else - s_lstCreateObj[ iIndex ] = szCreateObj; + s_lstCreateObj[ iIndex ] = szCreateObj.toUpper(); } void hbqt_events_unregister_createobj( QEvent::Type eventtype ) diff --git a/harbour/examples/hbqt_tut/hbmk.hbm b/harbour/examples/hbqt_tut/hbmk.hbm new file mode 100644 index 0000000000..7f848e961e --- /dev/null +++ b/harbour/examples/hbqt_tut/hbmk.hbm @@ -0,0 +1,7 @@ +# +# $Id$ +# + +hbqt.hbc + +-w3 -es2 diff --git a/harbour/examples/hbqt_tut/prova.ui b/harbour/examples/hbqt_tut/prova.ui new file mode 100644 index 0000000000..6805d67bcf --- /dev/null +++ b/harbour/examples/hbqt_tut/prova.ui @@ -0,0 +1,209 @@ + + + MainWindow + + + + 0 + 0 + 657 + 400 + + + + MainWindow + + + + + + 10 + 20 + 87 + 27 + + + + PushButton + + + + + + 10 + 70 + 103 + 20 + + + + RadioButton + + + + + + 10 + 100 + 103 + 20 + + + + RadioButton + + + + + + 10 + 130 + 87 + 20 + + + + CheckBox + + + + + + 330 + 0 + 272 + 165 + + + + + + + 500 + 200 + 111 + 111 + + + + + + + 120 + 20 + 22 + 23 + + + + ... + + + + + + 120 + 130 + 177 + 25 + + + + + + + 20 + 210 + 261 + 61 + + + + + + + 20 + 280 + 110 + 25 + + + + + + + 20 + 320 + 118 + 23 + + + + 24 + + + + + + 340 + 320 + 251 + 16 + + + + Qt::Horizontal + + + + + + 340 + 180 + 110 + 25 + + + + + + + 340 + 220 + 118 + 25 + + + + + + + 20 + 180 + 261 + 25 + + + + + + + + 0 + 0 + 657 + 23 + + + + + File + + + + + + + + + diff --git a/harbour/examples/hbqt_tut/test.dbf b/harbour/examples/hbqt_tut/test.dbf new file mode 100644 index 0000000000..fabf6eeb6d Binary files /dev/null and b/harbour/examples/hbqt_tut/test.dbf differ diff --git a/harbour/examples/hbqt_tut/test.jpg b/harbour/examples/hbqt_tut/test.jpg new file mode 100644 index 0000000000..ef863852b3 Binary files /dev/null and b/harbour/examples/hbqt_tut/test.jpg differ diff --git a/harbour/examples/hbqt_tut/win01.prg b/harbour/examples/hbqt_tut/win01.prg new file mode 100644 index 0000000000..6fee32c5fc --- /dev/null +++ b/harbour/examples/hbqt_tut/win01.prg @@ -0,0 +1,15 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC oWnd + +PROCEDURE Main() + + s_qApp := QApplication() + oWnd := QMainWindow() + oWnd:setWindowTitle( "Finestra di Giovanni" ) + oWnd:resize( 640, 480 ) + oWnd:show() + s_qApp:exec() + + RETURN diff --git a/harbour/examples/hbqt_tut/win02.prg b/harbour/examples/hbqt_tut/win02.prg new file mode 100644 index 0000000000..36f066c0d2 --- /dev/null +++ b/harbour/examples/hbqt_tut/win02.prg @@ -0,0 +1,21 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC oWnd +STATIC calendario + +PROCEDURE Main() + + s_qApp := QApplication() + oWnd := QMainWindow() + oWnd:setWindowTitle( "Finestra di Giovanni" ) + oWnd:resize( 640, 480 ) + calendario := QCalendarWidget( oWnd ) + calendario:resize( 250, 200 ) + calendario:move( 50, 50 ) + calendario:setFirstDayOfWeek( 1 ) + calendario:setGridVisible( .T. ) + oWnd:show() + s_qApp:exec() + + RETURN diff --git a/harbour/examples/hbqt_tut/win03.prg b/harbour/examples/hbqt_tut/win03.prg new file mode 100644 index 0000000000..c6b47a7087 --- /dev/null +++ b/harbour/examples/hbqt_tut/win03.prg @@ -0,0 +1,32 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC oWnd +STATIC pulsante1 + +PROCEDURE Main() + + s_qApp := QApplication() + oWnd := QMainWindow() + oWnd:setWindowTitle( "Finestra di Giovanni" ) + oWnd:resize( 640, 480 ) + Pulsante1 := QPushButton( oWnd ) + Pulsante1:setText( "Premi per messaggio" ) + Pulsante1:resize( 300, 50 ) + Pulsante1:move( 50, 50 ) + Pulsante1:Connect( "clicked()", { || messaggio() } ) + oWnd:show() + s_qApp:exec() + + RETURN + +PROCEDURE messaggio + + STATIC oBox + + oBox := QMessageBox() + oBox:setInformativeText( "attenzione!!! " ) + oBox:setWindowTitle( "Informazione" ) + oBox:show() + + RETURN diff --git a/harbour/examples/hbqt_tut/win04.prg b/harbour/examples/hbqt_tut/win04.prg new file mode 100644 index 0000000000..97b4ff5da8 --- /dev/null +++ b/harbour/examples/hbqt_tut/win04.prg @@ -0,0 +1,33 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC oWnd + +PROCEDURE Main() + + LOCAL Pulsante1, Pulsante2 + + s_qApp := QApplication() + oWnd := QMainWindow() + oWnd:setWindowTitle( "Prova dei pulsanti" ) + oWnd:resize( 640, 480 ) + Pulsante1 := QPushButton( oWnd ) + Pulsante1:setText( "Quit" ) + Pulsante1:move( 50, 50 ) + Pulsante1:Connect( "clicked()", { || s_qApp:quit() } ) + Pulsante2 := QPushButton( oWnd ) + Pulsante2:setText( "Premere per modificare la barra del titolo" ) + Pulsante2:move( 50, 100 ) + Pulsante2:setIcon( QIcon( "Star_32.bmp" ) ) + Pulsante2:resize( 300, 50 ) + Pulsante2:Connect( "clicked()", { || modifica() } ) + oWnd:show() + s_qApp:exec() + + RETURN + +PROCEDURE modifica() + + oWnd:setWindowTitle( "Evviva, ci sono riuscito !!!!!!!!!!!!!" ) + + RETURN diff --git a/harbour/examples/hbqt_tut/win05.prg b/harbour/examples/hbqt_tut/win05.prg new file mode 100644 index 0000000000..a64d32992b --- /dev/null +++ b/harbour/examples/hbqt_tut/win05.prg @@ -0,0 +1,20 @@ +#include "hbqtgui.ch" + +STATIC s_qApp + +PROCEDURE Main() + + LOCAL oWnd + LOCAL oSBar + + s_qApp := QApplication() + oWnd := QMainWindow() + oWnd:show() + oWnd:setWindowTitle( "Harbour-Qt Implementation Test Dialog" ) + oWnd:resize( 640, 480 ) + oSBar := QStatusBar( oWnd ) + oWnd:setStatusBar( oSBar ) + oSBar:showMessage( "Harbour-QT Statusbar Ready!" ) + s_qApp:exec() + + RETURN diff --git a/harbour/examples/hbqt_tut/win06.prg b/harbour/examples/hbqt_tut/win06.prg new file mode 100644 index 0000000000..001508f2ec --- /dev/null +++ b/harbour/examples/hbqt_tut/win06.prg @@ -0,0 +1,28 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC oWnd +STATIC barra_schede +STATIC clienti, fornitori, magazzino + +PROCEDURE Main() + + s_qApp := QApplication() + oWnd := QMainWindow() + oWnd:setWindowTitle( "Finestra di Giovanni" ) + oWnd:resize( 500, 300 ) + barra_schede := QTabWidget( oWnd ) + barra_schede:resize( 400, 200 ) + barra_schede:move( 50, 50 ) + + clienti := QWidget() + fornitori := QWidget() + magazzino := QWidget() + + barra_schede:addTab( clienti, "Scheda Clienti" ) + barra_schede:addTab( fornitori, "Scheda Fornitori" ) + barra_schede:addTab( magazzino, "Scheda Magazzino" ) + oWnd:show() + s_qApp:exec() + + RETURN diff --git a/harbour/examples/hbqt_tut/win07.prg b/harbour/examples/hbqt_tut/win07.prg new file mode 100644 index 0000000000..e85fdf75a0 --- /dev/null +++ b/harbour/examples/hbqt_tut/win07.prg @@ -0,0 +1,29 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC oWnd +STATIC testo +STATIC orolo + +PROCEDURE Main() + + s_qApp := QApplication() + oWnd := QMainWindow() + oWnd:setWindowTitle( "Finestra di Giovanni" ) + oWnd:resize( 640, 480 ) + testo := Qlabel( oWnd ) + testo:setText( "clocking..." ) + testo:move( 100, 100 ) + orolo := QTimer() + orolo:Connect( "timeout()", { || stampa_orologio() } ) + orolo:start( 1000 ) + oWnd:show() + s_qApp:exec() + + RETURN + +PROCEDURE stampa_orologio + + testo:setText( Time() ) + + RETURN diff --git a/harbour/examples/hbqt_tut/win08.prg b/harbour/examples/hbqt_tut/win08.prg new file mode 100644 index 0000000000..024ec1f70b --- /dev/null +++ b/harbour/examples/hbqt_tut/win08.prg @@ -0,0 +1,50 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC oWnd +STATIC testo +STATIC orolo +STATIC pulsante_start, pulsante_stop + +PROCEDURE Main() + + s_qApp := QApplication() + oWnd := QMainWindow() + oWnd:setWindowTitle( "Finestra di Giovanni" ) + oWnd:resize( 640, 480 ) + testo := Qlabel( oWnd ) + testo:setText( "clocking..." ) + testo:move( 100, 100 ) + testo:resize( 200, 100 ) + orolo := QTimer() + orolo:Connect( "timeout()", { || stampa_orologio() } ) + pulsante_start := QPushButton( oWnd ) + pulsante_start:move( 300, 100 ) + pulsante_start:setText( "Start" ) + pulsante_start:connect( "pressed()", { || start() } ) + pulsante_stop := QPushButton( oWnd ) + pulsante_stop:move( 300, 200 ) + pulsante_stop:setText( "Stop" ) + pulsante_stop:connect( "pressed()", { || stop() } ) + oWnd:show() + s_qApp:exec() + + RETURN + +PROCEDURE stampa_orologio + + testo:setText( Time() ) + + RETURN + +PROCEDURE start + + orolo:start( 1000 ) + + RETURN + +PROCEDURE stop + + orolo:stop() + + RETURN diff --git a/harbour/examples/hbqt_tut/win09.prg b/harbour/examples/hbqt_tut/win09.prg new file mode 100644 index 0000000000..a0a884d23a --- /dev/null +++ b/harbour/examples/hbqt_tut/win09.prg @@ -0,0 +1,22 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC oWnd + +PROCEDURE Main() + + LOCAL Pulsante1 + + s_qApp := QApplication() + oWnd := QMainWindow() + oWnd:setWindowTitle( "Prova dei pulsanti" ) + oWnd:resize( 300, 200 ) + Pulsante1 := QPushButton( oWnd ) + Pulsante1:setText( "Quit" ) + Pulsante1:move( 50, 50 ) + Pulsante1:Connect( "clicked()", { || s_qApp:quit() } ) + Pulsante1:setStyleSheet( "background-color: yellow; border: 2px solid #FF0000;" ) + oWnd:show() + s_qApp:exec() + + RETURN diff --git a/harbour/examples/hbqt_tut/win10.prg b/harbour/examples/hbqt_tut/win10.prg new file mode 100644 index 0000000000..f8ce8b1971 --- /dev/null +++ b/harbour/examples/hbqt_tut/win10.prg @@ -0,0 +1,53 @@ +#include "hbqtgui.ch" + +PROCEDURE Main() + + STATIC qApp + STATIC finestra + STATIC oMenuBar, oMenu1, oVoceIns, oVoceMod + + qApp := QApplication() + // ----------Impostazione Finestra----------- + finestra := QmainWindow() + finestra:SetFixedSize( 300, 200 ) + finestra:setWindowTitle( "Volto" ) + // ----------Impostazione Menu----------- + oMenuBar := QMenuBar( finestra ) + oMenuBar:resize( 700, 22 ) + oMenu1 := QMenu() + oMenu1:setTitle( "Anagrafica" ) + oVoceIns := QAction( oMenu1 ) + oVoceIns:setText( "Inserimento" ) + oVoceIns:connect( "triggered(bool)", { || inserimento() } ) + oVoceMod := QAction( oMenu1 ) + oVoceMod:setText( "Modifica" ) + oVoceMod:connect( "triggered(bool)", { || modifica() } ) + oMenu1:addAction( oVoceIns ) + oMenu1:addAction( oVoceMod ) + oMenuBar:addMenu( oMenu1 ) + finestra:Show() + qApp:exec() + + RETURN + +PROCEDURE inserimento() + + STATIC finestra2 + + finestra2 := QmainWindow() + finestra2:SetFixedSize( 640, 480 ) + finestra2:setWindowTitle( "Inserimento Anagrafica" ) + finestra2:Show() + + RETURN + +PROCEDURE modifica() + + STATIC finestra2 + + finestra2 := QmainWindow() + finestra2:SetFixedSize( 640, 480 ) + finestra2:setWindowTitle( "Modifica Anagrafica" ) + finestra2:Show() + + RETURN diff --git a/harbour/examples/hbqt_tut/win11.prg b/harbour/examples/hbqt_tut/win11.prg new file mode 100644 index 0000000000..82ebc29818 --- /dev/null +++ b/harbour/examples/hbqt_tut/win11.prg @@ -0,0 +1,17 @@ +#include "hbqtgui.ch" + +STATIC applicazione, finestra, ui, file + +PROCEDURE Main() + + applicazione := QApplication() + file := QFile( "prova.ui" ) + file:open( 1 ) + ui := QUiLoader() + finestra := ui:load( file ) + file:close() + finestra:show() + applicazione:exec() + applicazione:quit() + + RETURN diff --git a/harbour/examples/hbqt_tut/win12.prg b/harbour/examples/hbqt_tut/win12.prg new file mode 100644 index 0000000000..0f424d7923 --- /dev/null +++ b/harbour/examples/hbqt_tut/win12.prg @@ -0,0 +1,110 @@ +#include "hbqtgui.ch" + +STATIC tabella + +PROCEDURE Main() + + //------------Dichiarazioni-------------- + LOCAL applicazione, finestra + LOCAL cella, valore + LOCAL num_campi, num_record, intestazioni + LOCAL x, y + LOCAL pulsante_primo, pulsante_ultimo + applicazione := QApplication() + finestra := QMainWindow() + finestra:resize( 800, 600 ) + //------------Apre DBF e conta campi e record------------ + creafiletest() + USE test + num_record = RecCount() + num_campi = FCount() + //------------Dimensiona tabella-------------- + tabella := QTableWidget( finestra ) + tabella:move( 50, 50 ) + tabella:resize( 700, 450 ) + tabella:setRowCount( num_record ) + tabella:setColumnCount( num_campi ) + tabella:setColumnWidth( 0, 200 ) + //------------Riempie tabella-------------- + for x = 1 TO num_record + for y = 1 TO num_campi + cella := QTableWidgetItem() + valore = FieldGet( y ) + DO CASE + CASE ValType( valore ) = "C" + cella:setText( valore ) + CASE ValType( valore ) = "N" + cella:setText( AllTrim( Str(valore ) ) ) + CASE ValType( valore ) = "D" + cella:setText( Dtoc( valore ) ) + CASE ValType( valore ) = "L" + cella:setText( iif( valore = .T. ,"Yes","No" ) ) + end CASE + tabella:setItem( x - 1, y - 1, cella ) + next y + SKIP + next x + //------------Crea intestazioni tabella-------------- + intestazioni := QStringList() + for x = 1 TO 50 + intestazioni:append( field( x ) ) + next k + tabella:setHorizontalHeaderLabels( intestazioni ) + USE + //------------Pulsanti-------------- + pulsante_primo := QPushButton( finestra ) + pulsante_primo:move( 100, 520 ) + pulsante_primo:setText( "Primo" ) + pulsante_primo:Connect( "clicked()", { || primo() } ) + pulsante_ultimo := QPushButton( finestra ) + pulsante_ultimo:move( 300, 520 ) + pulsante_ultimo:setText( "Ultimo" ) + pulsante_ultimo:Connect( "clicked()", { || ultimo() } ) + //------------Esecuzione-------------- + finestra:show() + applicazione:exec() + applicazione:quit() + + RETURN + +PROCEDURE primo() + + tabella:scrollToTop() + tabella:setCurrentCell( 0, 0 ) + tabella:setFocus() + + RETURN + +PROCEDURE ultimo() + + tabella:scrollToBottom() + tabella:setCurrentCell( tabella:rowCount() - 1, 0 ) + tabella:setFocus() + + RETURN + +PROCEDURE creafiletest() + + IF .NOT. File( "test.dbf" ) + aCampi := {} + AAdd( aCampi, { "num", "N", 6, 0 } ) + AAdd( aCampi, { "nome", "C", 20, 0 } ) + AAdd( aCampi, { "cognome", "C", 25, 0 } ) + AAdd( aCampi, { "dt_nasc", "D", 8, 0 } ) + AAdd( aCampi, { "yesno", "L", 1, 0 } ) + dbCreate( "test.dbf", aCampi, "DBFNTX" ) + ENDIF + USE test + GO BOTTOM + m_num := test -> num + for i := 1 TO 50 + APPEND BLANK + test -> num := ++ m_num + test -> nome := "pippo" + test -> cognome := "pluto" + test -> dt_nasc := CToD( "10/12/2001" ) + test -> yesno := .F. + next + CLOSE test + + RETURN diff --git a/harbour/examples/hbqt_tut/win13.prg b/harbour/examples/hbqt_tut/win13.prg new file mode 100644 index 0000000000..e0541f2fcc --- /dev/null +++ b/harbour/examples/hbqt_tut/win13.prg @@ -0,0 +1,20 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC oWnd +STATIC stringa +STATIC dialogo + +PROCEDURE Main() + + s_qApp := QApplication() + oWnd := QMainWindow() + oWnd:setWindowTitle( "Finestra di Giovanni" ) + oWnd:resize( 400, 300 ) + oWnd:show() + dialogo := QInputDialog() + stringa = dialogo:getText( oWnd, "Titolo", "Come ti chiami?" ) + oWnd:setWindowTitle( stringa ) + s_qApp:exec() + + RETURN diff --git a/harbour/examples/hbqt_tut/win14.prg b/harbour/examples/hbqt_tut/win14.prg new file mode 100644 index 0000000000..8d7f0dcee6 --- /dev/null +++ b/harbour/examples/hbqt_tut/win14.prg @@ -0,0 +1,24 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC barra_progresso + +PROCEDURE Main() + + LOCAL k + + s_qApp := QApplication() + barra_progresso := QProgressBar() + barra_progresso:resize( 400, 50 ) + barra_progresso:move( 50, 50 ) + barra_progresso:setRange( 1, 500000 ) + barra_progresso:setWindowTitle( "Elaborazione in corso" ) + barra_progresso:Show() + barra_progresso:repaint() + for k = 1 TO 500000 + barra_progresso:setValue( k ) + next k + barra_progresso:quit() + s_qApp:exec() + + RETURN diff --git a/harbour/examples/hbqt_tut/win15.prg b/harbour/examples/hbqt_tut/win15.prg new file mode 100644 index 0000000000..61c67f67d7 --- /dev/null +++ b/harbour/examples/hbqt_tut/win15.prg @@ -0,0 +1,21 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC finestra +STATIC logo + +PROCEDURE Main() + + s_qApp := QApplication() + finestra := QmainWindow() + finestra:SetFixedSize( 400, 300 ) + finestra:setWindowTitle( "Finestra Giovanni" ) + logo := QLabel( finestra ) + logo:move( 50, 50 ) + logo:resize( 300, 200 ) + logo:SetPixmap( QPixmap( "test.jpg" ) ) + logo:setStyleSheet( "border: 2px solid #0000ff;" ) + finestra:show() + s_qApp:exec() + + RETURN diff --git a/harbour/examples/hbqt_tut/win16.prg b/harbour/examples/hbqt_tut/win16.prg new file mode 100644 index 0000000000..c20e380536 --- /dev/null +++ b/harbour/examples/hbqt_tut/win16.prg @@ -0,0 +1,20 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC oWnd +STATIC testo + +PROCEDURE Main() + + s_qApp := QApplication() + oWnd := QMainWindow() + oWnd:setWindowTitle( "Finestra di Giovanni" ) + oWnd:resize( 300, 200 ) + testo := Qlabel( oWnd ) + testo:setText( "Gio" ) + testo:move( 10, 10 ) + testo:resize( 280, 100 ) + oWnd:show() + s_qApp:exec() + + RETURN diff --git a/harbour/examples/hbqt_tut/win17.prg b/harbour/examples/hbqt_tut/win17.prg new file mode 100644 index 0000000000..ebca702117 --- /dev/null +++ b/harbour/examples/hbqt_tut/win17.prg @@ -0,0 +1,63 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC finestra +STATIC font +STATIC testo +STATIC palette +STATIC slider_rosso, slider_verde, slider_blu + +PROCEDURE Main() + + s_qApp := QApplication() + finestra := QMainWindow() + finestra:resize( 320, 400 ) + finestra:setWindowTitle( "Giovanni" ) + font := QFont() + font:setPointSize( 30 ) + font:setBold( .T. ) + testo := QLabel( finestra ) + testo:setText( "Colori" ) + testo:move( 100, 10 ) + testo:resize( 200, 100 ) + testo:setfont( font ) + slider_rosso := QSlider( finestra ) + slider_rosso:resize( 30, 200 ) + slider_rosso:move( 100, 120 ) + slider_rosso:setMinimum( 0 ) + slider_rosso:setMaximum( 255 ) + slider_rosso:setSingleStep( 1 ) + slider_rosso:setPageStep( 10 ) + slider_rosso:setValue( 0 ) + slider_rosso:Connect( "valueChanged(int)", { || cambia_colori() } ) + slider_verde := QSlider( finestra ) + slider_verde:resize( 30, 200 ) + slider_verde:move( 150, 120 ) + slider_verde:setMinimum( 0 ) + slider_verde:setMaximum( 255 ) + slider_verde:setSingleStep( 1 ) + slider_verde:setPageStep( 10 ) + slider_verde:setValue( 0 ) + slider_verde:Connect( "valueChanged(int)", { || cambia_colori() } ) + slider_blu := QSlider( finestra ) + slider_blu:resize( 30, 200 ) + slider_blu:move( 200, 120 ) + slider_blu:setMinimum( 0 ) + slider_blu:setMaximum( 255 ) + slider_blu:setSingleStep( 1 ) + slider_blu:setPageStep( 10 ) + slider_blu:setValue( 0 ) + slider_blu:Connect( "valueChanged(int)", { || cambia_colori() } ) + finestra:show() + s_qApp:exec() + + RETURN + +PROCEDURE cambia_colori() + + palette := QPalette() + palette:SetColor( QPalette_WindowText, QColor( slider_rosso:value , slider_verde:value , slider_blu:value ) ) + testo:setPalette( palette ) + + RETURN + diff --git a/harbour/examples/hbqt_tut/win18.prg b/harbour/examples/hbqt_tut/win18.prg new file mode 100644 index 0000000000..0cb65d066e --- /dev/null +++ b/harbour/examples/hbqt_tut/win18.prg @@ -0,0 +1,40 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC finestra +STATIC font +STATIC testo +STATIC modificatore + +PROCEDURE Main() + + s_qApp := QApplication() + finestra := QMainWindow() + finestra:resize( 320, 200 ) + finestra:setWindowTitle( "Giovanni" ) + font := QFont() + font:setPointSize( 30 ) + testo := QLabel( finestra ) + testo:setText( "Testo" ) + testo:move( 10, 10 ) + testo:resize( 280, 100 ) + testo:setfont( font ) + modificatore := QSpinBox( finestra ) + modificatore:move( 50, 150 ) + modificatore:resize( 50, 25 ) + modificatore:Connect( "valueChanged(int)", { || cambia_dimensione() } ) + modificatore:setMinimum( 1 ) + modificatore:setMaximum( 72 ) + modificatore:setSingleStep( 1 ) + modificatore:setValue( 30 ) + finestra:show() + s_qApp:exec() + + RETURN + +PROCEDURE cambia_dimensione() + + font:setPointSize( modificatore:value ) + testo:setfont( font ) + + RETURN diff --git a/harbour/examples/hbqt_tut/win19.prg b/harbour/examples/hbqt_tut/win19.prg new file mode 100644 index 0000000000..8432c28f5b --- /dev/null +++ b/harbour/examples/hbqt_tut/win19.prg @@ -0,0 +1,27 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC finestra +STATIC casella + +PROCEDURE Main() + + s_qApp := QApplication() + finestra := QMainWindow() + finestra:resize( 320, 200 ) + finestra:setWindowTitle( "Giovanni" ) + casella := QComboBox( finestra ) + casella:move( 100, 50 ) + casella:resize( 100, 25 ) + casella:addItem( "Francia" ) + casella:addItem( "Italia" ) + casella:addItem( "U.S.A." ) + casella:addItem( "Germania" ) + casella:addItem( "Belgio" ) + casella:addItem( "Spagna" ) + casella:addItem( "Portogallo" ) + casella:addItem( "Islanda" ) + finestra:show() + s_qApp:exec() + + RETURN diff --git a/harbour/examples/hbqt_tut/win20.prg b/harbour/examples/hbqt_tut/win20.prg new file mode 100644 index 0000000000..5af3a0bab4 --- /dev/null +++ b/harbour/examples/hbqt_tut/win20.prg @@ -0,0 +1,32 @@ +STATIC s_qApp +STATIC finestra +STATIC testo +STATIC font +STATIC casella + +PROCEDURE Main() + + s_qApp := QApplication() + finestra := QMainWindow() + finestra:resize( 320, 200 ) + finestra:setWindowTitle( "Giovanni" ) + font := QFont() + testo := Qlabel( finestra ) + testo:setText( "Ciao a tutti" ) + testo:resize( 200, 80 ) + testo:move( 50, 20 ) + testo:setfont( font ) + casella := QFontComboBox( finestra ) + casella:move( 50, 100 ) + casella:resize( 200, 25 ) + casella:Connect( "currentFontChanged(QFont)", { || cambia_testo() } ) + finestra:show() + s_qApp:exec() + + RETURN + +PROCEDURE cambia_testo + + testo:setFont( casella:currentFont() ) + + RETURN diff --git a/harbour/examples/hbqt_tut/win21.prg b/harbour/examples/hbqt_tut/win21.prg new file mode 100644 index 0000000000..0bd8c9b851 --- /dev/null +++ b/harbour/examples/hbqt_tut/win21.prg @@ -0,0 +1,50 @@ +#include "hbqtgui.ch" + +STATIC s_qApp +STATIC finestra +STATIC lcd +STATIC pulsante_diminuisci, pulsante_aumenta + +PROCEDURE Main() + + s_qApp := QApplication() + finestra := QMainWindow() + finestra:resize( 300, 200 ) + finestra:setWindowTitle( "Giovanni" ) + lcd := QLCDNumber( finestra ) + lcd:move( 50, 50 ) + lcd:resize( 200, 50 ) + pulsante_diminuisci := QPushButton( finestra ) + pulsante_diminuisci:resize( 30, 30 ) + pulsante_diminuisci:move( 70, 130 ) + pulsante_diminuisci:setText( "-" ) + pulsante_diminuisci:Connect( "clicked()", { || decrementa() } ) + pulsante_aumenta := QPushButton( finestra ) + pulsante_aumenta:resize( 30, 30 ) + pulsante_aumenta:move( 200, 130 ) + pulsante_aumenta:setText( "+" ) + pulsante_aumenta:Connect( "clicked()", { || incrementa() } ) + finestra:show() + s_qApp:exec() + + RETURN + +PROCEDURE incrementa() + + LOCAL x + + x = lcd:value() + x ++ + lcd:display( x ) + + RETURN + +PROCEDURE decrementa() + + LOCAL x + + x = lcd:value() + x -- + lcd:display( x ) + + RETURN