While I find the above answer accurate, I think it needs further clarification because it answers a question that is different from the one that was asked.
The question was: "Is IQ (mainly) a genetically inherited trait?" The answer related not to how heritable IQ is, but to how heritable individual differences in IQ are. The point of confusion is that 'heritability' has a very special meaning in the literature, as it relates not to how strongly a trait is expressed, but to how much differences in a trait are carried over from generation to generation:
The concept of heritability plays a central role in the psychology of
individual differences. Heritability has two definitions. The first is
a statistical definition, and it defines heritability as the
proportion of phenotypic variance attributable to genetic variance.
The second definition is more common "sensical". It defines
heritability as the extent to which genetic individual differences
contribute to individual differences in observed behavior (or
phenotypic individual differences).
The original question actually can't be answered based on current research, because the research revolves around individual differences. I want to offer some further explanation on the the answer that was given, which tells us how heritable individual differences in IQ are. I don't have many references to back me up because it is just a discussion of the meaning of correlation, but in the context of intelligence, it has been briefly discussed here
When a trait is heritable, there is a correlation between how much it is expressed in parents and their children. This means, if we were to take all the parents and rank them based on IQ, and then take all the children and rank them, the 'parental rankings' and the 'child rankings' would be similar: the parents with the highest IQs are most likely to have children with the highest IQs, and so on. The important thing here is that both these rankings are made within one age group only. This means, in theory, that all children could have an IQ vastly above or below their parents, and yet the correlation would persist. The size of the correlation won't change if parents and children have different IQ scores on average, as long as the rankings don't change within each group.
The Flynn effect is a known instance of children consistently getting better IQ scores than their parents in each successive generation, with no effect (I believe) on how heritable IQ is. It is similar with height: height is a highly heritable trait, but kids nowadays are taller than their parents more often than not. Or, to give an example adapted from the paper I linked above, imagine you are looking at differences between the length of stalks of wheat in a field. Then add fertilizer, observe that the stalks have all grown by 1/3 of their original height, then look at the differences in their lengths again. They are likely to be preserved, i.e. their rankings won't change. In the context of IQ, as long as an environmental effect persistenly affects a whole generation, IQ can remain highly heritable, while the scores of parents and their children can differ significantly. This is true of adopted kids (also mentioned in the first link), whose IQ correlates with that of their biological parents and not with their adoptive parents, but is still closer to adoptive parents'.
The take-home message is that the size of a trait, and how correlated that trait is to something, are two independent measures. So, even if individual differences in IQ are highly hereditary, this does not tell us how similar IQs of two related people are.