Developing a calendar using an array of buttons [closed]
-
wrote on 21 Apr 2011, 08:56 last edited by
hey friends and qt experts ,I am new here and I have taken up the project of customizing calendar widget,i have created an array of buttons of size 6*7,ie, 6 rows and 7 cols,now i want to develop a calendar with this array of buttons,so instead of cells,i am using buttons,so any idea how to proceed,I apologize if i have not followed any forum rules.
I have coded for array of buttons ,which i am pasting it below@#include "mainwindow.h"
#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{ui->setupUi(this); QWidget *centralWidget = new QWidget; selectedDate=QDate::currentDate(); int count=1,i,j; QPushButton *button[10][10]; QGridLayout *controlsLayout = new QGridLayout; for(i=0;i<7;i++) { for(j=0;j<7;j++) { if(count<=42) { button[i][j] = new QPushButton(QString::number(count)); button[i][j]->resize(40,40); button[i][j]->move(40*j, 40*i); button[i][j]->show(); controlsLayout->addWidget(button[i][j],i,j); controlsLayout->setSpacing(0); centralWidget->setLayout(controlsLayout); setCentralWidget(centralWidget); count++; } } }
}
MainWindow::~MainWindow()
{
delete ui;
}
@ -
wrote on 21 Apr 2011, 09:08 last edited by
This topic has very recently been discussed in detail. Is this some kind of school assignment?
Please refer to:
http://developer.qt.nokia.com/forums/viewthread/5031/
http://developer.qt.nokia.com/forums/viewthread/5207
http://developer.qt.nokia.com/forums/viewthread/5363/Closing for now. If you feel it should be re-openened, please either contact me through email, or use the report button and explain why your case is different and deserves to stay open.
1/2