FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveTouch Aplicacion inicial
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Aplicacion inicial
Posted: Mon May 25, 2015 04:34 PM
Compa帽eros
Aqui dejo un peque帽o programa
Mi intencion es que me ayuden a ir ampliandolo poco a poco

Code (fw): Select all Collapse
#include "FiveTouch.ch"

function Main()

聽 聽local oDlg := QDialog()
聽 聽local x
聽 聽local y
聽 聽local oMainLayout 聽 := QVBoxLayout()
聽 聽local oIco1
聽 聽local oIco2
聽 聽local oIco3
聽 聽local oIco4
聽 聽local oIco5
聽 聽local oIco6
聽 聽local oIco7
聽 聽local oIco8
聽 聽local oBtn1
聽 聽local oBtn2
聽 聽local oBtn3
聽 聽local oBtn4
聽 聽local oBtn5
聽 聽local oBtn6
聽 聽local oBtn7
聽 聽local oBtn8

聽 聽local oBtnNew
聽 聽local oBtnClear
聽 聽local oBtnSave
聽 聽local oBtnEdit
聽 聽local oBtnClose

聽 聽local oButtonBar
聽 聽local oButtonBarLayout
聽 聽local oSuperLayout 聽 聽 := QVBoxLayout()
聽 聽local oCenterLayout
聽 聽local oInferLayout 聽 聽// := QHBoxLayout()
聽 聽local oFolder 聽 聽 聽 聽 聽:= QTabWidget()
聽 聽local oCenter
聽 聽local oFold1
聽 聽local oFold2
聽 聽local oFold3
聽 聽local oBar
聽 聽local oVarsList
聽 聽local oBrw
聽 聽local oModel
聽 聽local aValores 聽 聽 := { { "A","Primero" , Dtoc(Date()) },;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽{ "B","Segundo" , Dtoc(Date()) },;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽{ "C","Tercero" , Dtoc(Date()) },;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽{ "D","Cuarto" 聽, Dtoc(Date()) },;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽{ "E","Quinto" 聽, Dtoc(Date()) },;
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽{ "F","Sexto" 聽 , Dtoc(Date()) } }
聽 
聽 聽oDlg:SetStyleSheet( "background-color: rgba( 255, 255, 255, 255 );border: 0px solid white;" )
聽 聽oButtonBar 聽 聽 聽 := QWidget()
聽 聽oButtonBarLayout := QHBoxLayout()
聽 聽oDlg:SetLayout( oMainLayout )

聽 聽oDlg:SetLayout( oSuperLayout )
聽 聽//oDlg:SetLayout( oCenterLayout )
聽 聽//oDlg:SetLayout( oInferLayout )

聽 聽oDlg:SetWindowTitle( "Designer 01" ) 

聽 聽oButtonBarLayout := QHBoxLayout()
聽 聽oDlg:SetLayout( oButtonBarLayout )聽 聽

聽 聽oBar := QToolBar()
聽 聽oBar:SetStyleSheet( "background-color: rgba( 255, 255, 255, 255 );spacing: 0px;border-radius: 0px;" )
聽 聽oMainLayout:AddWidget( oBar )

聽 聽oBar:AddWidget( oBtn1 := QPushButton() )聽
聽 聽oBar:AddWidget( oBtn2 := QPushButton() )聽
聽 聽oBar:AddWidget( oBtn3 := QPushButton() )聽
聽 聽oBar:AddWidget( oBtn4 := QPushButton() )聽
聽 聽oBar:AddWidget( oBtn5 := QPushButton() )聽
聽 聽oBar:AddWidget( oBtn6 := QPushButton() )聽
聽 聽oBar:AddWidget( oBtn7 := QPushButton() )聽
聽 聽oBar:AddWidget( oBtn8 := QPushButton() )聽

聽 聽oBtn1:SetStyleSheet( "background-color: rgba( 255, 255, 255, 255 );border: 0px solid red;min-width: 30px;" )
聽 聽oIco1 = QLabel( oBtn1 )
聽 聽//oIco1:Move( 2, 1 )
聽 聽oIco1:SetPixmap( QPixmap( "g3749.png" ) ) //threelines.png" ) )

