How to Develop a Calendar Widget.
-
wrote on 14 Apr 2011, 07:08 last edited by
In dialog.cpp, you need to make the connections not on lines 14 and 15, but where you actually create the dialog, after line 57. There you have a reference to both the dialogs, so there you make the connection.
-
wrote on 14 Apr 2011, 07:39 last edited by
thanks andre ,I got it and its working fine,thanks a lot
-
wrote on 14 Apr 2011, 07:42 last edited by
hey andre as we have set the background colors for the cells can we set the backgroundimage for the cells...by using,
QTextcharformat date;
date.setbackgroundimageurl -
wrote on 14 Apr 2011, 07:43 last edited by
if this function exists, try it out.
have a look at the docs. -
wrote on 14 Apr 2011, 07:49 last edited by
[quote author="imrrk" date="1302766931"]hey andre as we have set the background colors for the cells can we set the backgroundimage for the cells...by using,
QTextcharformat date;
date.setbackgroundimageurl[/quote]
Could you make your variable naming any more confusing? I mean: you're working with calendars and dates, and you call a variable that represents a text format date?Anyway, QTextCharFormat (or its base class QTextFormat) does not have a method setBackgroundImageUrl. At least, not that I could find. But you can use a QBrush instead of a color, so that opens up some more options as brushes can be quite fancy... Check the documentation of QBrush.
-
wrote on 14 Apr 2011, 08:46 last edited by
ok andre and gerolf,thanks for ur information,I will check out the doc and come up with some possibilities..
regards
imrrk -
wrote on 19 Apr 2011, 04:53 last edited by
hello friends
i want to change the font color for dates of calendar according to holidays ...for that i have used Qtextformat...but dont know hw can i use it to change the color of the font
-
wrote on 19 Apr 2011, 05:43 last edited by
The last reply here I moved over from "this":http://developer.qt.nokia.com/forums/viewthread/5296/ topic.
imrrk/BorahAnshuman: please keep your topics in logical groups. It does not make sense to re-open a thread about how to format the dates in a QCalendarWidget in a topic that is about the relative performance of an application on device and in the simulator.
-
wrote on 19 Apr 2011, 05:48 last edited by
[quote author="BorahAnshuman" date="1303188835"]hello friends
i want to change the font color for dates of calendar according to holidays ...for that i have used Qtextformat...but dont know hw can i use it to change the color of the font[/quote]
If the background color of a cell is controlled by setBackground, then it did not occor to you to look into the documentation of setForeground?
[quote]
Sets the foreground brush to the specified brush. The foreground brush is mostly used to render text.See also foreground(), clearForeground(), and setBackground().
[/quote] -
wrote on 19 Apr 2011, 05:51 last edited by
Thanks for ur reply...its working..
-
wrote on 19 Apr 2011, 05:55 last edited by
hello Andre
sorry for sending the question again...
how can i set backgroundImageUrl in each cell in calender…Actually i had use QTextCharformat for doing that but it not work..code i hv written is..
@QTextCharFormat format;format.BackgroundImageUrl;@
My question is how can i set image url here….any clue please suggest..
thanks -
wrote on 19 Apr 2011, 06:07 last edited by
I think you will need to use something like this:"
@
QUrl imageUrl;
//set the url to some valid value
format.setProperty(QTextFormat::BackgroundImageUrl, QVariant(imageUrl));
@But I don't think that will work, because the QCalendarWidget documentation states:
[quote]
Only a subset of the properties in QTextCharFormat are used by the calendar widget. Currently, the foreground, background and font properties are used to determine the rendering of individual cells in the widget.[/quote]Seems like you can only use the QTextCharFormat for the simple stuff, not for the fancy stuff. If you need to put an image in a cell, you are going to need to subclass QCalendarWidget and reimplement paintCell to do the rendering of your cells yourself.
-
wrote on 19 Apr 2011, 06:59 last edited by
hello andre
i had implement ur code like this..
@QUrl url = QUrl::fromEncoded("http://baytrail.abag.ca.gov/vtour/map4/access/CyteHils/Trail_to_Red_Hill_Summit.JPG");
safedate.setProperty(QTextCharFormat::BackgroundImageUrl,QVariant(url));//safedate is an object of QTextCharFormat ui->calendarWidget->setDateTextFormat(QDate(2011,4,19),startdate);@
but its not working..is anything missing here
regards
Anshuman -
wrote on 19 Apr 2011, 07:00 last edited by
hello andre,have you observed in the qcalendarwidget,at first time it shows the currentdate,but when we select a different date ,their is no such marker which tells that it is a currentdate,i mean to say that the currentdate should be underlined so that when a user selects a different date ,the currentdate can be identified by the underlined mark.
Regards
imrrk -
wrote on 19 Apr 2011, 07:06 last edited by
[quote author="BorahAnshuman" date="1303196388"]hello andre
i had implement ur code like this..
@QUrl url = QUrl::fromEncoded("http://baytrail.abag.ca.gov/vtour/map4/access/CyteHils/Trail_to_Red_Hill_Summit.JPG");
safedate.setProperty(QTextCharFormat::BackgroundImageUrl,QVariant(url));//safedate is an object of QTextCharFormat ui->calendarWidget->setDateTextFormat(QDate(2011,4,19),startdate);@
but its not working..is anything missing here
regards
Anshuman[/quote]What is missing, is that you did not read beyond the code snippet I posted. You know, the part that states that the code snippet is not going to work, as documented for QCalendarWidget, and that you need other ways of doing this.
-
wrote on 19 Apr 2011, 07:11 last edited by
[quote author="imrrk" date="1303196445"]hello andre,have you observed in the qcalendarwidget,at first time it shows the currentdate,but when we select a different date ,their is no such marker which tells that it is a currentdate,i mean to say that the currentdate should be underlined so that when a user selects a different date ,the currentdate can be identified by the underlined mark.
Regards
imrrk
[/quote]
So, why don't you set a different QTextCharFormat for the current date then? You can change the font using that class... -
wrote on 19 Apr 2011, 07:19 last edited by
ok thanks andre,i got it
-
wrote on 19 Apr 2011, 08:38 last edited by
Hello andre
As i am very new to qt so can u give me a brief idea of hw to implement paintCell to do the rendering of each cell...
with regards
Anshuman -
wrote on 19 Apr 2011, 08:50 last edited by
Why don't you use the QCalendarWidget sources as inspiration for that?
-
wrote on 19 Apr 2011, 09:22 last edited by
hello andre
thanks for ur reply..
Actually i hv been go through that source code..but i havent found any idea regarding setting of background image in particular cell..and as u said that to set an image in a particular cell we hv to implement paintcell to do the rendering of each cell…but hw this can be done..can u give me an idea for that
with regards
Anshuman
83/119