qt-interest@trolltech.com
[Top] [All Lists]

Re: Weird Row & Column number returned when QTable is clicked

Subject: Re: Weird Row & Column number returned when QTable is clicked
From: "TSC"
Date: Mon, 22 Nov 2004 18:21:29 +0800
I tried qDebug, but the row and column number returned remained the same.

"Peter-Josef Meisch" <mlist@xxxxxxxxxxx> wrote in message 
news:cnsc2k$rnm$1@xxxxxxxxxxxxxxxxxxxxx
> TSC wrote:
>
>> void myFmr::tableClicked(int row, int col, int button, const QPoint&
>> mouse){
>>    QMessagebox::information(0, "Row and Column Number", "Row number =
>>    " +
>> QString::number(row) + "Column Number = " + QString::number(column));
>> }
>
> The variable name "column" at the end of the statement is probably a
> typo, the variable is called col.
>
> I suppose the problem lies not in the slot tableClicked being passed the
> wrong parameters but in your compiler messing up the output. You should
> first use a debugger and check that the tableClicked() method is passed
> the correct values.
>
> You didn't say what OS and Compiler you are using. I think your compiler
> when processing
>
> "Row number = " + QString::number(row)
>
> is casting the second QString object to a (const char*).
>
> Try the following:
>
> QMessageBox::information(0, tr("Row and Column Number"), tr("Row number
> = %1, Column number = %2").arg(row).arg(col));
>
> P.J.
> -- 
> Peter-Josef Meisch 

--
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>