聽 聽oBtn2:SetStyleSheet( "background-color: rgba( 255, 255, 255, 255 );border: 0px solid red;min-width: 2em;" )
聽 聽oIco2 = QLabel( oBtn2 )
聽 聽oIco2:SetPixmap( QPixmap( "g4023.png" ) )

聽 聽oBtn3:SetStyleSheet( "background-color: rgba( 255, 255, 255, 255 );border: 0px solid red;min-width: 2em;" )
聽 聽oIco3 = QLabel( oBtn3 )
聽 聽oIco3:SetPixmap( QPixmap( "g4033.png" ) )

聽 聽oBtn4:SetStyleSheet( "background-color: rgba( 255, 255, 255, 255 );border: 0px solid red;min-width: 30px;" )
聽 聽//oBtn4:SetText( "FiveTouch" )
聽 聽oIco4 = QLabel( oBtn4 )
聽 聽oIco4:SetPixmap( QPixmap( "g3991.png" ) )

聽 聽oBtn5:SetStyleSheet( "background-color: rgba( 255, 255, 255, 255 );border: 0px solid red;min-width: 30px;" )
聽 聽oIco5 = QLabel( oBtn5 )
聽 聽oIco5:SetPixmap( QPixmap( "g3893.png" ) )

聽 聽oBtn6:SetStyleSheet( "background-color: rgba( 255, 255, 255, 255 );border: 0px solid red;min-width: 32px;" )
聽 聽oIco6 = QLabel( oBtn6 )
聽 聽oIco6:SetPixmap( QPixmap( "g3883.png" ) )

聽 聽oBtn7:SetStyleSheet( "background-color: rgba( 255, 255, 255, 255 );border: 0px solid red;min-width: 32px;" )
聽 聽oIco7 = QLabel( oBtn7 )
聽 聽oIco7:SetPixmap( QPixmap( "g3771.png" ) )

聽 聽oBtn8:SetStyleSheet( "background-color: rgba( 255, 255, 255, 255 );border: 0px solid red;min-width: 32px;" )
聽 聽oIco8 = QLabel( oBtn8 )
聽 聽oIco8:SetPixmap( QPixmap( "g653.png" ) )

聽 聽//// oBtn1:SetStyleSheet( "background-image: url('./threelines.jpg');" )
聽 聽oCenter 聽 聽:= QWidget()
聽 聽oCenter:SetLayout( oSuperLayout )
聽 聽oMainLayout:AddWidget( oCenter ) 聽 
聽 聽oCenter:SetStyleSheet( "background-color: rgba( 255, 255, 255, 200 );border: 0px solid white;" )
聽 聽oSuperLayout:AddWidget( oFolder )
聽 聽oFolder:AddTab( oFold1 := QWidget(), "Chats" )
聽 聽oFolder:AddTab( oFold2 := QWidget(), "Contactos" )
聽 聽oFolder:AddTab( oFold3 := QWidget(), "Llamadas" )
聽 聽oFolder:SetStyleSheet( "background-color: rgba( 255, 255, 255, 200 );border: 0px solid white;" ) 聽 
聽 聽//oFolder:setTabEnabled( 2, .F.)

聽 聽oBrw := QTableView( oFolder:CurrentWidget )
聽 聽oBrw:setStyleSheet( "background-color: rgba( 255, 255, 255, 200 );border: 0px solid white;" )
聽 聽oBrw:setshowgrid( .F. )
聽 聽//oBrw:setRowHeight(int row, int height)
聽 聽//oBrw:setColumnWidth(0, 10)
聽 聽oModel := QStandardItemModel( 10, 3, oFolder:CurrentWidget )
聽 聽//oModel:SetHorizontalHeaderItem( 0, QStandardItem( "Id" ) )
聽 聽//oModel:SetHorizontalHeaderItem( 1, QStandardItem( "Contact" ) )
聽 聽//oModel:SetHorizontalHeaderItem( 2, QStandardItem( "Date" ) )
聽 聽//oModel:takeHorizontalHeaderItem( 0 )
聽 聽//oModel:takeVerticalHeaderItem( 0 )
聽 聽For x = 1 to Len( aValores )
聽 聽 聽 聽For y = 1 to Len( aValores[ x ] )
聽 聽 聽 聽oModel:SetItem( x-1, y-1, QStandardItem( aValores[ x, y ] ) )
聽 聽 聽 聽Next y
聽 聽Next x
聽 聽oBrw:SetModel( oModel )
聽 聽//oBrw:clearSpans()
聽 聽oBrw:Resize( 314, 400 )

