Window
The following example shows how to create a simple main window. The window is resizable.
#include "hbqtgui.ch"
PROCEDURE Main()
LOCAL oWnd
oWnd := QMainWindow()
oWnd:setWindowTitle( "Finestra di Giovanni" )
oWnd:resize( 300, 200 )
oWnd:show()
QApplication():exec()
RETURN
Window not resizable
The following example shows how to create a simple main window. The window is NOT resizable.
#include "hbqtgui.ch"
PROCEDURE Main()
LOCAL oWnd
oWnd := QMainWindow()
oWnd:setWindowTitle( "Finestra di Giovanni" )
oWnd:setFixedSize( 200, 200 )
oWnd:show()
QApplication():exec()
RETURN
Window with fixed width
The following example shows how to create a simple main window. The width is locked and the height is resizable.
#include "hbqtgui.ch"
PROCEDURE Main()
LOCAL oWnd
oWnd := QMainWindow()
oWnd:setWindowTitle( "Finestra di Giovanni" )
oWnd:setFixedWidth( 500 )
oWnd:show()
QApplication():exec()
RETURN
Window with fixed height
The following example shows how to create a simple main window. The height is locked and the width is resizable.
PROCEDURE Main()
LOCAL oWnd
oWnd := QMainWindow()
oWnd:setWindowTitle( "Finestra di Giovanni" )
oWnd:setFixedHeight( 300 )
oWnd:show()
QApplication():exec()
RETURN
Blinking Title Bar
The following example shows how to create a blinking title bar.
#include "hbqtgui.ch"
PROCEDURE Main()
LOCAL oWnd
LOCAL oClock
oWnd := QMainWindow()
oWnd:resize( 300, 200 )
oWnd:setWindowTitle( "Finestra di Giovanni" )
oClock := QTimer()
oClock:Connect( "timeout()", { || toggle( oWnd ) } )
oClock:start( 500 )
oWnd:show()
QApplication():exec()
oClock:stop()
RETURN
PROCEDURE toggle( o )
IF o:WindowTitle = "Finestra di Giovanni"
o:setWindowTitle( "" )
ELSE
o:setWindowTitle( "Finestra di Giovanni" )
ENDIF
RETURN
Colored Window (QSS)
The following example shows how to create a colored main window, using QSS.
#include "hbqtgui.ch"
PROCEDURE Main()
LOCAL oWnd
oWnd := QMainWindow()
oWnd:setWindowTitle( "Finestra di Giovanni" )
oWnd:resize( 300, 200 )
oWnd:setStyleSheet( " background-color: #CCCCFF; " )
oWnd:show()
QApplication():exec()
RETURN
PROCEDURE Main()
LOCAL oWnd
oWnd := QMainWindow()
oWnd:setWindowTitle( "Finestra di Giovanni" )
oWnd:resize( 300, 200 )
oWnd:setStyleSheet( " background-color: #CCCCFF; " )
oWnd:show()
QApplication():exec()
RETURN
Colored Window (QPalette)
The following example shows how to create a colored main window, using Qpalette.
#include "hbqtgui.ch"
PROCEDURE Main()
LOCAL oWnd
LOCAL oPalette
oWnd := QMainWindow()
oWnd:setWindowTitle( "Finestra di Giovanni" )
oWnd:resize( 300, 200 )
oPalette := QPalette()
oPalette:SetColor( QPalette_Window, QColor( 255,200,200 ) )
oWnd:setPalette( oPalette )
oWnd:show()
QApplication():exec()
RETURN
Window with background
The following example shows how to create a window with a background from an image.
#include "hbqtgui.ch"
PROCEDURE Main()
LOCAL oWnd, oButton
oWnd := QmainWindow()
oWnd:SetFixedSize( 400, 300 )
oWnd:setWindowTitle( "Finestra Giovanni" )
oWnd:setStyleSheet( "background-image: url(image.png) " )
oButton := QPushButton( oWnd )
oButton:setText( "Press" )
oButton:move( 150, 50 )
oButton:setStyleSheet( " background: #F4F4F0; " )
oWnd:show()
QApplication():exec()
RETURN