Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 934621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:02:00+00:00 2026-05-15T21:02:00+00:00

Just trying to mess around with Qt and SQLite to get familiar with how

  • 0

Just trying to mess around with Qt and SQLite to get familiar with how things work- I haven’t really done DB programming since my vb6 days, so please be easy ;]

I’m just trying to get the result of a query and I’m trying to follow some examples I found online (namely this one). The process seems simple enough: create the QSqlQuery object, have it execute a query, check that something came back, and just get the value. When doing this, I’m getting an error. Code follows:

bool DatabaseManager::structureDB(){
    QSqlQuery query;
    query.exec("CREATE TABLE mytable"
                      " (id integer primary key,"
                      " firstname varchar(20),"
                      " lastname varchar(20),"
                      " age integer)");

    QSqlQuery query2;
    query2.exec("pragma table_info(mytable)");

    if(query2.first()){
        QString test = query2.value(0).toString(); // Error line
        qDebug()<<test;
        return true;
    }
    return false;
}

The error I am getting is:

error: invalid use of incomplete type 'struct QVariant'

On the line commented above. I’m not sure what this error means or what I’m doing wrong, can someone please help? Thanks so much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:02:01+00:00Added an answer on May 15, 2026 at 9:02 pm

    Basically, the type is declared but not defined, like this:

    struct QVariant;
    

    Once you try to use it, it needs to be defined, like this:

    struct QVariant
    {
        // stuff goes here
    };
    

    The error is telling you it’s incomplete (declared but not defined), and therefore not usable. You should include the header <QVariant> to get the definition of QVariant, to make it complete and therefore usable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just trying to get my head around what can happen when things go wrong
Just trying to get my head around Generics by reading this enlightening article by
Just trying to get diff to work better for certain kinds of documents. With
Just trying to still get my head around IOC principles. Q1: Static Methods -
Just trying to get my irb sessions to actually list the current line of
Just trying to get up to speed with the SDK... So, I've created my
I'm trying to create a script to mess around with the db entries in
I've spent hours trying to get my code to work, its a rats nest
Just trying out this IDE but it already looks better than NetBeans in terms
just trying to test for equality in this piece of code, but getting a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.