聽 聽oSuperLayout:AddWidget( oButtonBar )
聽 聽oButtonBar:SetLayout( oButtonBarLayout )聽
聽 聽oButtonBar:SetStyleSheet( "background-color: rgba( 255, 255, 255, 200 );border: 0px solid;spacing: 0px" )
聽 聽oButtonBarLayout:AddWidget( oBtnNew := QPushButton() )聽 聽
聽 聽oBtnNew:SetText( "New" )聽
聽 聽oBtnNew:SetStyleSheet( "background-color: rgba( 10, 10, 10, 220 );border: 0px solid white;font: bold 14px;border-radius: 0px;spacing: 0px;" )
聽 聽oButtonBarLayout:AddWidget( oBtnClear := QPushButton() )聽
聽 聽oBtnClear:SetText( "Clear" )
聽 聽oBtnClear:SetStyleSheet( "background-color: rgba( 10, 10, 10, 220 );border: 0px solid white;font: bold 14px;border-radius: 0px;spacing: 0px;" )
聽 聽//oButtonBarLayout:AddWidget( oBtnEdit := QPushButton() )聽 聽 
聽 聽//oBtnEdit:SetText( "Edit" ) 
聽 聽//oBtnEdit:SetStyleSheet( "background-color: rgba( 10, 10, 10, 220 );border: 0px solid white;font: bold 14px;border-radius: 0px;spacing: 0px;" )
聽 聽oButtonBarLayout:AddWidget( oBtnSave := QPushButton() )聽 
聽 聽oBtnSave:SetText( "Save" ) 
聽 聽oBtnSave:SetStyleSheet( "background-color: rgba( 10, 10, 10, 220 );border: 0px solid white;font: bold 14px;border-radius: 0px;spacing: 0px;" )
聽 聽oButtonBarLayout:AddWidget( oBtnClose := QPushButton() )聽
聽 聽oBtnClose:SetText( "Close" )
聽 聽oBtnClose:SetStyleSheet( "background-color: rgba( 10, 10, 10, 220 );border: 0px solid white;font: bold 14px;border-radius: 0px;spacing: 0px;" )
聽 聽oBtnClose:Connect( "clicked()", { || oDlg:End() } )

聽 聽oDlg:Resize( 300, 500 )
聽 聽oDlg:Exec()

return nil


Aqui dejo los pngs que hacen falta
https://www.dropbox.com/s/tx3vobgxiq01f ... s.zip?dl=0

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Aplicacion inicial
Posted: Mon May 25, 2015 10:28 PM

Cristobal,

Muy bueno!

Muchas gracias! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 492
Joined: Wed Nov 16, 2005 12:03 PM
Re: Aplicacion inicial
Posted: Wed Jun 03, 2015 11:55 PM

Crist贸bal
Excelente trabajo, pase dias buscando la asignacion de colores, recomiendo que empecemos construir un manual de desarrollo. Puedo aportar algunas de las funcionalidades que pude investigar.

Posts: 195
Joined: Fri Jan 23, 2009 02:50 AM
Re: Aplicacion inicial
Posted: Thu Jun 04, 2015 01:54 AM

Juan que bueno que participes con tus aportes

Quiero hacerte una pregunta.

En el editor de Fivetouch en fondo de los ejemplos es de color negro y letras blancas, tu de pronto me puedes dar la manos para cambiar el color de fondo y el de los textos
Cambio facil los tama帽os y los tipos de letra.

Tan pronto le de un poco mas de forma al proyecto lo publicare en este foro

un Abrazo

