- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
<分区>
这就是我正在做的事情。我有一个正在使用主窗口的软件,以及一个启动以下 managaAttributesDialog 对话框类的操作。当对话框打开时,我在数据库上执行查询并创建一个名为 EAVFittmentProperties 的自定义数据类型对象的列表,它只包含一些用于获取和设置属性的方法,这些属性是数据库索引的 int 和一个 QString,其中包含与该索引关联的名称。一切似乎都工作正常,直到我调用 setUpgGui,将那些 EAVFittmentPropeties 转换为组合框,其中将保存可用值。它是一个制造年份搜索系统,因此我可以存储和检索任何给定车辆的油漆颜色,因此 EAVFitmentProperties 现在拥有 3 个值;品牌、型号和年份。这些组合框的列表中将包含可用的品牌型号和年份。一旦我调用 setUpGui 函数并开始遍历列表以创建组合框,它似乎跳过了第一个值,只创建了模型和年份框。
我对列表中的第一项发生了什么感到非常困惑,所以我有很多调试语句,甚至在调用 setUpGui 函数之前运行相同的迭代并且一切正常。任何人都可以提供任何见解,或者知道发生了什么事吗?如果我可以提供更多信息,请询问,这让我发疯,我很想知道发生了什么。提前谢谢大家!
#include "manageattributesdialog.h"
#include "eavfittmentproperties.h"
#include <QtWidgets>
#include <QtSql>
ManageAttributesDialog::ManageAttributesDialog(QWidget *parent) :
QDialog(parent)
{
QSqlDatabase localdb = QSqlDatabase::database("");
if(localdb.open())
{
QMessageBox::information(this,"Connected","Connection to the Database was Established\n"
"\nStatus: Connected");
QSqlQuery *qry = new QSqlQuery(localdb);
if(qry->exec("SELECT * FROM [ProductHelper].[dbo].[EAV_FittmentProperties]"))
{
int z = 1;
while(qry->next())
{
z++;
qDebug() << qry->value(0).toString();
qDebug() << qry->value(1).toString();
int mX = qry->value(0).toInt();
EAVFittmentProperties *fitmentPropertyOption = new EAVFittmentProperties(this);
fitmentPropertyOption->setIndexID(qry->value(0).toInt());
fitmentPropertyOption->setName(qry->value(1).toString());
fitmentPropertiesList.append(fitmentPropertyOption);
}
qry->finish();
}
else
{
QMessageBox::information(this,"Database Query Failed","Query to the Database could not be completed\n"
"\nStatus: Query Not Completed\nError: " + localdb.lastError().text());
}
localdb.close();
for(int i = 0; i < fitmentPropertiesList.count(); i++)
{
qDebug() << i << " is the number we are on";
qDebug() << fitmentPropertiesList[i]->getIndexID();
qDebug() << fitmentPropertiesList[i]->getName();
}
}
else
{
QMessageBox::information(this,"Not Connected","Connection to the Database could not be Established\n"
"\nStatus: Not Connected\nError: " + localdb.lastError().text());
}
setUpGui();
}
void ManageAttributesDialog::setUpGui()
{
//QFrame *mFrame = new QFrame(this);
QVBoxLayout *mLayout = new QVBoxLayout();
QLabel fitmentHeadingLbl;
fitmentHeadingLbl.setText(tr("Fitment Options"));
mLayout->addWidget(&fitmentHeadingLbl);
fitmentPropertiesList.begin();
qDebug() << fitmentPropertiesList.count();
for(int j = 0; j < fitmentPropertiesList.count(); j++)
{
qDebug() << j << " is the number we are on";
qDebug() << fitmentPropertiesList[j]->getIndexID();
int sInt = fitmentPropertiesList[j]->getIndexID();
qDebug() << fitmentPropertiesList[j]->getName();
QString sString = fitmentPropertiesList[j]->getName().toLatin1();
qDebug() << sInt;
qDebug() << sString;
fitmentPropertyLayout[j] = new QVBoxLayout();
QVBoxLayout *thisLayout = fitmentPropertyLayout[j];
fitmentPropertyLabel[j] = new QLabel();
QString sString = fitmentPropertiesList[j]->getName().toLatin1();
qDebug() << sString;
fitmentPropertyLabel[j]->setText(sString);
fitmentPropertyCombo[j] = new QComboBox();
thisLayout->addWidget(fitmentPropertyLabel[j]);
thisLayout->addWidget(fitmentPropertyCombo[j]);
//mLayout->addLayout(thisLayout);
}
//mFrame->setLayout(mLayout);
this->setMinimumSize(400,400);
this->setLayout(mLayout);
}
我对 Qt Qlist 容器有一个有趣的问题。尝试将 QList append 到 QList 会使我的迭代器指向内存的未知部分。 QList listSmall; QList> listBig; f
我对 documentation. 的 QList 复制构造函数感到困惑 QList::QList ( const QList & other ) Constructs a copy of other
我试图在运行时将项目附加到 QList,但运行时出现错误消息。基本上我想做的是制作一个 QList 的 QList 并向每个内部列表添加一些 customClass 对象。这是我的代码: 小部件.h:
所以我有一个名为 AppointmentSchedule 的类,它属于以下类型: namespace Ui { class AppointmentSchedule; } class Appointme
我正在使用 Qt5 用 C++ 编写一个视频抓取应用程序。我正在关注他们的示例代码并查看获取相机信息的文档: http://doc.qt.io/qt-5/qcamerainfo.html 我遇到的问题
我试图将 2d QList 作为 Q_PROPERTY 传递到 QML,但是,在 QML 内部,我无法实际访问任何信息。 一些代码: C++:q_property 由构造函数中的 q_invokabl
我有以下方法(只有 1 个参数),我想对其进行调整以用于 1 个以上的参数。我尝试使用默认参数,但这不起作用。 (只有旧方法的原始代码工作正常)令我印象深刻的是该声明中省略了变量名。 为什么? 这是我
在我的 mainwindow.h 中,我有一个 QList m_qlServoList,它应该存储指向 Servo 对象的指针: QList m_qlServoList; 当我尝试将新的伺服指针 ap
有没有简单的方法来复制QList从新 QList 中的位置 a 到 b? 我测试过: QList newList(list.begin()+5,list.end()); 但它不起作用。我收到错误消
我找不到使用另一个类模板将 QObjects 的 QList 转换为另一个 QList 的方法。我有一个创建 QObjects 实例然后返回 QList 的函数。所以我的问题是,我可以将 QList
有没有简单的方法来创建 QList来自 QList ? (不迭代 QList 并将每个元素添加到 QList ) 最佳答案 答案是否定的。你怎么可能在不迭代的情况下将一个转换成另一个?即使您正在使用某
我有几个属性类型为 QList 的类.我使用原始指针来表示所有权。此访问器将返回 QList>因为我们不想分发原始指针。问题是目前每个访问器或多或少看起来像下面这样: QList> values; C
我正在尝试使用 QT 框架获取存储在 QList 中的帐户列表的总余额。 我的问题是总余额需要从不允许我这样做的类中访问 protected 成员余额。 这个问题来自大学的作业,问题已经给了我程序的
学习C++,所以要温柔:)... 我一直主要使用堆变量(来自 C)来设计我的应用程序,所以我设计了这样的结构: QList _Criteria; // ... Criteria *c = new Cr
因此主题行中提到的代码会导致 Qt 4.8.3 和 gcc 4.7.2 出现段错误 这在 .cpp 文件中的任何类/结构之外,适用于 gcc 4.4 const QList warnings = QL
我最近一直在从事一个项目。当我尝试运行项目时,出现此错误: /ASSERT failure in QList::operator[]: "index out of range", file /usr/
我对 QT 没有太多经验,今天出现了这个问题。 QList memList; const int large = 100000; getchar(); for (int i=0; i
我明白了qCopy ,和 qCopybackward但似乎都不让我以相反的顺序复印。 qCopybackward 仅以相反的顺序复制它,但使该死的元素保持相同的顺序!我想做的就是以相反的顺序返回列表的
typedef struct { char *u8_testStep; char *u8_functionTested; char *u8_testDescription;
我有一个应用程序,其目的是获取按键值并将其放入 QList 中。但是,每次我调用处理 QList 修改的类成员函数时,成员变量 QList 都会被重置。我相信我有范围问题,但我不知道在哪里。这是我的代
我是一名优秀的程序员,十分优秀!