Results 1 to 6 of 6

Thread: calendar button in a QtableView or something

  1. #1
    Join Date
    Jul 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default calendar button in a QtableView or something

    Hi everyone!!!

    First, i have to say that i don't know if i have choosen the rigth title for this post.

    Well, my "problem" is the next one:


    i got a window to edit some tables from my database. I use a QSqlTableModel and a QTableView to show it. There is some tables that have a date field in them. And what i want to achieve is that the date can be entered with a widget tha pops up when the users click it (like happens in the web).

    My idea is to insert a button into that field in every record or row in my Table. There is so many calendars done with javascript. and i gat a few of them. I thought maybe i could use java script to achieve this.

    I hope that some body in this forum can help me. Maybe some body made it, may be some body made it with another approach. but i need some ideas or suggestions.

    in conlusion, i got this:




    and y want to include some thing like this:



    Any i dea will be appreciated!! :thumbsup: :thumbsup: :thumbsup:

    im waiting for some answers. So many thanks in advance, sorry for my bad english.



    In spanish:

    poseo una ventana para editar tablas de mi base de datos. Existen algunas tablas que poseen un campo fecha. y lo que quiero lograr es que en lugar de que la fecha se introduzca manualmente (propenso a ser una fecha inválida), quiero crear un boton alli dentro de ese line edit o algún método similar que traiga un calendario emergente (de esos que vemos mucho en la web). Busque en internet y existen muchos calendarios ya implementados en JavaScript.

    algo asi es lo que tengo:



    y quiero ponerle algo como esto:



    pensaba en usar un QCalendarWidget y estarÃ*a bien..si no fuera por el hecho de que realmente necesito que se vea flotante como el de la web y no en una ventana a parte. Por eso pensé en el JavaScript.

    Bueno al final, si alguien tiene idea de cómo hacerlo o conoce otro método para lograrlo por favor, agradeceré su respuesta aquÃ*.

    Muchas gracias de antemano.

    :thumbsup: :thumbsup: :thumbsup:

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: calendar button in a QtableView or something

    Hola!

    More Spanish is not possible First: I haven't done it myself, but I would go for a custom delegate. For the button reimp the delegates paint methode. As for the pop up you have to create an editor. See the createEditor() function. Also read the section "Model/View Programming" in the docs.

    Unfortunatelly there is no out of the box solution for you.

  3. #3
    Join Date
    Jul 2009
    Posts
    74
    Thanks
    2
    Thanked 6 Times in 6 Posts

    Default Re: calendar button in a QtableView or something

    --- in english ---

    You cannot create a calendar widget with javascript...
    You could create a calendar in javascript if you use a qwebview to show your data... but you are using a qtableview...
    If you want to add a button in a qtableview is quite easy... just google it... there are many examples out there.
    Anyway I don't understand the meaning of a "floating" calendar.
    Just put a button... and when the user click on the button show a qcalendarwidget in the position you want !
    If you need a "movable" calendar... there are many options... for exampe : just create a dialog with a qcalendarwidget inside...

    Regards

    --- in spanish ---
    Lo de que esté codificado el calendario en javascript olvidate.
    Sólo podrÃ*as hacerlo si usas qwebview ... presentar allÃ* la lista y lo que quieras en html y javascript... en lugar de usar una qtableview...

    A mi entender mucho mas trabajo.

    Lo de agregar un botón o cualquier widget en una columna es fácil... busca por aquÃ* o en google... hay muchos ejemplos.
    No entiendo la necesidad de que el calendario sea "flotante"... No aporta nada...
    Simplemente pon un botón, y cuando el usuario pulse en el botón que se muestre un qcalendarwidget !!
    Si "con flotante" te refieres a que el usuario pueda moverlo por la ventana... pues create un dialog flotante con un calendario dentro... y que el botón llame a ese dialog.

    Saludos
    Last edited by javimoya; 8th January 2011 at 11:50.

  4. #4
    Join Date
    Jul 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Wink Re: calendar button in a QtableView or something

    So many thanks to you All. jajajaja "more is spanish is imposible"..it sounds great for Zona Qt (the spanish forum, where i am from).

    Well, friends all oyur answer are so important to me, that say thanks to you is...a little think.

    thanks again.

  5. #5
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: calendar button in a QtableView or something

    This might help.

    Or this. This one will automatically pop up a calendar widget if the right flags are set.

  6. #6
    Join Date
    Jul 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Question Re: calendar button in a QtableView or something

    Quote Originally Posted by SixDegrees View Post
    This might help.

    Or this. This one will automatically pop up a calendar widget if the right flags are set.
    this can really help me. thanks for it.

    But my problen now is how to insert this date edit into a field of my QtableView...???


    what method i need to use or what method i need to reimp???

Similar Threads

  1. How to use google calendar's api in Qt application ?
    By kellen851105 in forum Qt Programming
    Replies: 1
    Last Post: 29th March 2010, 13:24
  2. Is there any model for calendar?
    By nifei in forum Qt Programming
    Replies: 4
    Last Post: 16th February 2009, 22:22
  3. Pop-up Calendar From Pushbutton
    By wagmare in forum Qt Programming
    Replies: 7
    Last Post: 28th January 2009, 05:54
  4. Calendar Pop Up
    By Rakesh_Kumar in forum Qt Programming
    Replies: 7
    Last Post: 5th December 2008, 13:31
  5. QDateEdit read-only with calendar not r.o.
    By lauranger in forum Qt Programming
    Replies: 2
    Last Post: 24th January 2007, 17:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.