Jairo

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Aplicacion inicial
Posted: Thu Jun 04, 2015 08:55 AM

Juan, Jairo, esa es la idea, ir entre todos a帽adiendo detalles y funcionalidad.
La idea es hacer un peque帽o manual pr谩ctico con el desarrollo de la aplicacion
Saludos

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 492
Joined: Wed Nov 16, 2005 12:03 PM
Re: Aplicacion inicial
Posted: Thu Jun 11, 2015 05:40 AM

Crist贸bal,
Encontr茅 esta documentaci贸n:

http://choccac.com/?wpfb_dl=1

TEMA!22
BASES!DE!DATOS
La!gran!mayor铆a!de!aplicaciones!de!gesti贸n,!suelen!guardar!toda!la!ingente!cantidad!de!
datos!que!maneja!en!un!motor!de!base!de!datos.!Qt!en!su!versi贸n!privativa!incluye!los!drivers!de!
la!mayor铆a! de!motores! de! datos.!Qt!en! su! versi贸n!Open!Source,! no!incluye!aquellos! que! tienen!
licencia.! Para! aquellos! usuarios! acostumbrados! a! usar! la! sintaxis! SQL,! Qt! provee! de! la! clase!
QSqlQuery.!Para!usuarios!que!prefieren!evitar!esto,!y!desean!trabajar!a!un!nivel!m谩s!alto,!hay!2!
modelos! incluidos! en! las! clases! QSqlTableModel! y! QSqlRelationalTableModel,! las! cuales! ya!
mencionamos!en!el!tema!16.
Conectar!e!interrogar!con!SQL
Vamos! a! empezar! tratando! la! primera! forma! de! trabajar! con! bases! de! datos,! donde!
conectaremos!con!una!base!de!datos!MySQL,!y!la!interrogaremos!mediante!la!sintaxis!SQL.!
bool createConnection()
{
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("localhost");
db.setDatabaseName("megafonia");
db.setUserName("root");
db.setPassword("admin");
if (!db.open()) {
QMessageBox::critical(0, QObject::tr("Database Error"),db.lastError().text());
return false;
}
return true;
}
Esta!es!una!conexi贸n!a!la!base!de!datos!MySQL,!en!el!host!local,!con!nombre!megafonia,!
con!el!usuario!y!password!del!usuario!que!tenga!acceso!a!la!misma,!de!acuerdo!a!las!queries!SQL!
que!vamos!a!enviarle.
Lo!siguiente!ser谩!enviarle!una!query,!y!esto!se!hace!as铆:
QSqlQuery query;
query.exec("SELECT almacen, ntiendas FROM almacenes");
while (query.next()) {
QString almacen = query.value(0).toString();
int ntiendas = query.value(1).toInt();
qDebug("Nombre: %s - Tiendas: %d",qPrintable(almacen),ntiendas);
}
Como!puedes!ver!la!funci贸n!exec()!ejecuta!el!query,!next()!recorre!el!puntero!por!la!tabla!
respuesta,! y! value!es!una!lista!QVariant,!donde!los!campos! tienen!铆ndices!del!0!en!adelante,!de!
esta!forma!value(0)!contendr铆a!el!campo!almacen!que!es!el!primero!en!la!respuesta,!y!en!value(1)!
estar铆a!el!campo!ntiendas.
Para!que!este!c贸digo!compile!bien,!es!necesario!que!se!a帽ada!el!m贸dulo!sql!al!proyecto,!
es!decir!al!fichero!*.pro!con!la!linea:
QT!+=!sq

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Aplicacion inicial
Posted: Thu Jun 11, 2015 07:25 AM
jnavas wrote:Crist贸bal,
Encontr茅 esta documentaci贸n:

http://choccac.com/?wpfb_dl=1




Muy bueno, gracias
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Aplicacion inicial
Posted: Wed Oct 17, 2018 01:43 AM

