Problem description :

Used in the project QTableWidget
form , Want to set the table header color to blue , The colors of the lines are displayed alternately . Google for a long time , Can't be set successfully . In fact, it turns out that , There are two main reasons for unsuccessful setup :

* firstly , The method provided in other people's blog was wrong ;
* second , Because there is no code prompt for setting the header color code , I typed the wrong code when I wrote it .
terms of settlement :

Direct code :
// Record six strings to the string list QStringList listStudents; // Add six strings to the string list listStudents <<
tr(" full name ") << tr(" Telephone ") << tr(" address ") << tr(" Age ") << tr(" Gender ") << tr(" class "); // Set horizontal meter
ui->tableWidgetStudents->setHorizontalHeaderLabels(listHeaders); // Set header color
// Set the color alternate display of adjacent lines ui->tableWidgetStudents->setAlternatingRowColors(true); // Vertical indicator is not displayed
* When setting the horizontal indicator , You can use one QStringList data structure . In this way, it is much more labor-saving to set the header than to use the cycle to set the single header directly .
* When writing the specific code of header color setting QT Creater No code prompt is provided , So be sure to spell and punctuate correctly .

©2020 ioDraw All rights reserved
Using genetic algorithm to solve function optimization problem ( Single target )CLion Novice step on the pit :CMake project is not loaded Google says home office affects work efficiency !2021 Return to offline office in 2010 Data analysis interview experience ( Give yourself a process of carding )C Language implementation of simple minesweeping ( It's all dry goods , Novice Xiaobai must see )Python Basic knowledge !!C Language implementation of minesweeping game Valentine's Day , rose , The one in your heart ~ Operation and maintenance work Python Painting cherry blossoms