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 7975885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:46:04+00:00 2026-06-04T08:46:04+00:00

I have a data like BigArr, arr, … declared in header: class TableView:public QWidget

  • 0

I have a data like BigArr, arr, … declared in header:

class TableView:public QWidget 
{
  Q_OBJECT

  public:TableView (QWidget * parent = 0);

  std::vector < TXdata >  BigArr;

  std::vector < float >  arr;
  std::vector < float >  arr2;
  std::vector < int >  arrlocKtab;
  std::vector < int >  arrlocKrow;

In source file I have some functions I copy/pasted from somewhere else, like:

static void
 multiply (float q[4], float value)
{
  q[0] *= value;
  q[1] *= value;
  q[2] *= value;
  q[3] *= value;
}

and some other functions I made, like:

 void
 TableView::ShowContextMenu (const QPoint & pos)    // this is a slot
 {

How do I get declarations from header file to work inside copy/pasted functions. Like:

  static void
     multiply (float q[4], float value)
    {

  arr[0]= something...

I got some bad results from renaming c/p functions to void TableView::function and adding them to function list in the header file. Probably something to do with the static void &static inline void… Ty

  • 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-06-04T08:46:05+00:00Added an answer on June 4, 2026 at 8:46 am

    You have to define the multiply function as part of the TableView class as follows:

    class TableView:public QWidget 
    {
        ...
        void multiply(float q[4], float value);
        ...
    };
    

    Then define it in the source file like this:

    void TableView::multiply(float q[4], float value)
    {
        ...
        arr[0] = something;
        ...
    }
    

    Or you pass an instance of TableView into multiply() if you cant/dont want to make it a member of TableView. If you decide to pass in an instance of TableView to the function, then you’ll have to consider how to access the class members, either by making a getter function or making them public. The getter acccessor function is a cleaner solution.

    Either way will work, but if you decide to make everything member functions, consider the design and make sure the class doesnt become bloated, called low cohesion: en.wikipedia.org/wiki/Single_responsibility_principle

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

Sidebar

Related Questions

I have data like below AAAAAA BBBBBB CCCCCC DDDDDD EEEEEE Now there is a
I have data like: <td>USERID</td> <td>NAME</td> <td>RATING</td> I want to transform it into: <userid></userid>
I have data like this: Team | goal a | 5 b | 8
Say I have data like this: <option value=abc >Test - 123</option> <option value=def >Test
I have a table like this: Application,Program,UsedObject It can have data like this: A,P1,ZZ
I have some data like this : 1 TC1 PASS 2 TC2 FAIL 3
I have some data like this: -1,2752 -1,4735 1 -0,5500 1,3287 2 -1,6293 -2,1460
i have json data like this {GetStudentDetails: {TotalCount:5, RootResults:[ {city:West Chester,country:USA,state:PA ,student_id:100}, {city:Philly,country:USA,state:PA,student_id:101}, {city:Buffalo,country:USA,state:NY,student_id:102},
I have a data like this. Is there any way to smoothen my plot
I have data that looks like this: #info #info2 1:SRX004541 Submitter: UT-MGS, UT-MGS Study:

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.