Crist贸bal,
Your App is really nice, but the majority of the code is not fivewin! There are a lot of functions that I don't know!
I'm thinking Fivetouch would allow us developer apps using the syntax we already know. Isn't it ?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Bel茅m-Pa-Brazil
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Aplicacion inicial
Posted: Wed Oct 17, 2018 02:38 AM
vilian wrote:Crist贸bal,
Your App is really nice, but the majority of the code is not fivewin! There are a lot of functions that I don't know!
I'm thinking Fivetouch would allow us developer apps using the syntax we already know. Isn't it ?


Dear Vilian, no
Look fivetouch.ch
Fivetouch run equal as fivewin
Sample of commands Fivetouch.ch

Code (fw): Select all Collapse
#define FTVERSION 1.0

#define CRLF hb_eol()

#command ? [ <list,...> ] => ConsoleOut( [ { <list> } ] )

#xcommand TEXT INTO <v> => #pragma __cstream|<v>:=%s

#xcommand DEFINE WINDOW <oWnd> ;
聽 聽 聽 聽 聽 聽 聽[ TITLE <cTitle> ] ;
聽 聽 聽 聽 聽 聽 聽[ COLOR <nRGBColor> ] ;
聽 聽 聽 聽=> ; 聽 聽 聽
聽 聽 聽 聽 聽 聽 聽<oWnd> := QDialog() ;;
聽 聽 聽 聽 聽 聽 聽<oWnd>:ShowMaximized() ;;聽 聽 聽 聽 聽 聽 聽 聽
聽 聽 聽 聽 聽 聽 聽[; <oWnd>:SetWindowTitle( IfNil( <cTitle>, "FiveTouch" ) ) ] ; 
聽 聽 聽 聽 聽 聽 聽[; <oWnd>:SetColor( IfNil( <nRGBColor>, nRgb( 255, 0, 0 ) ) ) ] ;;
聽 聽 聽 聽 聽 聽 聽<oWnd>:ShowMaximized()聽聽 聽 聽 聽 聽 聽 聽
聽 聽 聽 聽 聽 聽 聽
#xcommand ACTIVATE WINDOW <oWnd> ;
聽 聽 聽 聽 聽 聽 聽[ ON INIT <uInit> ] ;聽 聽 聽 聽 聽 聽 聽 聽
聽 聽 聽 聽=> ;
聽 聽 聽 聽 聽 [ Eval( <{uInit}> ) ] ;;
聽 聽 聽 聽 聽 <oWnd>:Exec()聽聽 聽 聽 聽 聽

#xcommand DEFINE DIALOG <oDlg> ;
聽 聽 聽 聽 聽 聽 聽[ SIZE <nWidth>, <nHeight> ] ;
聽 聽 聽 聽 聽 聽 聽[ TITLE <cTitle> ] ;
聽 聽 聽 聽=> ; 聽 聽 聽
聽 聽 聽 聽 聽 聽 聽<oDlg> := QDialog() ;
聽 聽 聽 聽 聽 聽 聽[; <oDlg>:SetWindowTitle( IfNil( <cTitle>, "FiveTouch" ) ) ] ; 
聽 聽 聽 聽 聽 聽 聽[; <oDlg>:ReSize( IfNil( <nWidth>, 400 ), IfNil( <nHeight>, 300 ) ) ]
聽
#xcommand ACTIVATE DIALOG <oDlg> ;
聽 聽 聽 聽 聽 聽 聽[ <center: CENTER, CENTERED> ] ; 
聽 聽 聽 聽=> ;
聽 聽 聽 聽 聽 [ <oDlg>:Center( <.center.> ) ;] ;聽 聽 聽 聽 聽
聽 聽 聽 聽 聽 <oDlg>:Exec()


In my example, I have used the functions directly (as if it were the generated .ppo file, without using commands), but you can use the commands or create your own commands and add them to fivetouch.ch, as you need it (as we do in Fivewin)
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Aplicacion inicial
Posted: Thu Oct 18, 2018 11:51 AM
Crist贸bal,

Do you know how to use this function http://doc.qt.io/archives/qt-4.8/sql-connecting.html with Fivetouch ?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Bel茅m-Pa-Brazil
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Aplicacion inicial
Posted: Fri Oct 19, 2018 04:25 PM
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces

Continue the discussion