Странно создал в Qt дизайнере форму с двумя TableView и кнопку, которая бы показывала и скрывала сетку. Сетка по умолчанию включена (showGrid = true), однако после компиляции и запуска программы не в одном из TableView сетки нет, просто белые квадраты.
Вот ui_untitled.h:
/********************************************************************************
** Form generated from reading ui file 'untitled.ui'
**
** Created: Sun Oct 26 12:29:03 2008
** by: Qt User Interface Compiler version 4.3.3
**
** WARNING! All changes made in this file will be lost when recompiling ui file!
********************************************************************************/
#ifndef UI_UNTITLED_H
#define UI_UNTITLED_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QPushButton>
#include <QtGui/QTableView>
#include <QtGui/QWidget>
class Ui_Form
{
public:
QTableView *tableView;
QTableView *tableView_2;
QPushButton *pushButton;
void setupUi(QWidget *Form)
{
if (Form->objectName().isEmpty())
Form->setObjectName(QString::fromUtf8("Form"));
Form->resize(580, 305);
Form->setBaseSize(QSize(5, 5));
tableView = new QTableView(Form);
tableView->setObjectName(QString::fromUtf8("tableView"));
tableView->setGeometry(QRect(20, 70, 256, 192));
tableView_2 = new QTableView(Form);
tableView_2->setObjectName(QString::fromUtf8("tableView_2"));
tableView_2->setGeometry(QRect(300, 70, 256, 192));
pushButton = new QPushButton(Form);
pushButton->setObjectName(QString::fromUtf8("pushButton"));
pushButton->setGeometry(QRect(250, 20, 75, 23));
retranslateUi(Form);
QObject::connect(pushButton, SIGNAL(clicked(bool)), tableView, SLOT(setShowGrid(bool)));
QObject::connect(pushButton, SIGNAL(clicked(bool)), tableView_2, SLOT(setShowGrid(bool)));
QMetaObject::connectSlotsByName(Form);
} // setupUi
void retranslateUi(QWidget *Form)
{
Form->setWindowTitle(QApplication::translate("Form", "Form", 0, QApplication::UnicodeUTF8));
pushButton->setText(QApplication::translate("Form", "PushButton", 0, QApplication::UnicodeUTF8));
Q_UNUSED(Form);
} // retranslateUi
};
namespace Ui {
class Form: public Ui_Form {};
} // namespace Ui
#endif // UI_UNTITLED_H
А вот main.cpp:
#include <QApplication>
#include <QDialog>
#include "ui_untitled.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Ui::Form ui;
QDialog *dialog = new QDialog;
ui.setupUi(dialog);
dialog->show();
return app.exec();
}
В чем может быть проблема? Почему сетка не видна?